Monday, February 6, 2012

How to Change the Domain Name of An Already Running Oracle Database Instance

We have an application and database deployment that was done in virtual machines. Now we want to port this deployment to another office. This would mean changing the network settings for the virtual machines. We are running Oracle 11g 11.1.0.7 on RHEL 5.3. I was then required to change the domain name of the database in it. Here's what I did.

First I changed the network files on the server.

/etc/oratab
/etc/hosts
$ORACLE_HOME/network/admin/listener.ora
$ORACLE_HOME/network/admin/tnsnames.ora

Then I issued the following statements in the database.

ALTER DATABASE RENAME global_name TO oracle_sid.newdomain.com;
ALTER SYSTEM SET DB_DOMAIN = 'newdomain.com' SCOPE=spfile;

Then I restarted the database and did an ALTER SYSTEM REGISTER; to register the instance with the default listener.

To test, just try to connect to the database, or show parameter db_domain, or select * from global_name, or maybe issue a lsnrctl services command.

No comments:

Post a Comment