一、Oracle OEM開啓失敗---環境變量ORACLE_UNQNAME未定義問題
登陸https://h1:1158/em 之後,看到數據庫實例都是關閉的.啓動不了 (1)查看dbconsole狀態:emctl status dbconsole 顯示:Environment variable ORACLE_UNQNAME not defined. Please define it. 解決方法: 在啓動的時候先設置一下oracle_unqname set oracle_unqname=$ORACLE_SID 如果還是失敗,在環境變量中添加: [oracle@h1 ~]$ vi ~/.bash_profile 在最後添加:export ORACLE_UNQNAME=$ORACLE_SID [oracle@h1 ~]$ source ./bash_profile 使環境變量生效 |
2.emctl start dbconsole
如果還出現上述的錯誤:刪除dbconsole重新配置
[oracle@h1 ~]$ emca -deconfig dbconsole db -repos drop STARTED EMCA at Mar 14, 2013 9:06:48 PM Enter the following information: Do you wish to continue? [yes(Y)/no(N)]: Y |
3.如果刪除失敗,則舊數據清除
[oracle@h1 ~]$ sqlplus "/as SYSDBA" SQL*Plus: Release 11.2.0.1.0 Production on Thu Mar 14 21:08:54 2013 Copyright (c) 1982, 2009, Oracle. All rights reserved.
#(1)進入數據庫刪除dbconsole以前的用戶,並且修改DBSNMP密碼 SQL> alter user dbsnmp identified by manager;
#(2)刪除早期DBCONSOLE創建的用戶: sql>drop role MGMT_USER; sql>drop user MGMT_VIEW cascade; sql>drop user sysman cascade;
#(3)刪除早期DBCONSOLE創建的對象: sql>drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS; sql>drop public synonym SETEMVIEWUSERCONTEXT;
|
4. 重新創建DBCONSOLE:(如果是在windows下,要先到註冊表刪除DBCONSOLE的服務,重啓電腦)
emca -config dbcontrol db -repos create
根據提示,先輸入SID,再輸入Y繼續;
輸入端口1521,輸入SYS密碼,輸入DBSNMP密碼,輸入SYSMAN 密碼,輸入Y繼續
完成。
5.emca 命令的日誌在
/app/oracle/cfgtoollogs/emca/ORCL/
日誌有兩個,一個是概況,一個是明細
6.OEM開啓
[oracle@h1 ~]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://h1:5501/em/console/aboutApplication
- An instance of Oracle Enterprise Manager 11g Database Control is already running.
[oracle@h1 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://h1:5501/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /app/oracle/product/11.2.0/dbhome_2/h1_ORCL/sysman/log
7.OEM常用的命令
(1)創建一個EM資料庫 -
emca –repos create -
(2)刪除一個EM資料庫 -
emca –repos drop -
(4)配置數據庫的DatabaseControl -
emca –config dbcontrol db -
(5)刪除數據庫的DatabaseControl配置 -
emca –deconfig dbcontrol db -
(6)重新配置db control的端口,默認端口在1158 -
emca –reconfig ports -
emca –reconfig ports -dbcontrol_http_port 1160 -
emca -reconfigports -agent_port 3940 -
(7)先設置ORACLE_SID環境變量後,啓動EM console服務 -
emctl start dbconsole -
(8)先設置ORACLE_SID環境變量後,停止EM console服務 -
emctl stop dbconsole -
(9)先設置ORACLE_SID環境變量後,查看EM console服務的狀態 -
emctl status dbconsole -
(10)配置dbconsole的步驟 -
emca -reposcreate -
emca -configdbcontrol db -
emctl start dbconsole -
(11)重新配置dbconsole的步驟 -
emca –repos drop -
emca –repos create -
emca –config dbcontrol db -
emctl start dbconsole