Lazy Typist
The first order of business is going to be how I interface with the Oracle database. I’m a lazy typist, so I usually set up all kinds of shortcuts.
The two main tools I use to access the database are SQL*Plus and PL/SQL Developer by Allround Automations. I find that I spend about equal amounts of time in either tool. SQL*Plus is wonderful for running scripts. PL/SQL Developer is great for, well, development and looking at large sets of data.
I run SQL*Plus primarily from within a PuTTY terminal window, or from the Windows command window. If you’re running SQL*Plus from within a Linux/Unix/etc_ix shell, it is a real pain unless you use it in conjunction with rlwrap. This will allow you to get a command history and some other nifty features.
So, on Linux/Unix/etc.., make sure to install rlwrap. Than create yourself an alias to call sqlplus with rlwrap:
alias sp=’rlwrap sqlplus’
Since I’m a lazy typist, I don’t even want to bother logging into Oracle, so in my development environment I set up another alias to allow me to log in without specifying the password. For this to work, I set up my test schemas so that the username and password are identical (use at your own peril).
alias spl=’rlwrap sqlplus %1/%1′
Now since I want to have some flexibility to lazily log into other databases, I use a simple shell script that checks whether I add a TNS alias to the command:
Script ~/sh/spl:
# --- Script start --- #
if [ $# -eq 2 ]
then
db=`echo $2 | sed 's/@//'`
echo db=$db
rlwrap sqlplus $1/$1@$db
else
rlwrap sqlplus $1/$1
fi
# --- Script end --- #
Now I set my alias like this: alias spl=’~/sh/spl’
If my ORACLE_HOME is set to test1, I can now simply log in like this
$ spl user1
If I want to log into to test2 is type
$ spl user1 test2
I also use this technique to quickly log in as sys, because typing “as sysdba” takes soooooo long:
alias sys=’sp / as sysdba’
Pingback: Rlwrap, the second « Christoph's 2 Oracle Cents