Troubleshooting Oracle 10g XE Installation on Ubuntu

You’ve followed the instructions, everythings working fine. You shutdown your machine and go for a celebratory pint / cup of tea / curry.
Then, when you next start your machine, Oracle doesn’t want to know. What’s going on ?
To be honest, I don’t know. What I do know is that there are some steps you can take to at least attempt to diagnose your problem.

Before I go any further, I’d like to dedicate this post to Wayne.
He found himself in this position. After much head scratching between the two of us, he managed to find and resolve his problem.

Whilst a hardened veteran in computing terms, Wayne was new to both Linux and Oracle. From the mails I’ve received regarding this post, there seem to be a number of people in a similar position to him. Therefore, this post is written with these interpid souls in mind and I’ve tried to take time out to explain why we’re doing stuff at each step.


It’s now quite a while since I posted this and some people have contributed some really useful comments. These include solutions that they found to various problems, which are additional to the ones in this post. So, if you’re still having problems, check out the comments as well. MestreLion’s tip about sudo chmod -t /var/tmp/.oracle seems to be a particularly good example of this.

One other point worth mentioning is that Oracle 11gXE is now available. Many of the issues in this post are still relevant. However, if you’d like to know how to install the latest XE on Ubuntu or Mint, here are the instructions

So, what should be running ? There are two main components :

  • The Oracle Database
  • The TNS Listener

Is it plugged in ?

Let’s start with the obvious stuff. Can we actually run the shell script that starts everything – the one that’s behind the Start Database menu option ?
The file that actually runs is :

At this point we need to go to the shell, so go to the Applications menu and select Accessories then Terminal

Probably the easiest way to do this is to go to the directory in question, and do a bit of checking:

cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts

First off, we need to check the permissions on the file. We can do this using the ls command ( roughly equivalent to the DIR command in the Windows Command Prompt) :

ls -l

-rwxr-xr-x 1 oracle dba 958 2006-02-24 05:18

The output should look like the listing above.

Just to pick out the parts of this listing that are of interest to us :
The permissions ( Read, Write eXecute) are the rwx combinations at the start of the line.
These are split into three groupings.
The owner of the file appears after the permissions and the number 1. In this case, the owner is oracle.
Next to the owner is the group associated with this file – i.e. dba

Looking at the permissions, the owner ( the first 3 letters) should have read, write and execute permissions; the group should have read and execute.
The final grouping of privileges are for all other users on the system i.e. not the user oracle or members of the dba group. In this case they should have read and execute permissions as well.
If you find that the permissions on this file are different then you will need to change them using the chmod command. Because you’re not connected as root at this point and are not the file owner, you’ll also need to use sudo to get the command to execute successfully :

sudo chmod 755
[sudo] password for user :

Where user is your username
If you now list the file again, it should have the correct permissions :

ls -l

-rwxr-xr-x 1 oracle dba 958 2006-02-24 05:18

Once you’ve checked that the correct permissions are in place on the file, you can have a go at running it :


If it returns an error, then we have a clue and can start to track it down. If it doesn’t return anything, then it’s probably worked. You can check by going to the Database Home Page from the menu :

Applications / Oracle Database 10g Express Edition / Go To Database Home Page

If it comes up, then we know that we’ve been able to start successfully and the problem is probably connected with environment variable settings being missing when we try and run from the menu.

If you have started successfully, then stop everything now and keep reading. If not, well, just keep reading.

Sorting out the database

Start Oracle again from the menu and see what is actually happening. So :

Applications / Oracle Database 10g Express Edition / Start Database

Now, let’s check the database. First off, we need to check out if it has in fact been started :

Go to Applications / Oracle Database 10g Express Edition / Run SQL Command Line

SQL*Plus: Release - Production on Mon Apr 5 01:06:36 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connect sys as sysdba
Enter password:
Connected to an idle instance.

Connected to an idle instance means that the database has not been started.

Incidentally, we’re connecting here as the user sys in sysdba mode. This is the only way that you can connect to an Oracle database that isn’t up and running. If you connect with a different user or don’t specify sysdba mode, then you’ll get the error :

ORA-01034: ORACLE not available

If the database is not up, or you can’t get the Run SQL Command Line option to work, you need to go back into the shell.

Applications / Accessories / Terminal

Now we’re here, we need to check some stuff about your user to make sure that the problems we’re having aren’t down to some problem with permissions.
At the prompt :

