When using Oracle, we can use the EM (Enterprise Manager) provided by Oracle to manage our databases more conveniently. However, sometimes our em cannot be connected. There are many reasons for this problem, such as incorrect hostname configuration or operating system firewall problems. If a problem occurs, can we quickly reconstruct em? The answer is yes. We can refer to the official Oracle document. However, if so many configuration commands and options in em are too large, you can refer to this document to recreate EM.
First, you must set the environment variable ORACLE_HOSTNAME.
export ORACLE_HOSTNAME=testbox.localdomain
Then execute:
emca -config dbcontrol db -repos recreate
If this method does not work, you can manually drop your current repo first.
emca -deconfig dbcontrol db -repos drop
And then recreate
emca -config dbcontrol db -repos create
This process takes about 10 minutes to create. Then you can see the following prompt:
[oracle@testbox j2ee]$ emca -config dbcontrol db -repos createSTARTED EMCA at Jul 1, 2014 10:50:24 PMEM Configuration Assistant, Version 11.2.0.3.0 ProductionCopyright (c) 2003, 2011, Oracle. All rights reserved.Enter the following information:Database SID: erinListener ORACLE_HOME [ /u01/app/oracle/product/11.2.0/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 settingsDatabase ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1Local hostname ................ testbox.localdomainListener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1Listener port number ................ 1521Database SID ................ erinEmail address for notifications ............... Outgoing Mail (SMTP) server for notifications ............... -----------------------------------------------------------------Do you wish to continue? [yes(Y)/no(N)]: yesJul 1, 2014 10:50:43 PM oracle.sysman.emcp.EMConfig performINFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/erin/emca_2014_07_01_22_50_24.log.Jul 1, 2014 10:50:44 PM oracle.sysman.emcp.EMReposConfig createRepositoryINFO: Creating the EM repository (this may take a while) ...Jul 1, 2014 10:55:39 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Repository successfully createdJul 1, 2014 10:55:42 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepositoryINFO: Uploading configuration data to EM repository (this may take a while) ...Jul 1, 2014 10:57:43 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Uploaded configuration data successfullyJul 1, 2014 10:57:45 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsoleINFO: Securing Database Control (this may take a while) ...Jul 1, 2014 10:58:17 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsoleINFO: Database Control secured successfully.Jul 1, 2014 10:58:17 PM oracle.sysman.emcp.util.DBControlUtil startOMSINFO: Starting Database Control (this may take a while) ...Jul 1, 2014 10:58:44 PM oracle.sysman.emcp.EMDBPostConfig performConfigurationINFO: Database Control started successfullyJul 1, 2014 10:58:44 PM oracle.sysman.emcp.EMDBPostConfig performConfigurationINFO: >>>>>>>>>>> The Database Control URL is https://testbox.localdomain:5500/em <<<<<<<<<<<Jul 1, 2014 10:58:48 PM oracle.sysman.emcp.EMDBPostConfig invokeWARNING: ************************ 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/db_1/testbox.localdomain_erin/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 successfullyFINISHED EMCA at Jul 1, 2014 10:58:48 PM
The red part of the annotation is the access address of our em.