Change the hostname of a Linux server hosting Oracle
Files to update in Linux, Oracle and Enterprise Manager after a hostname or IP address change.
After a hostname change, Oracle and Enterprise Manager (EM) keep the old name in several configuration files. This checklist lists the files to update and the order of the operations.
1. Change the system hostname
Use nmtui or edit these files:
/etc/hosts
/etc/sysconfig/network
2. Update the Oracle files
Replace the old hostname in:
$ORACLE_HOME/network/admin/tnsnames.ora
$ORACLE_HOME/network/admin/listener.ora
$ORACLE_HOME/sysman/config/emd.properties
3. Restart and check the listener
lsnrctl stop
lsnrctl start
lsnrctl status
4. Recreate the Enterprise Manager repository
If EM Database Control still points to the old name, recreate its repository:
emca -deconfig dbcontrol db -repos drop
emca -config dbcontrol db -repos create
Change the IP address
On RHEL-family distributions, the network configuration is in:
cd /etc/sysconfig/network-scripts
cat ifcfg-eth0
Notes
emca -repos dropremoves the Enterprise Manager repository and its collected data: back it up, or accept that loss, before running it.- Reboot the server after the changes so that the new name is used everywhere.