Right, time to install XE on Ubuntu 9.10. Here goes….
Before we go any further, I think I should point out that I’m running the 32-bit desktop version of Ubuntu – Ubuntu Server is for another machine on another day.
My reasons for installing Oracle are simply to have a database to play around with, so I don’t have to worry about multiple concurrent connections, or even setting up the Oracle client on machines I want to be able to connect from. I’ll be connecting from the machine I’m running the database on.
Update - since I wrote this post, Oracle have released 11gXE. You can find installation instructions for this newer version for Mint and Ubuntu here.
Something else worth mentioning is that I’ve got a bit of “previous” on this score.
I installed XE on Ubuntu 8.10 a while back, and hit a few issues with being able to run the menu options that get added to the Applications menu.
Something else I noticed about the process was the need to run lots of commands that were doing stuff I wasn’t necessarily up to speed on. This meant lots of referencing various man pages to make sure I wasn’t doing anything rash.
So this time, I’m going to try and do as much as possible through GUI tools…and try to get everything working properly.
One of the big pluses in getting Oracle to run on Linux is that you can then mess around doing clever things with shell scripts. However, interacting with the database via a script does require that you’ve configured everything to allow SQL*Plus to be invoked from the command line.
Bearing all this in mind, I’m approaching the task this time with the following objectives :-
- Get Oracle XE up and running with minimal command-line intervention
- Get the menus working from the Ubuntu desktop
- Get SQL*Plus up and running from the shell
Getting the software
Right, first thing we need is the software itself. Rather than following the usual routine of going to the oracle site and downloading the software, I thought I’d see if I could take advantage of the Linux software package management utilities.
We’re in luck. Oracle does indeed provide a repository containing a variety of goodies, including XE.
So, what we’ll need to do first is to add the repository to the package repository database.
In 9.10, there’s this new utility called the Ubuntu Software Centre, so I thought I’d start there.
- From the Ubuntu Applications menu, select Ubuntu Software Centre
- From the Edit menu, select Software sources…At this point you’ll be prompted for your password
- In the Software Sources window, select the Other Software Tab.
- Click Add
In the pop-up window, type in the following as the APT line :-
deb http://oss.oracle.com/debian unstable main non-free
and click Add Source
You should now see this repository in the list.
- Check the box next to the repository and click Close
- Close the Ubuntu Software Centre window
If you want to double-check that the repository is now added, just open a Terminal session and type :-
You should see the new repository as the last entry in this list.
Unfortunately, the Ubuntu Software Centre doesn’t recognise this repository , so in order to actually obtain the software, we’ll need to use Synaptic Package Manager
To actually download the software from the repository :-
- From the Ubuntu System menu select Administration and then Synaptic Package Manager. Enter your password when prompted.
- In the Quick search field, type
- Remember, I’m going to be running the database and connecting to it all from one machine, so I don’t need the oracle-xe-client package. So, as I just want the Western European Edition, I just select the
NOTE – if you want a language other than English, I think you need to choose the
oracle-xe-universal package instead.
- Once you’ve marked the appropriate package, hit the Apply button.
- Synaptic now downloads two packages – libaio and oracle-xe.
Once the download is complete, we’re ready to install the software.
At this point, we really do need to go to the command line.
In a new Terminal session type the following :-
sudo /etc/init.d/oracle-xe configure
You will now be prompted for 4 bits of information :-
- the Oracle Application Express (APEX) http port ( defaults to 8080)
- the port for the database (TNS) listener ( 1521)
- the password to be used for the SYS and SYSTEM database accounts
- whether or not you want the database to start on boot (y)
NOTE – I’ve made a couple of changes to the default – I already have Apache installed so I need to use a different port. Also, I want the database to start when I choose, rather than automatically.
The TNS listener port can safely be set to 1521 ( or 1526) as these ports are known as defaults for the TNS listener so no other automatically configured software on your system should be using it.
The session looks something like this.
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 <Enter> to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express :8081
Specify a port that will be used for the database listener :
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
Confirm the password:
Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:n
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:8081/apex"
To check that the database is up and running, try accessing your database home page via a web browser.
If the page comes up, you’re up and running.
Getting the Menu Options to Work
You’ll also notice that the Ubuntu Applications Menu now has an entry called Oracle Database 10g Express Edition which has a number of options in it’s sub-menu…none of which will work right now.
In order to run these options, you’ll need to make yourself a member of the os DBA group that’s been created as part of the installation.
To do this :-
- Go to the Ubuntu System menu and select Administration and then Users and Groups
- Click the button with the picture of the keyring and enter your password
- Go to the dba group and then click Properties
- Click the checkbox next to your user
- Exit the Users and Groups tool.
Hey presto, the menu options will now work.
To test this :-
- Go to Applications / Oracle Database 10g Express Edition and click Stop Database This will stop the tns listener, shutdown the database, and the http listener.
- To verify this, try accessing the Database Home Page again. This time you should get a Page Not Found error.
- Now go back to the menu and this time click on Start Database. Give it a few seconds then try to access the Database Home Page again.
This time, it should come up. If it doesn’t, it’s possible that the database is still starting up, so give it a bit more time and then try again.
Getting SQL*Plus to run from the shell
There is a menu option in the Oracle Database 10g Express Edition menu that lets you connect to the database via SQL*Plus.
All you need to do is click on this then at the SQL prompt type :-
What I’m trying to do here is a bit different. I want to be able to invoke SQL*Plus from a Terminal session ( or a batch script).
Once again, we have to go to the command line to achieve this.
Remember, Oracle “sort of” supports Ubuntu as an OS for XE, but only sort of. The oracle supplied shell script that sets the environment variables to allow it’s command line utilities ( including SQL*Plus) to run, isn’t especially happy in the bash shell. So, you need to make a minor change to one line to get it to execute.
The file in question is
Open this file in whatever editor takes your fancy and change the line :-
Assuming you’re using the default Ubuntu setup ( bash is your shell), you can either copy the contents of this file wholesale into the
.bashrc file in your home directory, or you can point to it in this file. Either way, after saving the change to
.bashrc the next time you start a terminal session, you’ll find three new environment variables set on startup. To check this, open a Terminal session and type
This should return
This should return
This will return the character set for your database setup ( in my case
ENGLISH_UNITED KINGDOM.AL32UTF8 )
And finally, you can now invoke SQL*Plus from the command line :-
$ sqlplus uid/pwd
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 7 01:16:38 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
Conclusion…and an acknowledgement
Oracle XE is now up and running on Ubuntu. Now I can do some real damage
My initial ( mostly) successful installation attempt on 8.10 was done with reference to the guide at http://mediakey.dk/~cc/ubuntu-howto-install-oracle/
If you prefer your installations done on the command line, this is worth checking out, but I hope I’ve brought this a bit more up to date.
One final note of caution – Oracle XE is pretty much delivered “as is”. Whilst it is wonderfully useful for playing around with an Oracle database, it does have some limitations. Not least of these is that, unlike it’s big brother (currently Oracle 11g Release 2), Oracle don’t produce quarterly security patches for it. This means that you should think carefully before you go and use it in a production environment.
I was lucky enough to attend a presentation by Alexander Kornbrust at UKOUG in 2006 in which he graphically demonstrated these limitations. You can find his presentation here.
Edit – Cannot reach Database Home Page after restart
Hmmm….I thought that was too easy !
After re-starting my computer, I found I could no longer get the Database Home Page coming up.
After much cursing and puzzlement, I’ve tracked down the problem to the listener.ora file.
This file is used to control the configuration of the TNS Listener which process traffic to APEX, which sits inside the database.
To fix this annoying glitch…
Open up a Terminal session
sudo gedit listener.ora
change the line
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
# (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
Effectively you are commenting out this line.
Save and exit.
Go to the Start Database option in the Oracle Menu (under applications).
You need to give it a couple of minutes because the TNS listener gets started after the database does.
You should now be able to get to the Home Page.
Please let me know if this works for you.
UPDATE – I’ve now written an Installation Troubleshooting Guide, which you may want to check out if things still aren’t working as they should.
There’s also an introduction to PL/SQL here if you’re interested.