I just got a client that changed his server hostname and discovered that after this change he was unable to use the DB Control. To solve this problem you will just need to follow these simple steps:
1) Set $ORACLE_HOSTNAME to the old hostname:
[oracle]$ export ORACLE_HOSTNAME=oc-oracle-prod.com
2) De-configure the old DB Console by running the following command:
[oracle]$ $ORACLE_HOME/bin/emca-deconfig dbcontrol db STARTED EMCA at Jul 20, 2012 10:27:25 AM EM Configuration Assistant, Version 11.2.0.3.0 Production Copyright (c) 2003, 2011, Oracle. All rights reserved. Enter the following information: Database SID: COLD Do you wish to continue? [yes(Y)/no(N)]: Y log4j:WARN No appenders could be found for logger (emSDK.config). log4j:WARN Please initialize the log4j system properly. Jul 20, 2012 10:27:38 AM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/COLD/emca_2012_07_20_10_27_24.log. Jul 20, 2012 10:27:38 AM oracle.sysman.emcp.util.DBControlUtil stopOMS INFO: Stopping Database Control (this may take a while) ... Enterprise Manager configuration completed successfully FINISHED EMCA at Jul 20, 2012 10:27:53 AM [oracle]$
3) Un-set
$ORACLE_HOSTNAME in the environment, in other words, set $ORACLE_HOSTNAME to the new hostname:
[oracle]$ export ORACLE_HOSTNAME=oracle-prod.com
4) Configure the new DB Console:
[oracle]$ $ORACLE_HOME/bin/emca -config dbcontrol db -repos recreate STARTED EMCA at Jul 20, 2012 10:28:49 AM EM Configuration Assistant, Version 11.2.0.3.0 Production Copyright (c) 2003, 2011, Oracle. All rights reserved. Enter the following information: Database SID: COLD Listener port number: 1521 Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0.3/db_1 ]: Password for SYS user: Password for DBSNMP user: 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 ................ /u01/app/oracle/product/11.2.0.3/db_1 Local hostname ................ col-oracle-prod.lakros.com Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0.3/db_1 Listener port number ................ 1521 Database SID ................ COLD Email address for notifications ............... Outgoing Mail (SMTP) server for notifications ............... ----------------------------------------------------------------- ---------------------------------------------------------------------- WARNING : While repository is dropped the database will be put in quiesce mode. ---------------------------------------------------------------------- Do you wish to continue? [yes(Y)/no(N)]: Y Jul 20, 2012 10:29:34 AM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/COLDFX/emca_2012_07_20_10_28_49.log. Jul 20, 2012 10:29:35 AM oracle.sysman.emcp.EMReposConfig invoke INFO: Dropping the EM repository (this may take a while) ... Jul 20, 2012 10:31:10 AM oracle.sysman.emcp.EMReposConfig invoke INFO: Repository successfully dropped Jul 20, 2012 10:31:11 AM oracle.sysman.emcp.EMReposConfig createRepository INFO: Creating the EM repository (this may take a while) ... Jul 20, 2012 10:37:48 AM oracle.sysman.emcp.EMReposConfig invoke INFO: Repository successfully created Jul 20, 2012 10:37:52 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository INFO: Uploading configuration data to EM repository (this may take a while) ... Jul 20, 2012 10:39:32 AM oracle.sysman.emcp.EMReposConfig invoke INFO: Uploaded configuration data successfully Jul 20, 2012 10:39:37 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole INFO: Securing Database Control (this may take a while) ... Jul 20, 2012 10:40:03 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole INFO: Database Control secured successfully. Jul 20, 2012 10:40:03 AM oracle.sysman.emcp.util.DBControlUtil startOMS INFO: Starting Database Control (this may take a while) ... Jul 20, 2012 10:40:32 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: Database Control started successfully Jul 20, 2012 10:40:32 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: >>>>>>>>>>> The Database Control URL is https://col-oracle-prod.lakros.com:5500/em <<<<<<<<<<< Jul 20, 2012 10:40:36 AM 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: /u01/app/oracle/product/11.2.0.3/db_1/oracle-prod.com_COLD/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost. *********************************************************** Enterprise Manager configuration completed successfully FINISHED EMCA at Jul 20, 2012 10:40:36 AM [oracle@col-oracle-prod bin]$
Now after this last step is completed, your DB Console is ready to be used again 🙂
If using Oracle RAC you need to replace the step s 2 and 4 for:
[oracle]$ $ORACLE_HOME/bin/emca -deconfig dbcontrol db -cluster [oracle]$ $ORACLE_HOME/bin/emca -config dbcontrol db -repos recreate -cluster
Cheers,
Francisco Munoz Alvarez