Valid HTML 4.01!


As part of the online degree in Computer Science that I've been doing, I'm required to use Oracle. Now, Oracle isn't open source software, so it was always going to be a bit irritating. What follows is what I discovered and posted on the University message board...

I've just been through a nasty battle trying to get Oracle installed on Linux. To cut a long story short, I cannot get it to work on my normal desktop (on which I have compiled everything from scratch - I guess the closed binaries just don't want to play nice with my open software, or vice versa).
However, I got out a spare hard disk and installed a fresh build of Debian Sarge. It seems that Oracle have helpfully provided an apt-get site for Debian users. You just add this to your apt list;

deb http://oss.oracle.com/debian/ unstable main non-free

...then run;

apt-get update
apt-get install oracle-xe

Once it's downloaded and installed, run...

/etc/init.d/oracle-xe configure

...and follow the prompts. My normal built-from-scratch desktop would always get to the point where the configure script would say; 'Starting Oracle Net Listener...' and then pause forever. The Debian one, however, continued, finished and everything seems to be running now - I can log in.

I think it might be nicer for me to install the Debian disk in a separate machine and connect remotely, rather than having to swap out disks whenever I want to switch between university stuff and other things.

I stuck my Debian Oracle disk in a different machine that I don't want to run any kind of desktop stuff on. After I got it to boot (had to specify 'noapic' as a kernel boot parameter), I found that Oracle wouldn't let me access the HTTP interface remotely.
I had to configure remote access somehow. I managed to do it by 'ssh'ing to the machine, and using w3m to get to; http://localhost:8080/apex/
When you log in, there is an option called 'Manage HTTP Access', which is what you want.
I can now get to the web interface by using http://<IP address>:8080/apex/ from my desktop, so now I'm happy.


More fun and games trying to get sqlplus to work properly on Linux!
I think I'm becoming aware that I am the only Linux user on this course - if this is the case, then I suppose these notes that I'm making are at least going to be useful for me to refer to. In case my hard disk breaks and I have to start again from scratch or something.

It turns out that the sqlplus binary is located here;


You can't just run it straight off because it wants various environment variables set.
After hours faffing about trying to guess what it wanted set and getting various stages of nowhere, I finally discovered a script that does it for you (the Oracle documentation was no help, bah humbug, proprietory closed software rant, etc), so stuff this instruction in your .bashrc so that it loads automatically when you log into Linux;

source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

Now, as that long string should now be in your $PATH, you can just type sqlplus and enter, and you'll be up and running.
However, the default sqlplus interface is pants. First of all, whenever you press backspace, you get annoying '^H' characters appearing instead of mistakes being deleted. Also, none of the arrow keys work, so you have to be able to type extremely accurately. Plus, if you like your vi-style command line editing, you're stuffed because that's switched off too.
I've discovered some ways around this.
The first is to use 'rlwrap' (you can install it using apt-get if you don't have it already).
So, instead of just typing 'sqlplus', you type 'rtlwrap sqlplus'. I suppose you could make an alias of the sqlplus command that runs the rtlwrap version, and then you could just type 'sqlplus'.
The other method is to use something called 'gqlplus', available here; http://gqlplus.sourceforge.net/
You tar -zxvf it and run ./configure && make.
Warning: I noticed too late that the instructions warn you not to run 'make install', and did it anyway. I've not noticed any damage yet, so I hope I got away with it. Just copy the gqlplus binary that is created into /usr/bin or somewhere handy like that.
Then, you just run 'gqlplus', and you get the sqlplus prompt, but with proper command line functionality.
I noticed that I wasn't running in vi mode, so I created a file in my home directory called '.inputrc', added the line 'set editing-mode vi' to it, and logged in again and everything was great.


Oh, one more thing;

When you actually run a query in sqlplus, such as 'select * from drug;', the output looks terribly misformatted.
If you run these commands...

SQL> set recsep off
SQL> set linesize 100 (you can increase the width of your terminal with your mouse and increase this number)
SQL> set newpage 0
SQL> set pagesize 999

...and then, if any columns are overly long....

SQL> column dname format a20

(where the '20' is the maximum width you want the column to be, and 'dname' is the column header)

...you should get something that looks more reasonable.