Friday, June 13, 2008

Oracle 10g xe sqlplus for ubuntu settings

dross


Does anyone know if there is a way to change the default settings for oracle 10g xe sqlplus? For some reason, when I hit the up key, I'm not getting old commands that I've entered (as I get in the shell). Also, all columns are defaulting to the maximum character length, which makes most tables impossible to read without formatting columns..I seem to remember sqlplus shortening columns by default when I used it in windows...Any one have similar problems? or know how to fix these?


After some searching, I found that sqlplus for linux doesn't have command history buffer...too bad. But I also found a tool that seems to deal with it (haven;t used it yet, so can;t vouch for the performance, but it definitely has command history):gqlplus

http://sourceforge.net/projects/gqlplus

after you download gqlplus,

1. find your path variable:

Code:

echo $PATH

you should see this path in there:

Code:

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin

if you don't, you should edit .bashrc (see below) to put sqlplus in path (unless you have a custom configuration...in which case you probably wouldn't be looking here for direction)
--------------------------------------------------------------------
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE

export PATH

Start a new bash shell for the changes to take effect.

To log in as a database administrator:

sqlplus sys as sysdba

It will then be possible for you to create and unlock user accounts using Oracle SQL commands - they details of which are beyond the scope of this doc.
-----------------------------------------------------------------------------

2. take out the gqlplus executable from the download: gqlplus-1.12/Linux/gqlplus


3. place the executable in any of the path directories (probably makes sense to put it in the oracle xe path...or at least that;s what I did) and you should be able to access gqlplus with gqlplus command:

Code:

gqlplus


see:-https://help.ubuntu.com/community/Oracle10g#head-35cee01075d83fad1bb353beac13b27bda3fee32





for command History

install rlwrap (sudo apt-get install rlwrap) and invoke it before sqlplus like so:

rlwrap sqlplus user/pwd

you will get history with up and down arrow keys, home and end with their respective keys, and delete will actually delete. No tab completion, but then, I haven't found gqlplus' tab completion truly context-sensitive.

No comments:

Post a Comment