$ echo $ORACLE_HOME 
$ echo $ORACLE_SID 
$ echo $NLS_LANG 

The $ORACLE_HOME and $ORACLE_SID should be set to the same values as above. The $NLS_LANG should be whatever the character set is that you chose during installation.

If the $ORACLE environment variables are not set (i.e. the command just returns a blank), then your problem is that these are not being set when your user starts a session.
To fix this, you need to edit your .bashrc file which is in your home directory.
At this point, you’ll be pleased to know that you’ll be spared the joys of hacking around in vi.
Ubuntu has it’s own GUI text editor called gedit, which can be invoked from the command line.
OK, so technically gedit is part of the Gnome desktop rather than Ubuntu itself, but we really don’t need to get into that now.

Back up the file first and then edit it

cp .bashrc old_bashrc
sudo gedit .bashrc

You need to add lines that look something like this

export ORACLE_SID 
export NLS_LANG 
export PATH 

Note – you need to set these variables above any other areas of the .bashrc in which they are referenced.
Another Note – keep the terminal session in which you’ve edited the .bashrc file open for the moment.

Once you’ve saved the changes, you can test the effects by starting a new terminal session and repeating the test for variable settings as described above – i.e.

$ echo $ORACLE_HOME 
$ echo $ORACLE_SID 
$ echo $NLS_LANG 

This time, all of the variable values you’ve set in the .bashrc should be returned.
Incidentally, if you find that you’ve made a mistake with the changes to .bashrc, you can fix it in the session you’ve been using to edit the original .bashrc as follows :

cp oldbashrc .bashrc

This will overwrite your changes with the copy of .bashrc that you made prior to editing it.
The copy of the file will still be there, so you will be OK to try editing again.

Once you’ve successfully applied these changes, the next thing to do is to make sure that we’re a member of the dba group. At the prompt type :


If dba isn’t included as one of the group names in the output of this command, then your user is not a member of this group. To rectify this, you need to add your user to the dba group. You can either do this through the Gui System/Administration/ Users and Groups ( as described in my original post) or you can just enter the following command :

sudo adduser username dba

where username is the name of your user on your machine.

Now we’re ready to try starting the database again ( Applications / Oracle Database 10g Express Edition / Start Database) and then re-test using the
Run SQL Command Line option ( give it a few seconds before trying to connect as the database might take a bit of time to start up).

TNS Listener

If the database is up and running ( or you’ve now managed to get it running), then congratulations, you’ve arrived at the fiddly bit.

The TNS Listener is the program that manages traffic between a client and an Oracle database. It’s analagous to a web server such as Apache ( or IIS). Instead of listening for HTTP requests like a web server, it will listen for TNS requests, which are what’s used for talking to Oracle.
In our case, the “client” and “server” are all on the same machine. Oracle provides a command line utility – lsnrctl – for managing the TNS Listener.
Before delving into the innards of the Listener, check to see if it is now up and running.
Applications / Oracle Database 10g Express Edition / Database Home Page
If the Home Page comes up, then everything is working and you can stop reading this and give thanks to the gods of computing. It’s working.
Still here ? OK, time to open up terminal again ( Applications / Accessories / Terminal)
At the prompt type :

lsnrctl status

If the Listener is down then you’ll get something like this :

LSNRCTL for Linux: Version - Production on 05-APR-2010 01:36:56
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=yourmachine)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused

where yourmachine is the name of your machine.

The relevant thing here is ( apart from the fact we have a Linux Error) what HOST= is set to.
Make a note of this value because we may well come back to it in a moment.

The next step is to try starting the listener and see what we get :

lsnrctl start

When Wayne ran this, he got :

LSNRCTL for Linux: Version - Production on
23-MAR-2010 08:54:44
Copyright (c) 1991, 2005, Oracle. All rights reserved.
please wait...
TNSLSNR for Linux: Version - Production
NL-00280: error creating log stream
NL-00278: cannot open log file
SNL-00016: snlfohd: error opening file
Linux Error: 13: Permission denied
Listener failed to start. See the error message(s) above..

What the Listener is telling us is that it can’t open the file /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
We need to check the permissions on this file :

cd $ORACLE_HOME/network/log 
ls -l listener.log
-rw-rw-r-- 1 oracle dba 193139 2010-04-05 01:57 listener.log 

When Wayne ran this on his system, he got

-rw-r--r-- 1 oracle dba 193139 2010-04-05 01:57 listener.log 

For some reason, the dba group did not have write permissions to the file, which was causing the Listener to fail to start.
This was easily solved as follows :

sudo chmod g+w listener.log

Roughly translated, we’ve given write access to the group associated with the listener.log file ( dba).
This is how Wayne managed to solve his problem.
If you had the same issue, once you’ve applied Wayne’s fix (above) you could try to re-start the listener at this point by running

lsnrctl start

If it works, you’ll get something like :

TNSLSNR for Linux: Version - Production
System parameter file is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Log messages written to /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=yourmachine)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=yourmachine)(PORT=1521)))
Version TNSLSNR for Linux: Version - Production
Start Date 05-APR-2010 02:04:59
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
Default Service XE
Listener Parameter File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

If this still does not bring you joy, there is still one thing left to check.
Remember that HOST= line I mentioned earlier ?
HOST is the machine the the listener is looking for the database on. In this case, all the action is happening on the same machine, but the listener still needs to be told that.

Check that the HOST is set correctly :

uname -n

This should return the same value as specified in the HOST=
We also need to make sure that there’s an entry for this machine in /etc/hosts

cat /etc/hosts

You’ll get a few lines from here, but the two that should definitely be there are : localhost yourmachine

If either of these checks produce different results on your machine, then we need to edit the listener.ora file, which is essentially the configuration file for the TNS Listener :

cd $ORACLE_HOME/network/admin
sudo gedit listener.ora

We need to make sure the LISTENER entry in this file looks like this :

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

We then need to make sure that the tnsnames.ora entry for the XE database also has the correct host name specified. The tnsnames.ora file is in the same directory as listener.ora and is essentially the “client” configuration file:

sudo gedit tnsnames.ora

XE =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

At this point, it’s worth stopping everything, doing a re-boot, and then trying to start everything up again. Fingers crossed everything will now be working.

I’ve done my best to highlight possible issues with your XE setup and how to resolve them. Obviously, I am painfully aware that I don’t know of all the possible issues you may get with this, but hopefully, you’ll at least be able to use some of these steps to get a better idea of why it isn’t working.


