如何重新配置Oracle的EM Database Control

今天打算启用一下Oracle Database 11g的Database Control,但提示如下:

[oracle@test7: ~]$emctl status dbconsole
OC4J Configuration issue. /oracle/product/11.1.0/db_1/oc4j/j2ee/OC4J_DBConsole_test7_ccdb not found.

马上来看一下相应目录下,是否有OC4J_DBConsole_test7_ccdb呢?

[oracle@test7: ~/product/11.1.0/db_1/oc4j/j2ee]$ll -thd OC4J_DBConsole*
drwxr-x--- 10 oracle oinstall 4.0K Jun 30 11:41 OC4J_DBConsole_localhost.localdomain_ccdb
drwxr-xr-x  6 oracle oinstall 4.0K Jun 30 11:18 OC4J_DBConsole

没有OC4J_DBConsole_test7_ccdb,却有个OC4J_DBConsole_localhost.localdomain_ccdb目录。 test7和localhost.localdomain,不由得使我们想到“主机名”。看来是更改了“主机名”后,Database Control就启不来了。

问题找到,就好解决了。遇到这类问题,可以通过重新配置,来创建EM的配置文件:

[oracle@test7: ~]$emca -config dbcontrol db -repos recreate

STARTED EMCA at Oct 23, 2009 11:42:39 AM
EM Configuration Assistant, Version 11.1.0.5.0 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: ccdb
Listener port number: 1521
Password for SYS user: 
Password for DBSNMP user: 
Password for SYSMAN user: 
Password for SYSMAN user: Email address for notifications (optional): [email protected]
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /oracle/product/11.1.0/db_1

Local hostname ................ test7
Listener port number ................ 1521
Database SID ................ ccdb
Email address for notifications ............... [email protected]
Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Oct 23, 2009 11:46:38 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/cfgtoollogs/emca/ccdb/emca_2009_10_23_11_42_38.log.
Oct 23, 2009 11:46:40 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Oct 23, 2009 11:52:08 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Oct 23, 2009 11:52:09 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Oct 23, 2009 12:03:26 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Oct 23, 2009 12:03:38 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Oct 23, 2009 12:04:57 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Oct 23, 2009 12:05:01 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Oct 23, 2009 12:05:01 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Oct 23, 2009 12:05:15 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Oct 23, 2009 12:05:15 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Oct 23, 2009 12:05:27 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Oct 23, 2009 12:05:27 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Oct 23, 2009 12:06:45 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Oct 23, 2009 12:06:46 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://test7:5500/em <<<<<<<<<<<
Oct 23, 2009 12:06:51 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: /oracle/product/11.1.0/db_1/test7_ccdb/sysman/config/emkey.ora.   Please 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 Oct 23, 2009 12:06:51 PM

Oracle 10g中,配置方法与此相同。配置完成之后就可以启动EM了:

[oracle@test7: ~]$emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.1.0.6.0
Copyright (c) 1996, 2007 Oracle Corporation.  All rights reserved.
https://test7:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ....... started.
------------------------------------------------------------------
Logs are generated in directory /oracle/product/11.1.0/db_1/test7_ccdb/sysman/log

现在,就可以通过IE在远端连接OEM的Database Control了!

- The End -