ORACLE 11g RAC EM手動配置

panpong發表於2016-12-27

ORACLE 11g RAC EM手動配置

    前一段透過靜默安裝方式配置了一套兩個節點的11gr2 RAC,後面再配置EM卻不成功,症狀表現是EM配置完成後,登入頁面,出現如下錯誤:

The 主機 CPU Chart could not be generated.
1.Error: Invalid BoundDataSource: no class, method or dataSource provided.
2.Check the log file for details.

The 活動會話數 Chart could not be generated.
1.Error: Invalid BoundDataSource: no class, method or dataSource provided.
2.Check the log file for details.

經過查詢原因,發現根本原因是11g RAC在配置EM時,需要-cluster引數,如
$emca -deconfig dbcontrol db -repos drop -cluster

注意:以上命令清除RAC資料庫舊配置資訊,但是會使資料庫進入靜默模式,鎖定所有使用者,在生產環境是不允許的。於是分兩步進行配置:(不會進入靜默模式)
1)刪除舊配置資訊
emca -deconfig dbcontrol db 1
emca -deconfig dbcontrol db 節點2
sqlplus / as sysdba
SQL> drop user sysman cascade;
SQL> drop role MGMT_USER;
SQL> drop user MGMT_VIEW cascade;
SQL> drop public synonym MGMT_TARGET_BLACKOUTS;
SQL> drop public synonym SETEMVIEWUSERCONTEXT;

2)重新建立RAC資料庫db control 配置資訊
$emca -config dbcontrol db -repos create -cluster
配置過程中出現的問題:
? 中間出現Error警告
WARNING: Error during db connection : ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
可以無視

? ASMSNMP密碼錯誤問題
[oracle@vm4 db_1]$ emca -config dbcontrol db -repos create -cluster

STARTED EMCA at Dec 22, 2016 5:18:40 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle. All rights reserved.

Enter the following information:
Database unique name: racdb
Service name: racdb
Listener port number: 1521
Listener ORACLE_HOME [ /data/app/11.2.0/grid ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Password for SYSMAN user: Cluster name: rac-cluster
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
ASM ORACLE_HOME [ /data/app/11.2.0/grid ]:
ASM port [ 1521 ]:
ASM username [ ASMSNMP ]:
ASM user password:
Dec 22, 2016 5:19:12 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: Error during db connection : ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Dec 22, 2016 5:19:17 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: ORA-01031: insufficient privileges

Dec 22, 2016 5:19:17 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: Error during db connection : ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Dec 22, 2016 5:19:22 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: ORA-01031: insufficient privileges

Password validation failed. Some of the possible reasons may be:

1) Invalid username/password.
2) Database is not up.
3) Scan listener not up.
4) Database service is not registered with scan listener.
5) Password file may be missing or configured incorrectly.

ASM user password:

解決方法:(grid使用者)
1) Remove all the ASM password files from each node:
rm Grid Oracle Home/dbs/orapw+ASM1
rm Grid Oracle Home/dbs/orapw+ASM2
rm Grid Oracle Home/dbs/orapw+ASM<..n>

2) Create ASM password file manually on the first node as the OS user which owns the Grid Infrastructure:
$> orapwd file=’orapw+ASM1’ entries=5 password=’here your password’

3) Copy the password file to all nodes with the correct ASM instance name:
scp orapw+ASM1 to remote node : Grid Oracle Home/dbs/orapw+ASM2
scp orapw+ASM1 to remote node : Grid Oracle Home/dbs/orapw+ASM3
..
scp orapw+ASM1 to remote node : Grid Oracle Home/dbs/orapw+ASM<..n>

4) Add the ASMSNMP user in ASM instance, and grant sysdba privilege to it:
SQL> create user asmsnmp identified by ‘password’;
SQL> grant sysdba to asmsnmp;

5) Verify the ASMSNMP user was created:
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS


SYS TRUE TRUE TRUE
ASMSNMP TRUE FALSE FALSE

接下來建立成功,將HTTPS改為HTTP就行了
$emctl unsecure dbconsole

最終配置成功,EM頁面圖示顯示正常了!


另外,ORACLE 11g EM 在各種情況下無法啟動或者需要重建的時候,我們通常使用EMCA命令手動配置;Emca命令詳細的說明可以檢視連機幫助,下面給出一些常用的命令:

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的埠,預設埠在1158

emca -reconfig ports -dbcontrol_http_port 1160

emca -reconfig ports -agent_port 3940

 

emctl start dbconsole  //啟動EM console服務

emctl stop dbconsole  //停止EM console服務

emctl status dbconsole  //檢視EM console服務的狀態

 

l  配置dbconsole的步驟

emca -repos create

emca -config dbcontrol db

emctl start dbconsole

l  重新配置dbconsole的步驟

emca -repos drop

emca -repos create

emca -config dbcontrol db

emctl start dbconsole

或者

emca -config dbcontrol db -repos recreate

l  手動刪除資料庫

SQL> drop user sysman cascade;

SQL> drop role MGMT_USER;

SQL> drop user MGMT_VIEW cascade;

SQL> drop public synonym MGMT_TARGET_BLACKOUTS;

SQL> drop public synonym setemviewusercontext;


【參考】
1. ORACLE 11g EM 無法啟動的問題和重建,http://blog.sina.com.cn/s/blog_7c855cf70100shrv.html
2. http://www.itpub.net/thread-1757162-1-1.html
3. Reconfigure Database Control in RAC environment using EMCA,

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16976507/viewspace-2131429/,如需轉載,請註明出處,否則將追究法律責任。

相關文章