Friday, February 12, 2010

sqlplus Wrapper Script For Linux

Installed Oracle 10g on RHEL5 x86_64 today and the sqlplus command prompt was driving me bats. This post gave some great tips on fixing sqlplus behavior. I combined them in one shell script to fix the backspace issue and the lack of history.


First, as the root user, install rlwrap. It should be a simple download, untar, then configure; make install; as root.

Once rlwrap is installed and working, create sqlplus.sh as the user who is going to be running sqlplus (change ~/ to whatever path you deem appropriate for the script):


#!/bin/bash
stty erase ^H
rlwrap sqlplus $@
stty erase ^?


Make the script executable:
chmod 0755 ~/sqlplus.sh

And in ~/.bashrc, add

alias sqlplus=’~/sqlplus.sh’


VoilĂ ! Your Linux sqlplus prompt should now be a bit more friendly.

No comments: