Oracle on linux: changing the hostname messes up with Oracle

There’s this Oracle 10g R2 database. It’s installed on SUSE. The version of the SUSE as far as I know is 11.1. We had to change the hostname of the linux machine (some corporate standards). Changing the hostname made Oracle unusable. It started on startup, but could open port 1521 and still thought it is on the old hostname. “/etc/init.d/oracle-xe status” said things are not working, even though the processes started without an error. port 1521 was not opened. It was strange that the startup script didn’t say something is wrong. It was strange that the db could be used locally by oracle’s command-line tools ( I guess via pipes since the port hadn’t been opened).I tried Google the issue, but fruitlessly. Then I tried to figure out where did Oracle keep the old hostname, but the directory structure of Oracle is not that easy to understand. Being desperate I tried searching the whole hard-drive for a specific string:

grep –r “old_hostname” /

After 24 hours I gave up.

Solution 1

Being desperate and developing on another temporary oracle server, we decided to give up corporate naming strategies and to return the old hostname – IT WORKED.

Solution 2

By chance I saw that the old hostname was used in tnsnames.ora and listener.ora. Being stubborn I changed the hostname to the one we wanted to use and edited both .ora files. It worked. I hate Oracle.

3 thoughts on “Oracle on linux: changing the hostname messes up with Oracle”

  1. By the time I started working on the machine (it was an express edition Oracle), this has been done and 127.0.0.1 was changed to the hostname, so the guy before me must have made a quick fix going from 127.0.0.1 (localhost) to the machine's hostname instead of 0.0.0.0.

    (0.0.0.0 means bind to all existing network interfaces when opening a port).

  2. Also I can understand why initially the listener is bound to 127.0.0.1 - for safety, otherwise if the machine has an external IP and no local or global firewall, the database would immediately be visible from the internet, which is not right. Check MySQL for example - with no password by default for the first user, that has full access.

    Usability versus Security, as Rafal Lucawiecki used to say.

Leave a Reply to mihail.stoynov Cancel reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

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