gqlplus – sqlplus with readline (tab completion)

2012-08-03 1 min read Database
Tab completion is something which is missing in the sqlplus and if you have lot of tables with long names or lot of columns then it is sufficiently difficult to type them 🙂 Here is a solution for this problem. Download and install gqlplus. gqlplus is a replcement for sqlplus which supports completion for commands/tablenames and column names. Quite useful. Oracle SQL*Plus (Photo credit: Manuel Cernuda) Related articles 2 GB File limit on writing file using Oracle SQLPlus in Unix(compscicafe. Continue reading

Oracle Select the top 5 queries

2012-02-27 1 min read Database
Here are one sql script that I found some time back. This will be listing the top 5 SQL queries in Oracle. SET linesize 300 SET PAGESIZE 200 select * from (select sql_text, sql_id, elapsed_time, cpu_time, user_io_wait_time from sys.v_$sqlarea order by 5 desc) where rownum < 6; quit; Related articles SQL Fiddle (thinkvitamin.com) New Oracle E-Book (arnoldit.com) All about Security – SQL Injection (tkyte.blogspot.com)

Oracle GUI client on Linux with mysql support

2010-06-22 1 min read Fedora Linux
I was looking for some nice client for Oracle and mysql. I did find mysql-administrator and navicat to be useful but this is much better. <a href="http://sourceforge.net/projects/tora/" target="_blank">Tora is the client that I am talking about. Installation did not take much time for me.. downloaded the instant client from oracle.com and then the tora rpm from sourceforge.net. Also downloaded the tora-mysql from http://rpm.pbone.net/index.php3/stat/21/year/2002/month/01/day/28 Then tried to install all the rpms found the rpms that were missing and installed them using yum. Continue reading

SQuirrel SQL for Graphical interface to Oracle/MySQL and loads of other database -- OSS and free.

2010-06-04 1 min read Linux
<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category SQuirrel <a class="zem_slink freebase/en/sql" title="SQL" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL">SQL for <a class="zem_slink freebase/en/graphical_user_interface" title="Graphical user interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Graphical_user_interface">Graphical interface to Oracle/MySQL and loads of other <a class="zem_slink freebase/en/database" title="Database" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database">database — <a class="zem_slink freebase/en/open_sound_system" title="Open Sound System" rel="homepage" href="http://www.opensound.com/">OSS and free. <a class="zem_slink freebase/en/squirrel_sql_client" title="SQuirreL SQL Client" rel="homepage" href="http://www.squirrelsql.org/">SQuirreL SQL Client is a graphical SQL client written in <a class="zem_slink freebase/guid/9202a8c04000641f800000000f8545aa" title="Java (programming language)" rel="homepage" href="http://java.sun.com">Java that will allow you to view the structure of a <a class="zem_slink freebase/en/java_database_connectivity" title="Java Database Connectivity" rel="wikipedia" href="http://en. Continue reading

bash script with sql to get the number of records from multiple tables.

2010-02-10 1 min read bash Database Learning Linux Solaris
Here is the bash script: #!/bin/sh names[1]=errorlog names[2]=amit1log names[3]=amit2log names[4]=amit3log names[5]=amit4log j=1 echo $1 for i in $( sqlplus amit/passwd@tns @get_count.sql |sed -n &#8217;/COUNT/,/Disconnected/p&#8217;|sed &#8217;/COUNT/ d&#8217;|sed &#8217;/—/ d&#8217;|sed &#8217;/Disconnected/ d&#8217;|tr &#8217;n&#8217; &#8217; &#8217; ) do temp=${names[$j]} let count=30-${#temp} for ((I=1; I <= $count ; I++)) do printf &#8221; &#8221; done echo &#8221;${names[$j]} : $i&#8221; # echo $j let j=j+1 done echo echo and the required sql script: select count() from errorlog; Continue reading