42 thoughts on “Troubleshooting Oracle 10g XE Installation on Ubuntu

  1. Pingback: Troubleshooting Oracle 10g XE Installation on Ubuntu « The Anti-Kyte

  2. Pingback: Troubleshooting Oracle 10g XE Installation on Ubuntu « The Anti-Kyte

  3. Pingback: Windows Fully Dedicated Server | Host Rage

  4. Hi Mike,

    Great post, again. I hope that after our pains and tribulations that someone out there will find this helpful. Your help was wonderful in getting my Oracle up and running. I really appreciate all the help you gave me.


  5. Thx a ton for this so very helpful blog, however I having real trouble in doing this installation:-

    1. First I have to give this command when logging as a root user :-

    . oraenv

    which actually asking me the SID info for my Oracle XE database (Here I am giving XE) and then only I am able to see the listener status/start ELSE I am getting “Command not found”. and same with when I am echoing my environments (get nothign in this case).

    2.Now when I am logging as a root user and did .oraenv and then echoing my environment, I am getting :-

    [root@ddcdevws02 ~]# echo $ORACLE _HOME
    [root@ddcdevws02 ~]# echo $ORACLE _SID
    [root@ddcdevws02 ~]# echo $ORACLE _PATH

    But I am able to start my listener:-

    lsnrctl status:- Says at the end line “The command completed successfully”
    lsnrctl start:- This says the Listener is already started …

    3. I am not able to connect to the HOME page using , getting page not found error.

    4. Seems My $ORACLE_HOME and $ORACLE_SID is not set, & I am not able to find this file “.bashrc” in my Oracle Home directroy “/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/”, to edit/modify.

    Please suggest me how to proceed and how/where/ to set the environment? As I am new to Oracle databse as well as Linux. Pease send me detailed setps as to what should I do with precedence.

    Thx again in advance.


  6. Sam,

    the .bashrc file is in your own home directory rather than the oracle home directory. When you first start a terminal session you will be in this directory.

    If you type :

    ls -l .bashrc

    you should get the file listed. If you make the changes in this file as suggested in the post, the menu option for starting Oracle should then work.

    One other point to note – when you check to see what the $ environment variables are set to, they do not contain spaces. It’s $ORACLE_HOME ( rather than $ORACLE _HOME).

    If you can fix this, then it will probably solve your other problems.

    Let me know how you get on,


  7. which actually asking me the SID info for my Oracle XE database (Here I am giving XE) and then only I am able to see the listener status/start ELSE I am getting “Command not found”. and same with when I am echoing my environments (get nothign in this case).

    • Nadean,

      it sounds as if your $ORACLE_SID environment variable is not set.
      To check, you can type the following :

      echo $ORACLE_SID

      If this is not showing anything, then you can fix this in the session by typing :

      export ORACLE_SID=XE

      If you want this to be set every time you start a session, you can also add this line to your .bashrc file.



  8. hi, the explanation is fantastic. I’m able to connect to the database throught web page but I’m not able to connec to DB through command prompt.. I tried all the instuctions above but when I type

    sql> connect sys as sysdba
    enter passw: india@123
    ORA-12154: TNS:could not resolve the connect identifier specified

    Kindly help me to resolve the problem..

    other than this I’m able to connec to sys, HR databases using web portal..

    • Vinoth,

      When you get prompted for your password at the prompt, you just need to enter the password, not the SID of the database you’re trying to connect to ( which is what I assume the 123 is).
      So, to use your example ( I’m assuming that india is the password and 123 is the name of the database you’re connecting to ) :
      connect sys@123 as sysdba
      Should cause the password prompt to come up. Then just enter :

      That should get you connected. Please let me know if I’ve misunderstood.


  9. Brilliant! This article was EXACTLY what I needed to solve my problem with XE failing to start on Ubuntu after a forced reboot.


    • Harin,

      could you be a bit more specific ?
      Where are you entering your password. What do you mean by “password does not write ?” If you can give some more details, I’ll do my best to help.


  10. This was a wonderful article, but still i am facing issues in connecting to oracle.
    I am getting the folllowing error.

    Listener refused the connection with the following error:
    ORA-12505, TNS:listener does not currently know if SID given in connect descriptor.
    The connection descriptor user by client was :

    Vendor code 0

    Following is the content in my listener.ora

    # listener.ora Network Configuration File:

    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server)
    (PROGRAM = extproc)

    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


    Following is the content in my tnsnames.ora

    # tnsnames.ora Network Configuration File:

    XE =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

    (SID = PLSExtProc)


    • Rajashekher,

      I’ve checked my listener.ora and tnsnames.ora files and the only difference I can see is that in both files, I use the actual name of the host machine rather than localhost. You may want to change the following and see if this helps to solve your problem. Replace my-pc-name in these examples with the name of the machine you’ve got XE running on. In the listener.ora :

      LISTENER =
          (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = my-pc-name)(PORT = 1521))

      In the tnsnames.ora :

      XE =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = my-pc-name)(PORT = 1521))
          (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = XE)

      Everything else in these two files looks to be OK.


  11. I couldn’t solve the problem until I put # at the begining of the line

    thanx for the help!

  12. Commenting out the (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE)) line in listener.ora works, but this way you lose the remote access feature (its disabled by default, but you can activate if you want)

    There are 2 workarounds for that:

    – The most common is login as oracle to start the database (sudo su – oracle). It works, but it would require you to go to terminal, or edit menu scripts, and also type your password everytime you want to start and stop the database.

    – The best solution is to remove the sticky bit from /var/tmp/.oracle. Thats what prevents listener to start correctly.

    sudo chmod -t /var/tmp/.oracle
    sudo chmod 0777 /var/tmp/.oracle

    Hope that helps!

  13. Thank you. This article has been very usefull and helped me solve my issues with the database.

    I had the same problem that yakup explained, and I solved ussing the “chmod -t /var/tmp/.oracle” tip. It worked fine for me.

    I’m running kubuntu 11.04, and had and additional problem: the oracle scripts didn’t appear in the menu. They were under “lost & found”. Easily solved ussing the menu editor:
    – Right click on the “kick-off Application launcher” button to bring up the editor (“Edit applications”)
    – Click “New Submenu” to create the ORACLE submenu
    – Drag and drop the ORACLE commands from the “lost & found” submenu to the newly created ORACLE submenu.

    Finally, it’s worth noting that the web access ussing “Application Express” takes a while to start, even after the database is already working. In my case, the database takes less than 5 seconds (that’s when the icon stops “bouncing”), but the web access is not available until 20 seconds later. I mention it because I stoped and started the database a couple of times not giving the web access time to start until I realized that in fact it was working fine. I guess this could be a usefull tip for other folk as impatient as I am.

    Thank’s again for the help.

    • Josema,
      Here are instructions on how you can do this
      thanks for the advice. I’m sure other KDE users will find it useful.
      As for the Application Express Web access, you may be able to speed it up by changing
      the order that oracle starts up the TNS Listener and the database.
      Here are instructions on how you can do this.
      I think lib-notify is a Gnome package, but there’s bound to be a KDE equivalent.
      In any case, with the change in the startup order, I find that I can hit the Database Home Page as soon as I get the
      notification that Oracle has started.
      Let me know if it works the same for you.

      • I’ve changed the startup order and worked fine (ussing kdialog instead of lib-notify)

        Thank you.

  14. Great stuff Mike! Your write-up is excellent and covers all the bases. I was able to successfully connect using oci_connect() on Ubuntu 10.04 running 10g on a VirtualBox installation on a Vista host. The first problem was in the permissions of the listener.log file which is set to chmod 777. The second problem was the listener.ora file, it said HOST= which I changed to localhost.

    Thank you very much!

  15. Great article and thanks a million! However you should add the sudo chmod -t /var/tmp/.oracle tip from someone above. I had the other problems mentioned in your article – not in the dba group, log permissions wrong – this “sticky bit” thing was the final piece in the jigsaw!

    Also you have a couple of typos where is referenced as

    • Dave,

      thanks for the feedback.
      I’ve now corrected the embarrassing typos.
      I’ve also included a mention of MestreLion’s sticky bit solution.


  16. I resolved this issue doing this following:

    1) changing the permissioning for listener.log as already described
    2) Making the following change in the listener.ora file:


    This was described here:

    Finally, the hostname was my local PC’s name rather than localhost when using Oracle SQL Developer.

    • Sujit,

      Are you trying to open the SQL prompt using the menu ?
      I think the first thing you’ll need to check is that the database is up and running.
      If you open a terminal then type :

      sqlplus username/password

      …where username is your database username ( or SYS if you haven’t yet created a database user) and password is the appropriate database password, then you should see something like this if the database is running :

      SQL*Plus: Release Production on Sun Sep 21 14:56:12 2014
      Copyright (c) 1982, 2011, Oracle.  All rights reserved.
      Connected to:
      Oracle Database 11g Express Edition Release - 64bit Production

      IF you get this then the problem is to do with your menu option for running SQL*Plus. This may be because the user you’re running as does not have the correct environment variables set.

      If it isn’t running, you’ll get something like :

      SQL*Plus: Release Production on Sun Sep 21 14:57:02 2014
      Copyright (c) 1982, 2011, Oracle.  All rights reserved.
      ORA-01034: ORACLE not available
      ORA-27101: shared memory realm does not exist
      Linux-x86_64 Error: 2: No such file or directory
      Process ID: 0
      Session ID: 0 Serial number: 0
      Enter user-name: 

      If this is the case, then you need to start the database and try again.

      Hope this helps,


  17. Hi MIke,

    Great explanations. I am able to connect to oracle xe database from Run SQL Command Line.
    But problem connecting from Oracle homepage.

    Also below command throws unusual error :
    lsnrctl status
    lsnrctl: command not found

    Could you help me with possible solutions.


    • Ritesh,

      It sounds like the environment variables you require are not set in your session.
      To check this, try :

      echo $ORACLE_HOME

      If this comes back blank then you need to include the settings for your XE environment variables in the .bashrc of your user ( or the global .bashrc) – assuming you’re running on a Debian based distro.

      If that doesn’t solve your problem, please could you let me know :
      – which version of XE are you running ( 10g or 11g).
      – which OS you’re running on.



  18. I have done this–“sudo chmod g+w listener.log”,
    but “lsnrctl start” still “NL-00280: error creating log stream”.
    oracle 10g xe(32-bit) on ubuntu 16.10(32-bit).

      • Lee,
        I haven’t got a 32-bit OS or 10gXE to hand at the moment. If you think it may be permissions then you can test this by making the file writeable by all – i.e.

        chmod a+w listener.log

        Let me know how it goes.



  19. Hi Mike, thanks for these great Posts. I recently had to solve the “Wayne” problem. The difference for me was that the listener.log file did not exist. My Solution:

    root@host log]# touch listener.log
    [root@host log]# ll
    -rw-r–r–. 1 root root 0 Jan 28 10:56 listener.log

    [root@host log]# chgrp dba listener.log
    [root@host log]# chmod g+w listener.log
    [root@host log]# chown oracle listener.log

    … we’ll see if that survives a reboot !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.