Monday, December 31, 2007

Start up Oracle XE in Ubuntu

I'm currently studying Oracle 10g express edition with a new book I just bought, called the Hands-On Oracle Database 10g Express Edition for Linux. Picking up this book perhaps might give me some speed to adopt oracle as my company was using oracle 9i for pl/sql development. However, there are couple of problems.

Starting up Oracle XE:
There one problem in starting up oracle 10g in Ubuntu after you restart the computer, which is it wouldn't start(if you didn't enable the "Start Oracle on logon" option) unless you login as Oracle user account. One way I found out to start the listener and database, without login as Oracle, is to run the restart command.
sudo /etc/init.d/oracle-xe restart
I don't know whether this is a security bug because firing the command start and stop doesn't work using your own login.

Check the database status using the following code:
sudo /etc/init.d/oracle-xe status
Sometimes, the database won't start after firing the restart command even the listener is active. Start the database using the menu path and check the status again. error

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/[[:not found
This also a common error if the terminal is set with the oracle environment or execute the sqlplus command. The solution is to edit the line from [[ to [ in the file.
#if [ -n "$LC_ALL" ]; then
#elif [ -n "$LANG" ]; then
Update: Running SQLPlus in Terminal
1. Copy the content in /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/
2. Open the file .bashrc in your home folder using text editor.
3. Paste the content from to .bashrc at the end.
4. Restart your terminal and type sqlplus.

Edit Object Code Error

From the screen shot, it shows triggers edit code page but there is no code in test area (and it doesn't allow me to edit either). I'm not sure whether this is a bug even after I ran update on oracle. Perhaps this edit object page works for other Linux distro but it sure didn't work on Ubuntu Gusty.

The workaround to solve this medium bug is to download the Free Oracle PL/SQL Developer and edit it from there. Or I can just drop the trigger and recreate again.

Update: Thanks to BigO for the alternative way to set up the configuration and Thanks to Halil-Cem for providing a better way to start and shutdown the database. Please check the comments for information.

Reference: Oracle-xe on Ubuntu, Oracle Express Online Documentation, Oracle 10g Express Edition