Hostnames and Oracle XE

So, you changed your server hostname and you have Oracle XE running. And you think life’s simple and beautiful. It isn’t. You wish. Changing hostnames is. Oracle is always like that boyfriend (or girlfriend) you had in high school, full of issues and never happy and always needy. Yeah, I despise Oracle, that attention whore.

So, here’s the deal, after some research, what it takes to make Oracle ready for some change in your life, some brand new hostnames:

#1 Find your tsnames.ora and listener.ora files. They are probably located somewhere very intuitive and easy, like /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/lol/omgtehinternet/

#2 Change the contents of tsnames.ora

FROM

XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oldhostname.olddomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

TO

XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = newhostname.newdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

Do exactly the same thing with listener.ora

Restart oracle-xe and please, don’t be a fool like me and make sure your SElinux policies are correct before you go nuts and think everything is totally messed up. The errors you get from SeLinux are as intuitive as the oracle path.

Good luck!