I've had some trouble initially setting up Oracle 10g Express on Ubuntu and ended up going through search engine results, blogs, and message boards. I've finally gotten it working so now I want to post all directions in one place.
Brief overview:
- Download and Install the .deb
- Run sudo /etc/init.d/oracle-xe configure
- Run /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh
- If language errors, edit the /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh file
- Add . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh to your .bashrc
- Start a new terminal session
- sudo chmod 6755 oracle in the $ORACLE_HOME/bin directory
- sqlplus system
Now for the details!
=============
GUI SETUP
=============
First, download the 10g Express version that you require. If you are in a western, English speaking country then I recommend Oracle Database 10g Express Edition (Western European).
http://www.oracle.com/technology/software/products/database/xe/htdocs/102xelinsoft.html
You'll need to sign up for a free account with Oracle to download the software. After getting the package, install it via your favorite method. Double clicking the file works well enough for this application. Once the package is installed you'll see the Oracle software in Applications -> Oracle Database 10g Express Edition.
Unfortunately, the installer doesn't automatically setup the initial components and this is when I ended up combing through search engine results. The setup is really quite simple. Just fire up a terminal session and type:
sudo /etc/init.d/oracle-xe configure
You'll then be prompted for what ports to run the web client and database on as well as whether or not you want the database to run at boot. Most importantly (at least to me) this is where you setup the SYS/SYSTEM password.
Here's what my output looks like:
Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after
initial configuration:
Confirm the password:
Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:y
Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8080/apex"
Sweet. Now I can connect to Oracle via the Web Client in Applications -> Oracle Database 10g Express Edition -> Go To Database Home Page or just bookmarking http://127.0.0.1:8080/apex
I already had apache installed and I don't know if it's required. If, for some reason, you can view the page, do a:
sudo apt-get install apache2
then (if apache isn't running)
sudo /etc/init.d/apache2 start
You can now login to the browser GUI and do what your need to do. Most of us want the next steps too.
===========
RUNNING VIA COMMAND LINE
===========
I have Oracle setup on one box and ssh into it so I need to run it command line to do it. SQLPLUS is used to access it but I ran into some problems. Here's how to fix it and get it running.
First, trying to run sqlplus will generate errors:
sqlplus sys as sysdba
sqlplus: command not found
It's already on your system but you need to run the oracle_env.sh script:
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh: 114: [[: not found
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh: 114: [[: not found
Bummer. I took out the if statements around line 114 (
:set number in vi to view line numbers) and just left the line 'locale=$LANG' by doing:
sudo vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh
That fixed my language error and so I just reran
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh
I also added
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
to my .bashrc file.
Now when I try
sqlplus sys as sysdba I get:
steven@MDW1003461:/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin$ sqlplus sys as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 3 11:58:58 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-09925: Unable to create audit trail file
GRRRRRR.
Further digging let me know I had to set the setuid bit on the Oracle executable.
So, close your terminal session then start a new one to load your environment variables. CD to $ORACLE_HOME (mine is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server) then go into the bin directory and do a
sudo chmod 6755 oracle
Let's try to connect again:
sqlplus system
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 3 12:13:12 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL>
VOILA!
So, to recap:
- Download and Install the .deb
- Run sudo /etc/init.d/oracle-xe configure
- Run /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh
- If language errors, edit the /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh file
- Add . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh to your .bashrc
- Start a new terminal session
- sudo chmod 6755 oracle in the $ORACLE_HOME/bin directory
- sqlplus system
YOU'RE IN!