1 定義
Oracle10G的EM採用了web方式,並且分成了2個產品,database control和grid control。這裡主要介紹如何建立單資料的dbcontrol。Grid control需要下載單獨的光碟片安裝。
在用DBCA建庫的時候,可以選擇是否啟用dbcontrol,啟用的話需要在資料庫中建立一個sysman的schema,用於儲存EM的一些資料,這個就是EM的資料庫(repository)。
使用命令列工具emca可以建立,修改,重建或者刪除dbcontrol的配置。
2 常用命令的文法
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(這個命令實驗沒有成功,運行後還是1158,原因沒有找到。)
emca -reconfig ports -agent_port 3939
3 實驗
3.1 未配置dbconsole前報錯
[oracle@cent4 ~]$ emctl start dbconsole
TZ set to PRC
OC4J Configuration issue. /u01/app/oracle/product/10.2.1/db_1/oc4j/j2ee/OC4J_DBConsole_cent4.oracle.com_ltest not found.
3.2 配置dbconsole
[oracle@cent4 j2ee]$ emca -config dbcontrol db
EMCA 開始於 2011-11-10 9:13:27
EM Configuration Assistant 10.2.0.1.0 正式版
著作權 (c) 2003, 2005, Oracle。著作權所有,並保留一切權利。
輸入以下資訊:
資料庫 SID: ltest
監聽程式連接埠號碼: 1521
SYS 使用者的口令:
DBSNMP 使用者的口令:
SYSMAN 使用者的口令:
SYSMAN 使用者的口令: 通知的電子郵件地址 (可選):
通知的發件 (SMTP) 伺服器 (可選):
-----------------------------------------------------------------
已指定以下設定
資料庫 ORACLE_HOME ................ /u01/app/oracle/product/10.2.1/db_1
資料庫主機名稱 ................ cent4.oracle.com
監聽程式連接埠號碼 ................ 1521
資料庫 SID ................ ltest
通知的電子郵件地址 ...............
通知的發件 (SMTP) 伺服器 ...............
-----------------------------------------------------------------
是否繼續? [yes(Y)/no(N)]: YES
2011-11-10 9:15:59 oracle.sysman.emcp.EMConfig perform
資訊: 正在將此操作記錄到 /u01/app/oracle/product/10.2.1/db_1/cfgtoollogs/emca/ltest/emca_2011-11-10_09-13-27-上午.log。
2011-11-10 9:16:12 oracle.sysman.emcp.util.DBControlUtil startOMS
資訊: 正在啟動 Database Control (此操作可能需要一段時間)...
2011-11-10 9:17:52 oracle.sysman.emcp.EMDBPostConfig performConfiguration
資訊: 已成功啟動 Database Control
2011-11-10 9:17:52 oracle.sysman.emcp.EMDBPostConfig performConfiguration
資訊: >>>>>>>>>>> Database Control URL 為 http://cent4.oracle.com:1158/em <<<<<<<<<<<
已成功完成 Enterprise Manager 的配置
EMCA 結束於 2011-11-10 9:17:52
[oracle@cent4 j2ee]$ ls
deploy_db.ini home isqlplus oc4j_applications OC4J_DBConsole OC4J_DBConsole_cent4.oracle.com_ltest