1 解決2011年及之後EM無法啓動問題
最近在搭一個linux虛擬機環境學習oracle,在進行手工建庫後創建EM時報錯了,EM無法啓動。在今年的一個項目的RAC環境中好像也是EM無法啓動,但實際可以登錄進行訪問,但一直沒想到是什麼原因。記得去年也是用同樣的方法創建的數據庫,EM好像就可以正常使用。於是上網查了一下,發現居然是oracle的一個BUG,遇到了OEM bug 8350262,需要打補丁進行解決。
原因爲The Root Certificate Authority (CA) expired on 31-DEC-2010 00:00:0 root授權信息過期導致。
參考:http://blog.csdn.net/tianlesoftware/article/details/6568690
http://blog.csdn.net/makaveli/article/details/6135514
解決該問題步驟
如果是在創建實例之前就把該patch給打上了,那麼在創建OEM的時候不會受影響。
如果是已經報錯了,解決步驟如下:
For Single Instance:
1. 使用Opatch 安裝Patch 8350262
2. force stop the Database Control (dbconsole) process using the killDBConsole script bundled with the patch. Note that the dbconsole process cannot be stopped using the emctl stop dbconsole command, as EMCTL is unable to connect to the process.
(1)Set the ORACLE_HOME and ORACLE_SID environment variables.
(2)Execute <PATCH_HOME>/killDBConsole.
--windows 平臺省略這一步
3. Re-secure Database Control with the following command:
<ORACLE_HOME>/bin/emctl secure dbconsole -reset
4. Re-start Database Control with the following command:
<ORACLE_HOME>/bin/emctl start dbconsole
For RAC Instance:
1. 使用Opatch 安裝Patch 8350262, 在一個節點安裝就ok了。
2. force stop the Database Control (dbconsole) process by executing the killDBConsole script bundled with the patch on each node in the cluster
在所有節點執行
(1)Set the ORACLE_HOME and ORACLE_SID environment variables.
(2)Execute <PATCH_HOME>/killDBConsole.
--windows 平臺省略這一步
3. Re-secure Database Control on the first cluster node with the following command:
<ORACLE_HOME>/bin/emctl secure dbconsole -reset
4. Re-secure Database Control on the remaining cluster nodes with the following command. Note that the -reset switch is not included with this command:
<ORACLE_HOME>/bin/emctl secure dbconsole
5. Re-start Database Control by executing the following command on each node in the cluster:
<ORACLE_HOME>/bin/emctl start dbconsole
1.1 下載補丁並打補丁
[root@OracleDb ~]# mkdir /opatch
用FTP工具將補丁上傳到/opatch目錄
[root@OracleDb ~]# ls -l /opatch
total 40
-rw-r----- 1 root root 40488 Nov 15 09:09 p8350262_10204_Generic.zip
[root@OracleDb ~]# chown -R oracle:oinstall /opatch
[root@OracleDb ~]# cd /opatch
[root@OracleDb opatch]# unzip p8350262_10204_Generic.zip
Archive: p8350262_10204_Generic.zip
creating: 8350262/
inflating: 8350262/killDBConsole
creating: 8350262/files/
creating: 8350262/files/sysman/
creating: 8350262/files/sysman/jlib/
creating: 8350262/files/sysman/jlib/emCORE.jar/
creating: 8350262/files/sysman/jlib/emCORE.jar/oracle/
creating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/
creating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/
creating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/
creating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/fsc/
inflating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class
creating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/
inflating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/RootCert.class
inflating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/SecConstants.class
creating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/rep/
inflating: 8350262/files/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class
creating: 8350262/files/sysman/jlib/emd_java.jar/
creating: 8350262/files/sysman/jlib/emd_java.jar/oracle/
creating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/
creating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/
creating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/
creating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/fsc/
inflating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class
creating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/util/
inflating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/util/RootCert.class
inflating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/util/SecConstants.class
creating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/rep/
inflating: 8350262/files/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class
inflating: 8350262/killDBConsole.pl
inflating: 8350262/README.txt
creating: 8350262/etc/
creating: 8350262/etc/xml/
inflating: 8350262/etc/xml/ShiphomeDirectoryStructure.xml
inflating: 8350262/etc/xml/GenericActions.xml
creating: 8350262/etc/config/
inflating: 8350262/etc/config/inventory
inflating: 8350262/etc/config/actions
[root@OracleDb opatch]# ls
8350262 p8350262_10204_Generic.zip
[oracle@OracleDb ~]$ cd /opatch
[oracle@OracleDb opatch]$ ls
8350262 p8350262_10204_Generic.zip
[oracle@OracleDb opatch]$ cd 8350262
[oracle@OracleDb 8350262]$ ls
etc files killDBConsole killDBConsole.pl README.txt
打補丁
[oracle@OracleDb 8350262]$ $ORACLE_HOME/OPatch/opatch apply
Invoking OPatch 10.2.0.4.2
Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation. All rights reserved.
Oracle Home : /oracle/product/10.2.0/db_1
Central Inventory : /oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.2
OUI version : 10.2.0.4.0
OUI location : /oracle/product/10.2.0/db_1/oui
Log file location : /oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2011-11-15_09-46-37AM.log
ApplySession applying interim patch '8350262' to OH '/oracle/product/10.2.0/db_1'
Running prerequisite checks...
OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.
Backing up files and inventory (not for auto-rollback) for the Oracle Home
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...
Patching component oracle.sysman.agent.core, 10.2.0.4.0a...
Updating jar file "/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class"
Updating jar file "/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class"
Updating jar file "/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/RootCert.class"
Updating jar file "/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/SecConstants.class"
Updating jar file "/oracle/product/10.2.0/db_1/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class"
Updating jar file "/oracle/product/10.2.0/db_1/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class"
Updating jar file "/oracle/product/10.2.0/db_1/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_java.jar/oracle/sysman/eml/sec/util/RootCert.class"
Updating jar file "/oracle/product/10.2.0/db_1/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
Verifying the update...
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.
OPatch succeeded.
檢查補丁
[oracle@OracleDb 8350262]$ $ORACLE_HOME/OPatch/opatch lsinventory –detail –oh $ORACLE_HOME
Invoking OPatch 10.2.0.4.2
Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation. All rights reserved.
Oracle Home : /oracle/product/10.2.0/db_1
Central Inventory : /oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.2
OUI version : 10.2.0.4.0
OUI location : /oracle/product/10.2.0/db_1/oui
Log file location : /oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2011-11-15_15-04-57PM.log
Lsinventory Output file location : /oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2011-11-15_15-04-57PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 3 10.2.0.4.0
There are 2 products installed in this Oracle Home.
Interim patches (1) :
Patch 8350262 : applied on Tue Nov 15 09:48:19 CST 2011
Created on 14 Sep 2010, 04:59:44 hrs PST8PDT
Bugs fixed:
8350262
--------------------------------------------------------------------------------
OPatch succeeded.
1.2 停止DBCONSOLE
按照步驟做下去沒有成功,不知道什麼原因,沒仔細去研究,想到了重建EM,結果重建EM成功了。
以前有碰到過用emctl stop dbconsole無法停止EM的情況,剛好上面的補丁中帶了一個殺EM進程的程序,所以直接使用
[root@OracleDb ~]# su - oracle
[oracle@OracleDb ~]$ cd /opatch
[oracle@OracleDb opatch]$ ls
8350262 p8350262_10204_Generic.zip
[oracle@OracleDb opatch]$ cd 8350262
[oracle@OracleDb 8350262]$ ls
etc files killDBConsole killDBConsole.pl README.txt
[oracle@OracleDb 8350262]$ ./killDBConsole
ORACLE_HOME=/oracle/product/10.2.0/db_1
ORACLE_SID=afc
State directory = /oracle/product/10.2.0/db_1/OracleDb_afc
WatchDog PID = 7831
DBconsole PID = 7856
EMAgent PID = 8930
Killing WatchDog (pid=7831) ...
Successfully killed process 7831
Killing DBConsole (pid=7856) ...
Successfully killed process 7856
Killing EMAgent (pid=8930) ...
Successfully killed process 8930
1.3 刪除數據庫的 Database Control設置
[oracle@OracleDb 8350262]$ emca -deconfig dbcontrol db -repos drop
STARTED EMCA at Nov 15, 2011 1:54:31 PM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: afc
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: y
Nov 15, 2011 1:54:45 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/product/10.2.0/db_1/cfgtoollogs/emca/afc/emca_2011-11-15_01-54-30-PM.log.
Nov 15, 2011 1:54:48 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Nov 15, 2011 1:55:16 PM oracle.sysman.emcp.EMReposConfig dropRepository
INFO: Dropping the EM repository (this may take a while) ...
Nov 15, 2011 1:58:01 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Nov 15, 2011 1:58:02 PM
1.4 刪除早期DBCONSOLE創建的用戶和對象
sql>drop role MGMT_USER;
sql>drop user MGMT_VIEW cascade;
sql>drop user sysman cascade;
sql>drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;
sql>drop PUBLIC SYNONYM SETEMVIEWUSERCONTEXT;
1.5 重新創建DBCONSOLE
[oracle@OracleDb 8350262]$ emca -config dbcontrol db -repos create
STARTED EMCA at Nov 15, 2011 2:01:05 PM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: afc
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/product/10.2.0/db_1
Database hostname ................ OracleDb
Listener port number ................ 1521
Database SID ................ afc
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Nov 15, 2011 2:02:21 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/product/10.2.0/db_1/cfgtoollogs/emca/afc/emca_2011-11-15_02-01-05-PM.log.
Nov 15, 2011 2:02:27 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Nov 15, 2011 2:07:13 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Nov 15, 2011 2:07:49 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Nov 15, 2011 2:10:37 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Nov 15, 2011 2:10:37 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Nov 15, 2011 2:12:52 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Nov 15, 2011 2:12:52 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://OracleDb:1158/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Nov 15, 2011 2:12:52 PM
[oracle@OracleDb 8350262]$ emctl status dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
https://OracleDb:1158/em/console/aboutApplication
Oracle Enterprise Manager 10g is running.
------------------------------------------------------------------
Logs are generated in directory /oracle/product/10.2.0/db_1/OracleDb_afc/sysman/log
[oracle@OracleDb 8350262]$