Fix Oracle Database after Hostname or IP Change

  • If the IP address and/or hostname changes for a system running Oracle, the following file should be updated to include the new IP address and/or hostname.

    # /etc/hosts
    
    • Before Example:

      # cat /etc/hosts
      127.0.0.1 localhost
      172.16.4.27 oracle-node-1.transnexus.com oracle-node-1
      
    • After Example:

      # cat /etc/hosts
      127.0.0.1 localhost
      172.16.4.77 oracle-node-2.transnexus.com oracle-node-2
      
  • If the hostname changes, the following Oracle files should be renamed to include the new hostname.

    $ORACLE_HOME/_dbname
    $ORACLE_OME/oc4j/j2ee/OC4J_DBConsole__dbname
    
    • Before Example:

      $ORACLE_HOME/oracle-node-1_dbaccounting
      $ORACLE_OME/oc4j/j2ee/OC4J_DBConsole_oracle-node-1_dbaccounting
      
    • After Example:

      $ORACLE_HOME/oracle-node-2_dbaccounting
      $ORACLE_OME/oc4j/j2ee/OC4J_DBConsole_oracle-node-2_dbname
      
  • Also, the following file must be updated to include the new hostname.

    $ORACLE_HOME/network/admin/tnsnames.ora
    
    • Before Example:

      (HOST = oracle-node-1)
      
    • After Example:

      (HOST = oracle-node-2)
      
  • Reconfigure the DBConsole Repository:

    [ossadmin@oracle-node-2 ]$ cd $ORACLE_HOME/bin
    [ossadmin@oracle-node-2 bin]$ ./emca -deconfig dbcontrol db -repos drop
    
    STARTED EMCA at May 11, 2010 5:08:10 PM
    EM Configuration Assistant, Version 11.1.0.7.0 Production
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    Enter the following information:
    Database SID: dbaccounting
    Listener port number: 1521
    Password for SYSMAN user:
    Do you wish to continue? [yes(Y)/no(N)]: Y
    May 11, 2010 5:08:42 PM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at /OSS/ORA/oracle/cfgtoollogs/emca/orcl/emca_2010_05_11_17_08_10.log.
    May 11, 2010 5:08:42 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
    WARNING: EM is not configured for this database. No EM-specific actions can be performed.
    May 11, 2010 5:08:42 PM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Dropping the EM repository (this may take a while) ...
    May 11, 2010 5:10:13 PM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Repository successfully dropped
    Enterprise Manager configuration completed successfully
    FINISHED EMCA at May 11, 2010 5:10:13 PM
    
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    
    [ossadmin@oracle-node-2 bin]$ ./emca -config dbcontrol db -repos create
    
    
    STARTED EMCA at May 11, 2010 5:11:40 PM
    EM Configuration Assistant, Version 11.1.0.7.0 Production
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    
    Enter the following information:
    Database SID: dbaccounting
    Listener port number: 1521
    Password for SYSMAN user: Email address for notifications (optional):
    Outgoing Mail (SMTP) server for notifications (optional):
    
    You have specified the following settings
    
    Database ORACLE_HOME ................ /OSS/ORA/oracle/product/11.1.0/db_1
    
    Local hostname ................ oracle-node-2.transnexus.com
    Listener port number ................ 1521
    Database SID ................ dbaccounting
    Email address for notifications ...............
    Outgoing Mail (SMTP) server for notifications ...............
    
    Do you wish to continue? [yes(Y)/no(N)]: Y
    May 11, 2010 5:12:15 PM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at /OSS/ORA/oracle/cfgtoollogs/emca/orcl/emca_2010_05_11_17_11_40.log.
    May 11, 2010 5:12:16 PM oracle.sysman.emcp.EMReposConfig createRepository
    INFO: Creating the EM repository (this may take a while) ...
    May 11, 2010 5:16:26 PM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Repository successfully created
    May 11, 2010 5:16:28 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
    INFO: Uploading configuration data to EM repository (this may take a while) ...
    May 11, 2010 5:17:09 PM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Uploaded configuration data successfully
    May 11, 2010 5:17:10 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
    INFO: Software library configured successfully.
    May 11, 2010 5:17:10 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
    INFO: Deploying Provisioning archives ...
    May 11, 2010 5:17:17 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
    INFO: Provisioning archives deployed successfully.
    May 11, 2010 5:17:17 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Securing Database Control (this may take a while) ...
    May 11, 2010 5:17:36 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Database Control secured successfully.
    May 11, 2010 5:17:36 PM oracle.sysman.emcp.util.DBControlUtil startOMS
    INFO: Starting Database Control (this may take a while) ...
    May 11, 2010 5:17:58 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
    INFO: Database Control started successfully
    May 11, 2010 5:17:58 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
    INFO: >>>>>>>>>>> The Database Control URL is https://oracle-node-2.transnexus.com:1158/em <<<<<<<<<<<
    May 11, 2010 5:18:00 PM oracle.sysman.emcp.EMDBPostConfig invoke
    
    WARNING:
    ************************ WARNING ************************
    Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted. The encryption key has been placed in the file: /OSS/ORA/oracle/product/11.1.0/db_1/oracle-node-2.transnexus.com_dbaccounting/sysman/config/emkey.ora. Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.
    ***********************************************************/h7>
    
    Enterprise Manager configuration completed successfully
    FINISHED EMCA at May 11, 2010 5:18:00 PM
    
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    
    [root@oracle-node-2 bin]# /etc/init.d/dbora stop
    Oracle Enterprise Manager 11g Database Control Release 11.1.0.7.0
    Copyright (c) 1996, 2008 Oracle Corporation. All rights reserved.
    https://oracle-node-2.transnexus.com:1158/em/console/aboutApplication
    Stopping Oracle Enterprise Manager 11g Database Control ...
    ... Stopped.
    Processing Database instance "dbaccounting": log file /OSS/ORA/oracle/product/11.1.0/db_1/shutdown.log
    
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    
    [root@oracle-node-2 bin]#
    [root@oracle-node-2 bin]# /etc/init.d/dbora start
    Processing Database instance "dbaccounting": log file /OSS/ORA/oracle/product/11.1.0/db_1/startup.log
    Oracle Enterprise Manager 11g Database Control Release 11.1.0.7.0
    Copyright (c) 1996, 2008 Oracle Corporation. All rights reserved.
    https://oracle-node-2.transnexus.com:1158/em/console/aboutApplication
    Starting Oracle Enterprise Manager 11g Database Control ............. started.
    
    Logs are generated in directory /OSS/ORA/oracle/product/11.1.0/db_1/oracle-node-2.transnexus.com_dbaccounting/sysman/log