Oracle 10.2.0.4和10.2.0.5中 OEM bug 8350262
测试服务器上,启动emctl start dbconsole的时候,报如下错误:
[oracle@test ~]$ emctl start dbconsole
OC4J Configuration issue. /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_test_orclnot found.
查看错误日志,如下:
…………………………………………………
………………………………………………
Oracle Enterprise Manager 10g Database Control Release10.2.0.5.0
Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.
https://test4:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control...........................................................................................failed.
------------------------------------------------------------------
Logs are generated in directory/oracle/oracle/product/10.2.0/db_1/test4_test4/sysman/log
Nov 15, 2013 9:50:47 AMoracle.sysman.emcp.util.PlatformInterface executeCommand
WARNING: Error executing /oracle/oracle/product/10.2.0/db_1/bin/emctlstart dbconsole
Nov 15, 2013 9:50:47 AM oracle.sysman.emcp.EMConfigperform
SEVERE: Error starting Database Control
Refer to the log file at/oracle/oracle/product/10.2.0/db_1/cfgtoollogs/emca/test4/emca_2013-11-15_093-12-AM.logfor more details.
Nov 15, 2013 9:50:47 AM oracle.sysman.emcp.EMConfigperform
CONFIG: Stack Trace:
oracle.sysman.emcp.exception.EMConfigException: Errorstarting Database Control
atoracle.sysman.emcp.EMDBPostConfig.performConfiguration(EMDBPostConfig.java:649)
atoracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:227)
atoracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:196)
atoracle.sysman.emcp.EMConfig.perform(EMConfig.java:184)
atoracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:494)
atoracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1161)
atoracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:478)
atoracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:426)
安装Oracle10.2.0.4 和10.2.0.5 版本时,在配置OEM的时候会报错。 忽略这个错误后,DB 可以成功创建或者升级,这个是Oracle10.2.0.4和10.2.0.5中 OEM bug,我们需要下载8350262这个补丁包安装。 软件包下载地址:http://yunpan.cn/Q9i7UrCtwjvmR
下面我们开始尝试解决:
下载p8350262_10204_Generic补丁包,上传补丁包解压到你指定的目录,此处为/oracle下,解压得到8350262的目录,关闭数据库和监听,切换到oracle用户下,检查ORACLE_HOMEand ORACLE_SID环境变量时候设置正确,在该目录下执行./killDBConsole命令。
[oracle@test4 8350262]$ ./killDBConsole
ORACLE_HOME=/oracle/oracle/product/10.2.0/db_1
ORACLE_SID=test4
State directory = /oracle/oracle/product/10.2.0/db_1/test4_test4
WatchDog PID = 14296
DBconsole PID = 25885
EMAgent PID = 16295
Killing WatchDog (pid=14296) ...
Successfully killed process 14296
Killing DBConsole (pid=25885) ...
Successfully killed process 25885
Killing EMAgent (pid=16295) ...
Successfully killed process 16295
安装补丁:
[oracle@test4 8350262]$ORACLE_HOME/OPatch/opatch apply
Invoking OPatch 10.2.0.4.9
Copyright (c) 2009, Oracle Corporation. All rights reserved.
Oracle Home : /oracle/product/db10gr2
Central Inventory : /oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.9
OUI version : 10.2.0.5.0
OUI location : /oracle/product/db10gr2/oui
Log file location : /oracle/product/db10gr2/cfgtoollogs/opatch/opatch2012-01-07_14-42-26PM.log
Backing up files affected by the patch '8350262' for restore. This might take a while...
Backing up files affected by the patch '8350262' for rollback. This might take a while...
Updating jar file "/oracle/product/db10gr2/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class"
Updating jar file "/oracle/product/db10gr2/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class"
Updating jar file "/oracle/product/db10gr2/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/RootCert.class"
Updating jar file "/oracle/product/db10gr2/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/SecConstants.class"
Updating jar file "/oracle/product/db10gr2/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class"
Updating jar file "/oracle/product/db10gr2/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class"
Updating jar file "/oracle/product/db10gr2/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/util/RootCert.class"
Updating jar file "/oracle/product/db10gr2/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/util/SecConstants.class"
ApplySession adding interim patch '8350262' to inventory
Inventory check OK: Patch ID 8350262 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 8350262 are present in Oracle Home.
检查补丁安装情况
[oracle@test4 8350262]$ORACLE_HOME/OPatch/opatch lsinventory
Invoking OPatch 10.2.0.4.9
Copyright (c) 2009, Oracle Corporation. All rights reserved.
Oracle Home : /oracle/product/db10gr2
Central Inventory : /oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.9
OUI version : 10.2.0.5.0
OUI location : /oracle/product/db10gr2/oui
Log file location : /oracle/product/db10gr2/cfgtoollogs/opatch/opatch2012-01-07_14-43-27PM.log
Installed Top-level Products (2):
Oracle Database 10g Release 2 Patch Set 4 10.2.0.5.0
There are 2 products installed in this Oracle Home.
Interim patches (2) :
Unique Patch ID: 13011832
Created on 13 Sep 2010, 14:09:12 hrs GMT
Bugs fixed:
8350262
Unique Patch ID: 12780900
Created on 22 Jul 2010, 03:58:28 hrs PST8PDT
Bugs fixed:
7612454
OK,接着重置dbconsole 尝试启动dbconsole
[oracle@test4 8350262]$ emctl securedbconsole -reset
TZ set to PRC
Oracle Enterprise Manager 10g DatabaseControl Release 10.2.0.5.0
Copyright (c) 1996, 2010 OracleCorporation. All rights reserved.
https://test4:5500/em/console/aboutApplication
Enter Enterprise Manager RootPassword :
(这里oracle提示输入Enterprise Manager Root用户的密码,其实就是输入sysman的密码)
DBCONSOLE already stopped... Done.
Agent is already stopped... Done.
Securing dbconsole... Started.
Checking Repository...ERROR. Unable tocontact the OMS Repository.
[oracle@test4 8350262]$ emctl securedbconsole -reset
TZ set to PRC
Oracle Enterprise Manager 10g DatabaseControl Release 10.2.0.5.0
Copyright (c) 1996, 2010 OracleCorporation. All rights reserved.
https://test4:5500/em/console/aboutApplication
Enter Enterprise Manager Root Password :
DBCONSOLE already stopped... Done.
Agent is already stopped... Done.
Securing dbconsole... Started.
Checking Repository...ERROR. Unable tocontact the OMS Repository.
[oracle@test4 8350262]$ emctl securedbconsole
TZ set to PRC
Oracle Enterprise Manager 10g DatabaseControl Release 10.2.0.5.0
Copyright (c) 1996, 2010 OracleCorporation. All rights reserved.
https://test4:5500/em/console/aboutApplication
Enter Enterprise Manager Root password :
Enter a Hostname for this OMS : test4
DBCONSOLE already stopped... Done.
Agent is already stopped... Done.
Securing dbconsole... Started.
Checking Repository...ERROR. Unable tocontact the OMS Repository.
[oracle@test4 8350262]$ emctl start dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g DatabaseControl Release 10.2.0.5.0
Copyright (c) 1996, 2010 OracleCorporation. All rights reserved.
https://test4:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 10gDatabase Control...........................................................................................failed.
------------------------------------------------------------------
Logs are generated in directory/oracle/oracle/product/10.2.0/db_1/test4_test4/sysman/log
启动失败,重置的方法行不通,或者时没有完全解决问题,接着我们采取下面的方法:
打开数据库。Startup
1.[oracle@test4 8350262]$ emca -repos drop删除EM资料库
STARTED EMCA at Nov 15, 2013 10:52:31 AM
EM Configuration Assistant, Version10.2.0.5.0 Production
Copyright (c) 2003, 2009, Oracle. All rights reserved.
Enter the following information:
Database SID: test4
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
----------------------------------------------------------------------
WARNING : While repository is dropped thedatabase will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Nov 15, 2013 10:52:39 AMoracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at/oracle/oracle/product/10.2.0/db_1/cfgtoollogs/emca/test4/emc2013-11-15_10-52-31-AM.log.
Nov 15, 2013 10:52:40 AMoracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this maytake a while) ...
Nov 15, 2013 10:52:40 AMoracle.sysman.emcp.EMReposConfig dropRepository
INFO: Dropping the EM repository (this maytake a while) ...
Nov 15, 2013 10:53:50 AMoracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completedsuccessfully
FINISHED EMCA at Nov 15, 2013 10:53:50 AM
2.[oracle@test4 8350262]$ emca -reposrecreate 重建EM资料库
STARTED EMCA at Nov 15, 2013 10:54:33 AM
EM Configuration Assistant, Version10.2.0.5.0 Production
Copyright (c) 2003, 2009, Oracle. All rights reserved.
Enter the following information:
Database SID: test4
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
----------------------------------------------------------------------
WARNING : While repository is dropped thedatabase will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Nov 15, 2013 10:54:42 AMoracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at/oracle/oracle/product/10.2.0/db_1/cfgtoollogs/emca/test4/emc2013-11-15_10-54-33-AM.log.
Nov 15, 2013 10:54:43 AMoracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this maytake a while) ...
Nov 15, 2013 10:54:43 AMoracle.sysman.emcp.EMReposConfig dropRepository
INFO: Dropping the EM repository (this maytake a while) ...
Nov 15, 2013 10:54:46 AMoracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Nov 15, 2013 10:54:46 AMoracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this maytake a while) ...
Nov 15, 2013 10:56:51 AMoracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Enterprise Manager configuration completedsuccessfully
FINISHED EMCA at Nov 15, 2013 10:56:52 AM
3.[oracle@test4 8350262]$ emca -configdbcontrol db 配置数据库的 Database Control
STARTED EMCA at Nov 15, 2013 10:57:38 AM
EM Configuration Assistant, Version10.2.0.5.0 Production
Copyright (c) 2003, 2009, Oracle. All rights reserved.
Enter the following information:
Database SID: test4
Database Control is already configured forthe database test4
You have chosen to configure Database Controlfor managing the database test4
This will remove the existing configurationand the default settings and perform a fresh configuratio
Do you wish to continue? [yes(Y)/no(N)]: y
Listener port number: 1521
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 ................/oracle/oracle/product/10.2.0/db_1
Local hostname ................ test4
Listener port number ................ 1521
Database SID ................ test4
Email address for notifications...............
Outgoing Mail (SMTP) server for notifications...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Nov 15, 2013 10:58:00 AM oracle.sysman.emcp.EMConfigperform
INFO: This operation is being logged at/oracle/oracle/product/10.2.0/db_1/cfgtoollogs/emca/test4/emc2013-11-15_10-57-38-AM.log.
Nov 15, 2013 10:58:01 AMoracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this maytake a while) ...
Nov 15, 2013 10:58:05 AMoracle.sysman.emcp.util.PlatformInterface executeCommand
WARNING: Error executing/oracle/oracle/product/10.2.0/db_1/bin/emctl stop dbconsole
Nov 15, 2013 10:58:08 AMoracle.sysman.emcp.EMConfig perform
SEVERE: Cannot start DatabaseControl. The following ports are already in use: [Database Control HTTPort:5500EM agent port:1830 RMI port for Database Control:5521].
Refer to the log file at/oracle/oracle/product/10.2.0/db_1/cfgtoollogs/emca/test4/emca_2013-11-15_107-38-AM.logfor more details.
Could not complete the configuration. Referto the log file at/oracle/oracle/product/10.2.0/db_1/cfgollogs/emca/test4/emca_2013-11-15_10-57-38-AM.logfor more details.
OK,提示emctl启动失败,部分端口被占用,下面我们重置端口:
4.[oracle@test4 8350262]$ emca -reconfigports 重置端口
STARTED EMCA at Nov 15, 2013 11:02:34 AM
EM Configuration Assistant, Version10.2.0.5.0 Production
Copyright (c) 2003, 2009, Oracle. All rights reserved.
Enter the following information:
Database SID: test4
Do you wish to continue? [yes(Y)/no(N)]: y
Nov 15, 2013 11:02:39 AMoracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at/oracle/oracle/product/10.2.0/db_1/cfgtoollogs/emca/test4/emca_2013-11-15_11-02-34-AM.log.
Nov 15, 2013 11:02:39 AM oracle.sysman.emcp.util.GeneralUtilinitSQLEngine
WARNING: ORA-01017: invalidusername/password; logon denied
Nov 15, 2013 11:02:39 AMoracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
WARNING: Error initializing SQL connection.SQL operations cannot be performed
Nov 15, 2013 11:02:39 AMoracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this maytake a while) ...
Nov 15, 2013 11:02:42 AMoracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this maytake a while) ...
Nov 15, 2013 11:04:22 AMoracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO:>>>>>>>>>>> The Database Control URL ishttp://test4:5501/em <<<<<<<<<<<
Enterprise Manager configuration completedsuccessfully
FINISHED EMCA at Nov 15, 2013 11:04:22 AM
OK,成功,我们关闭并重启dbconsole
5.[oracle@test4 8350262]$ emctl stopdbconsole 关闭dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g DatabaseControl Release 10.2.0.5.0
Copyright (c) 1996, 2010 OracleCorporation. All rights reserved.
http://test4:5501/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10gDatabase Control ...
... Stopped.
6.[oracle@test4 8350262]$ emctl startdbconsole 打开dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g DatabaseControl Release 10.2.0.5.0
Copyright (c) 1996, 2010 OracleCorporation. All rights reserved.
http://test4:5501/em/console/aboutApplication
Starting Oracle Enterprise Manager 10gDatabase Control ............................ started.
------------------------------------------------------------------
Logs are generated in directory/oracle/oracle/product/10.2.0/db_1/test4_test4/sysman/log
7.[oracle@test4 8350262]$ emctl statusdbconsole 查看dbconsole状态
TZ set to PRC
Oracle Enterprise Manager 10g DatabaseControl Release 10.2.0.5.0
Copyright (c) 1996, 2010 OracleCorporation. All rights reserved.
http://test4:5501/em/console/aboutApplication
Oracle Enterprise Manager 10g is running.
------------------------------------------------------------------
Logs are generated in directory/oracle/oracle/product/10.2.0/db_1/test4_test4/sysman/log
至此,EM修复成功。
常用的命令语法:
emca -repos create创建一个EM资料库
emca -repos recreate重建一个EM资料库
emca -repos drop删除一个EM资料库
emca -config dbcontrol db配置数据库的 Database Control
emca -deconfig dbcontrol db删除数据库的 Database Control配置
emca -reconfig ports 重新配置db control和agent的端口
emctl start console启动EM console服务,使用前需要先设置ORACLE_SID环境变量
emctl stop console停止EM console服务,使用前需要先设置ORACLE_SID环境变量
注:通过查看$ORACLE_HOME/install/portlist.ini 文件可以知道当前dbcontrol正在使用的端口,默认dbcontrol http端口1158,agent端口3938。如果要重新配置端口,可以使用如下命令:
emca -reconfig ports -dbcontrol_http_port 1159
emca -reconfig ports -agent_port 3939
停掉dabase control;配置EMKEY;保护database control;保护EMKEY.
emctl stop dbconsole
emctl config emkey -repos -sysman_pwd <sysman用户密码>
emctl secure dbconsole -sysman_pwd <sysman用户密码>
emctl config emkey -remove_from_repos -sysman_pwd<sysman用户密码>
emkey是保护database control的必需,其含义如下:
The emkey is an encryption key that is used to encryptand decrypt sensitive data in Enterprise Manager such as host passwords,database passwords and others. By default, the emkey is stored in the$ORACLE_HOME/sysman/config/emkey.ora file. The location of this file can bechanged.
During startup, the Oracle Management Service checksthe status of the emkey. If the emkey has been properly configured, it uses itencrypting and decrypting data.
The emkey is a random number that is generated duringthe installation of the Oracle Management Repository and is stored in a table.When the Oracle Management Service is installed, the emkey is copied from theManagement Repository to the emkey.ora file and stored in theORACLE_HOME/sysman/config/ directory of each Oracle Management Service.
After the emkey has been copied, you must remove itfrom the Management Repository as it is not considered secure.
If it is not removed, data such as database passwords,server passwords and other sensitive information can be easily decrypted.
To remove the emkey from the Management Repository,enter the following command