【OEM】OEM安裝維護

lhrbest發表於2016-03-03

OEMOEM安裝維護

1.1  BLOG文件結構圖

wpsDC25.tmp 

 

 

1.2  前言部分

 

1.2.1  導讀和注意事項

各位技術愛好者,看完本文後,你可以掌握如下的技能,也可以學到一些其它你所不知道的知識,~O(∩_∩)O~:

oem安裝和維護

② OEM各種錯誤解決

 

  Tips:

       ① 若文章程式碼格式有錯亂,推薦使用搜狗、QQ360瀏覽器,也可以下載pdf格式的文件來檢視,pdf文件下載地址:http://yunpan.cn/cdEQedhCs2kFz (提取碼:ed9b 

       ② 本篇BLOG中命令的輸出部分需要特別關注的地方我都用灰色背景和粉紅色字型來表示,比如下邊的例子中,thread 1的最大歸檔日誌號為33thread 2的最大歸檔日誌號為43是需要特別關注的地方;而命令一般使用黃色背景和紅色字型注;對程式碼或程式碼輸出部分的注釋一般採用藍色字型表示

 

  List of Archived Logs in backup set 11

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

  ---- ------- ---------- ------------------- ---------- ---------

  1    32      1621589    2015-05-29 11:09:52 1625242    2015-05-29 11:15:48

  1    33      1625242    2015-05-29 11:15:48 1625293    2015-05-29 11:15:58

  2    42      1613951    2015-05-29 10:41:18 1625245    2015-05-29 11:15:49

  2    43      1625245    2015-05-29 11:15:49 1625253    2015-05-29 11:15:53

 

 

 

[ZFXXDB1:root]:/>lsvg -o

T_XDESK_APP1_vg

rootvg

[ZFXXDB1:root]:/>

00:27:22 SQL> alter tablespace idxtbs read write;

 

 

====》2097152*512/1024/1024/1024=1G 

 

 

 

 

 

本文如有錯誤或不完善的地方請大家多多指正,ITPUB留言或QQ皆可,您的批評指正是我寫作的最大動力。

 

1.3  OEM安裝維護總結

 

我安裝過幾次EM,出現過很多問題,幾經周折,總結了如下的內容,實在不能解決就重新建立吧,重新建立可以解決99%的問題,這裡把需要注意的一些前提列出來:

1. 資料庫必須使用伺服器模式的,不能使用客戶端模式的,客戶端模式有很多檔案不存在(從$ORACLE_HOMEdb_1或者client_1也可以識別)

2. 資料庫伺服器的ip地址必須是靜態的,不能是dhcp動態獲取,動態獲取可能導致em執行緩慢,還可能導致伺服器ip地址改變等問題,也可能導致em啟動後又自動關閉等問題

3. 資料庫伺服器的hostname不能隨便修改,修改後em肯定不能用了

4. 安裝過程中出現問題的時候認真檢視日誌,安裝日誌路徑:$ORACLE_HOME/cfgtoollogs\emca\

5. OEM執行日誌:$ORACLE_HOME/$hostname_$oracle_sid/sysman/log

6. 建議重新建立,在oracle使用者下:
單機: emca -config dbcontrol db -repos recreate
叢集: emca -config dbcontrol db -repos recreate -cluster

若是叢集環境,則在建立之前先在grid使用者下執行如下程式碼:

-----sqlplus / as sysasm ASM例項 GRID 使用者下執行

SYS@+ASM1> create user asmsnmp identified by xxx;

SYS@+ASM1> grant sysdba to asmsnmp;

SYS@+ASM1> alter user asmsnmp identified by xxx;

SYS@+ASM1> alter system set remote_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ZFXDESKDB-scan)(PORT=1521))))' sid='*';

    SYS@+ASM1> alter system register;

7. 啟動和關閉維護命令,oracle使用者下:export ORACLE_UNQNAME=$DB_UNIQUE_NAME ,資料庫唯一名,程式:ps -ef| grep em

    啟動: emctl stop dbconsole

關閉: emctl stop dbconsole

執行狀態:emctl status dbconsole

8. Rac叢集環境在其中一個節點上安裝,其他節點也可以查詢,為EM Daemon,如:

[ZFXDESKDB2:oracle]:/oracle>export ORACLE_UNQNAME=oraESKDB

[ZFXDESKDB2:oracle]:/oracle>emctl status dbconsole

Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0

Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.

https://ZFXDESKDB1:1158/em/console/aboutApplication

EM Daemon is running.

------------------------------------------------------------------

Logs are generated in directory /oracle/app/oracle/product/11.2.0/db/zfxdeskdb2_oraESKDB/sysman/log

 

 

 

 

1.4  OEM簡介(網路摘抄)

Oracle 10g企業管理器(Oracle Enterprise Manager)簡稱OEM,是一個基於Java的框架系統,該系統整合了多個元件,為使用者提供了一個功能強大的圖形使用者介面。

1.      OEM的功能

(1) 管理完整的Oracle 10g環境,包括資料庫、iAS伺服器、應用程式和服務。

(2) 診斷、修改和優化多個資料庫。

(3) 在多個系統上,按不同的時間間隔排程服務。

(4) 通過網路管理資料庫的約束條件。

(5) 管理來自不同位置的多個網路節點和服務。

(6) 和其他管理員共享任務。

(7) 將相關的服務組合在一起,便於對任務的管理。

(8) 啟動整合的Oracle10g第三方工具。

 

2.     OEM的管理工具

(1)     例程管理。對資料庫執行以下管理操作:

    檢視和編輯例項(Instance)引數值。

    管理使用者會話,檢視當前執行的SQL及其解釋計劃。

③      管理分散式Internet計算環境中沒有及時解決的事務處理衝突。

    監視需要長時間執行的操作。

    通過資源計劃控制處理資源。

    管理已儲存配置。

    管理佔用資源數量最多的鎖和會話。

OEM的管理工具

(2)     方案管理。使用方案管理器來管理方案物件,如表、索引、檢視和觸發器等。利用它可以實現下列功能:

建立方案物件。

修改方案物件。

刪除方案物件。

顯示方案物件的相關性。

(3) 安全管理。DBA使用安全管理器可以完成以下操作:

建立使用者、角色和概要檔案。

修改使用者、角色和概要檔案。

刪除使用者、角色和概要檔案。

向資料庫使用者授予許可權和角色。

2.     OEM的管理工具

(4)     儲存管理。使用儲存管理器可管理表空間、回滾段、資料檔案和重做日

         志等儲存物件。利用它可以進行以下操作:

    建立儲存物件。

②     將資料檔案和回滾段新增到表空間中。

    刪除儲存物件。

   將物件離線或聯機。

   顯示物件的相關性。

1.5  OEM命令(網路摘抄)

 建立一個EM資料庫

emca -repos create


重建一個EM資料庫

emca -repos recreate


刪除一個EM資料庫

emca -repos drop


配置資料庫Database Control

emca -config dbcontrol db


刪除資料庫的 Database Control配置

emca -deconfig dbcontrol db


重新配置db control的埠,預設埠在1158

emca -reconfig ports
emca -reconfig ports -dbcontrol_http_port 1160

emca -reconfig ports -agent_port 3940

注:檢視埠號可查如下路徑。


 


配置dbconsole的步驟

emca -repos create

emca -config dbcontrol db

emctl start dbconsole


重新配置dbconsole的步驟

emca -repos drop

emca -repos create

emca -config dbcontrol db

emctl start dbconsole

 

emctl start dbconsole   -----啟動控制檯服務

emctl stop dbconsole   -----關閉控制檯服務

emctl status dbconsole  -----檢視控制檯服務狀態

 

命令如下
emca -config dbcontrol db -repos recreate
  ---建議重新建立

emca -config dbcontrol db -repos create

 

emca -repos drop

emca -deconfig dbcontrol db

 

drop user sysman cascade;

drop role MGMT_USER;

drop user MGMT_VIEW cascade;

 

1.6  啟動OEM

先設定ORACLE_SID環境變數後,停止EM console服務

emctl stop dbconsole
先設定ORACLE_SID環境變數後,檢視EM console服務的狀態

emctl status dbconsole

[oracle@rhel_linux_asm ~]$ emctl status dbconsole

Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0

Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.

http://192.168.128.131:1158/em/console/aboutApplication

Oracle Enterprise Manager 11g is not running.

------------------------------------------------------------------

Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/192.168.128.131_orclasm/sysman/log

[oracle@rhel_linux_asm ~]$

 

先設定ORACLE_SID環境變數後,啟動EM console服務

emctl start dbconsole

[oracle@rhel_linux_asm ~]$ emctl start dbconsole

Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0

Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.

http://192.168.128.131:1158/em/console/aboutApplication

Starting Oracle Enterprise Manager 11g Database Control .................. started.

------------------------------------------------------------------

Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/192.168.128.131_orclasm/sysman/log

[oracle@rhel_linux_asm ~]$

訪問瀏覽器:http://192.168.128.131:1158/em/

wpsDC35.tmp 

這個說明監聽沒有啟動

1.7  其他問題解決(網路摘抄+個人案例)

1.7.1  Environment variable ORACLE_SID not defined.

1、 開啟cmd輸入 emctl start dbconsole
將會有錯誤資訊提示,如果沒有設定ORACLE_SID 則提示
Environment variable ORACLE_SID not defined. Please define it.

設定ORACLE_SID:開啟cmd,輸入set ORACLE_SID=orcl(例項名),即可

 

1.7.2  oc4j configration issue--hostname 變動了

 

解決方案

 

 

1. EM Configuration issue. c:\app\Administrator\product\11.2.0\dbhome_1/lhr_$oracle_unqname not found.

 

辦法:set oracle_unqname=$oracle_sid

 

2. OC4JConfigurationissue.c:\app\Administrator\product\11.2.0\dbhome_1/oc4j/j2ee/OC4J_DBConsole_lhr_$oracle_sid not found.

 

辦法:set oracle_sid=orcl

 

3. OC4JConfigurationissue.c:\app\Administrator\product\11.2.0\dbhome_1/oc4j/j2ee/OC4J_DBConsole_mcfg.sandai.net_orcl not found.

 

 

4. Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name

解決方法:

     在啟動的時候先設定一下   set oracle_unqname=$ORACLE_SID

 

1.7.3  OC4J Configuration issue. /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_192.168.128.134_orclasm not found.

 

重建oem吧,可能你的oem根本就沒有建立吧。。。。

 

1.7.4  Can't locate CompEMdbconsole.pm in @INC

該問題的意思就是不能載入CompEMdbconsole.pm 檔案,去相應的目錄看看有沒有,沒有的話就到其它地方拷貝檔案過來吧。locate 就是 位於,查詢。。。。的意思,,,,,英語呀

 

[oracle@lhr_linux ~]$ emctl

Can't locate CompEMdbconsole.pm in @INC (@INC contains: %s_javapOracleHome%/sysman/admin/scripts %s_javapOracleHome%/bin /u01/app/oracle/product/11.2.0/client_1/perl/lib/5.10.0/i686-linux-thread-multi /u01/app/oracle/product/11.2.0/client_1/perl/lib/5.10.0 /u01/app/oracle/product/11.2.0/client_1/perl/lib /u01/app/oracle/product/11.2.0/client_1/perl/lib/site_perl/5.10.0/i686-linux-thread-multi /u01/app/oracle/product/11.2.0/client_1/perl/lib/site_perl/5.10.0 /u01/app/oracle/product/11.2.0/client_1/perl/lib/site_perl /u01/app/oracle/product/11.2.0/client_1/perl/libwww-perl/lib /u01/app/oracle/product/11.2.0/client_1/perl/ext/POSIX /u01/app/oracle/product/11.2.0/client_1/perl/URI /u01/app/oracle/product/11.2.0/client_1/perl/HTML_Parser /u01/app/oracle/product/11.2.0/client_1/perl/HTML-Parser/lib /u01/app/oracle/product/11.2.0/client_1/sysman/admin/scripts /u01/app/oracle/product/11.2.0/client_1/bin /u01/app/oracle/product/11.2.0/client_1/sysman/admin/scripts/Net-DNS-0.48/lib/ /u01/app/oracle/product/11.2.0/client_1/sysman/admin/scripts/libnet-1.19/ .) at /u01/app/oracle/product/11.2.0/client_1/bin/EmctlCommon.pm line 638.

 

 

 

1. Can't locate CompEMdbconsole.pm in @INC造成的問題

Set the environment correctly for the Database ORACLE_HOME:

Unix:

export ORACLE_HOME=
export ORACLE_SID=
export PATH=$ORACLE_HOME/bin:$PATH

$ORACLE_HOME/bin: emctl start dbconsole

Windows:

set ORACLE_HOME=
set ORACLE_SID=
set PATH=$ORACLE_HOME\bin:$PATH

$ORACLE_HOME\bin: emctl start dbconsole

我看了下目錄$ORACLE_HOME\bin檔案 perl模組沒有,可能解壓出問題,由於perl是跨平臺的語言,直接找個相應的版本複製一下把compdb開頭的pm複製到$ORACLE_HOME\bin,大約9個檔案吧,或者把pm檔案全部拷貝過去吧,大約34個檔案

1.7.5  EM Configuration issue. /opt/oracle/product/11.2.0/db_1/localhost.localdomain_ocmdb not found.

2.由於ip地址改動的問題EM

[oracle@localhost bin]$ emctl status
EM Configuration issue. /opt/oracle/product/11.2.0/db_1/localhost.localdomain_ocmdb not found.

 

 

1.7.6  SEVERE: Listener is not up or database service is not registered with it

問題表現如下:

[oracle@xbfye7l01 db_home]$ emca -config dbcontrol db

………………

-----------------------------------------------------------------

Do you wish to continue? [yes(Y)/no(N)]: Y

Aug 15, 2012 9:45:48 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_15_09_45_23.log.

Aug 15, 2012 9:45:49 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .

Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_15_09_45_23.log for more details.

Could not complete the configuration. Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_15_09_45_23.log for more details.

[oracle@xbfye7l01 db_home]$

 

檢視日誌:

 

[oracle@xbfye7l01 db_home]$ tail -100 /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_15_09_45_23.log

g 15, 2012 9:45:49 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly

CONFIG: SQLEngine created successfully and connected

Aug 15, 2012 9:45:49 AM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl

CONFIG: ORA-12541: TNS:no listener

 

oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-12541: TNS:no listener

 

        at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1650)

        at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeSql(SQLEngine.java:1898)

        at oracle.sysman.emcp.ParamsManager.checkListenerStatusForDBControl(ParamsManager.java:3230)

        at oracle.sysman.emcp.EMReposConfig.unlockMGMTAccount(EMReposConfig.java:1000)

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:345)

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:157)

        at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:253)

        at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:589)

        at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1448)

        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:573)

        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521)

Aug 15, 2012 9:45:49 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .

Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_15_09_45_23.log for more details.

Aug 15, 2012 9:45:49 AM oracle.sysman.emcp.EMConfig perform

CONFIG: Stack Trace:

oracle.sysman.emcp.exception.EMConfigException: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .

        at oracle.sysman.emcp.ParamsManager.checkListenerStatusForDBControl(ParamsManager.java:3245)

        at oracle.sysman.emcp.EMReposConfig.unlockMGMTAccount(EMReposConfig.java:1000)

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:345)

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:157)

        at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:253)

        at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:589)

        at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1448)

        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:573)

        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521)

Aug 15, 2012 9:45:49 AM oracle.sysman.emcp.EMConfig restoreOuiLoc

CONFIG: Restoring oracle.installer.oui_loc to /apps/product/11.2.0/db_home/oui

解決辦法:

最後檢查是因為修改Hostname,但hosts檔案以及監聽未及時修改所致,於是調整完各個引數,保持一至後,發現仍然報同樣的錯誤,又檢查發現資料庫V$session中的機器名還是原來的hostname,所以重啟資料庫,機器後一樣,但總的問題沒有解決。於是重啟了機器,該問題解決。但出現了第二個問題,在下面將進行解決。

 

1.7.7  SEVERE: Failed to unlock all EM-related accounts

 問題表現1

 

[oracle@xbfye7l01 ~]$ emca -config dbcontrol db

Do you wish to continue? [yes(Y)/no(N)]: Y

Aug 16, 2012 9:06:21 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_06_08.log.

Aug 16, 2012 9:06:23 AM oracle.sysman.emcp.EMReposConfig invoke

SEVERE: Failed to unlock all EM-related accounts

Aug 16, 2012 9:06:23 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Failed to unlock all EM-related accounts

Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_06_08.log for more details.

Could not complete the configuration. Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_06_08.log for more details.

[oracle@xbfye7l01 ~]$

檢視日誌:

[root@xbfye7l01 ~]# tail -100 /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_06_08.log

………………

CONFIG: Couldn't execute statement: ORA-01403: no data found

ORA-06512: at "SYSMAN.MGMT_VIEW_PRIV", line 41

ORA-06512: at line 1 (DBD NO_DATA: OCIStmtExecute) at /apps/product/11.2.0/db_home/sysman/admin/scripts/emca/emcaDbUtil.pl line 129, line 2.

 

Aug 16, 2012 9:06:23 AM oracle.sysman.emcp.util.PlatformInterface executeCommand

CONFIG: Error executing /apps/product/11.2.0/db_home/sysman/admin/scripts/emca/emcaDbUtil /apps/product/11.2.0/db_home/perl/lib:/apps/product/11.2.0/db_home/perl/lib/site_perl:/apps/product/11.2.0/db_home/sysman/admin/scripts:/apps/product/11.2.0/db_home/bin: /apps/product/11.2.0/db_home/perl/bin/perl /apps/product/11.2.0/db_home/sysman/admin/scripts/emca/emcaDbUtil.pl /apps/product/11.2.0/db_home (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xbfye7l01)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=E7DEV))) SYS SYSDBA declare repos_pwd varchar2(30); view_user varchar2(30); view_user_pwd varchar2(30); view_user_acc_status varchar2(30); begin repos_pwd := ?; sysman.mgmt_view_priv.get_view_user(view_user); select account_status into view_user_acc_status from sys.dba_users where upper(username) = upper ( view_user ); IF view_user_acc_status like '%LOCKED%' THEN execute immediate 'alter user ' || view_user || ' account unlock'; END IF; IF view_user_acc_status like '%EXPIRED%' THEN sysman.mgmt_view_priv.set_view_user_creds ( repos_pwd ); sysman.mgmt_view_priv.GET_VIEW_USER_CREDS ( view_user, view_user_pwd ); execute immediate 'alter user ' || view_user || ' identified by ' || view_user_pwd || ''; END IF; end; E7DEV 1 SYSMAN_PWD

Aug 16, 2012 9:06:23 AM oracle.sysman.emcp.EMReposConfig unlockMGMTAccount

CONFIG: Failed to unlock mgmt_view account

Aug 16, 2012 9:06:23 AM oracle.sysman.emcp.EMReposConfig invoke

SEVERE: Failed to unlock all EM-related accounts

Aug 16, 2012 9:06:23 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Failed to unlock all EM-related accounts

Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_06_08.log for more details.

Aug 16, 2012 9:06:23 AM oracle.sysman.emcp.EMConfig perform

CONFIG: Stack Trace:

oracle.sysman.emcp.exception.EMConfigException: Failed to unlock all EM-related accounts

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:348)

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:157)

        at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:253)

        at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:589)

        at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1448)

        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:573)

        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521)

Aug 16, 2012 9:06:23 AM oracle.sysman.emcp.EMConfig restoreOuiLoc

CONFIG: Restoring oracle.installer.oui_loc to /apps/product/11.2.0/db_home/oui

[root@xbfye7l01 ~]#

1.7.8  SEVERE: Error creating the repository

[oracle@xbfye7l01 ~]$ emca -config dbcontrol db -repos create

 

Do you wish to continue? [yes(Y)/no(N)]: Y

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_12_41.log.

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig createRepository

INFO: Creating the EM repository (this may take a while) ...

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig invoke

SEVERE: Error creating the repository

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_repos_create_.log for more details.

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Error creating the repository

Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_12_41.log for more details.

Could not complete the configuration. Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_12_41.log for more details.

[oracle@xbfye7l01 ~]$

檢視日誌:

[root@xbfye7l01 ~]# tail -50 /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_12_41.log

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.util.GeneralUtil isLocalConnectionRequired

CONFIG: isLocalConnectionRequired: true

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngine

CONFIG: isLocalConnectionRequired: true. Connecting to database instance locally.

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly

CONFIG: SQLEngine connecting with SID: E7DEV, oracleHome: /apps/product/11.2.0/db_home, and user: SYS

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly

CONFIG: SQLEngine created successfully and connected

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig createRepository

CONFIG: Spooling to /apps/cfgtoollogs/emca/E7DEV/emca_repos_create_2012_08_16_09_12_57.log

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig createRepository

INFO: Creating the EM repository (this may take a while) ...

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig createRepository

CONFIG: ORA-20001: SYSMAN already exists..

ORA-06512: at line 17

 

oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-20001: SYSMAN already exists..

ORA-06512: at line 17

 

        at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1650)

        at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeScript(SQLEngine.java:1000)

        at oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:339)

        at oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:380)

        at oracle.sysman.emcp.EMReposConfig.createRepository(EMReposConfig.java:510)

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:228)

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:157)

        at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:253)

        at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:589)

        at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1448)

        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:573)

        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521)

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig invoke

SEVERE: Error creating the repository

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_repos_create_.log for more details.

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Error creating the repository

Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_12_41.log for more details.

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMConfig perform

CONFIG: Stack Trace:

oracle.sysman.emcp.exception.EMConfigException: Error creating the repository

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:240)

        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:157)

        at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:253)

        at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:589)

        at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1448)

        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:573)

        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521)

Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMConfig restoreOuiLoc

CONFIG: Restoring oracle.installer.oui_loc to /apps/product/11.2.0/db_home/oui

[root@xbfye7l01 ~]#

再次嘗試:

[oracle@xbfye7l01 ~]$ emca -repos create

 

STARTED EMCA at Aug 16, 2012 9:23:21 AM

EM Configuration Assistant, Version 11.2.0.0.2 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

Enter the following information:

Database SID: E7DEV

Listener port number: 1521

Password for SYS user:

Password for SYSMAN user:

 

Do you wish to continue? [yes(Y)/no(N)]: Y

Aug 16, 2012 9:23:36 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_23_21.log.

Aug 16, 2012 9:23:36 AM oracle.sysman.emcp.EMReposConfig createRepository

INFO: Creating the EM repository (this may take a while) ...

Aug 16, 2012 9:23:36 AM oracle.sysman.emcp.EMReposConfig invoke

SEVERE: Error creating the repository

Aug 16, 2012 9:23:36 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_repos_create_.log for more details.

Aug 16, 2012 9:23:36 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Error creating the repository

Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_23_21.log for more details.

Could not complete the configuration. Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_23_21.log for more details.

[oracle@xbfye7l01 ~]$

1.7.8.1  解決過程

1.執行下面的一系統刪除命令:

 

這裡其實可以用重建的命令,emca -config dbcontrol db -repos recreate  ---建議重新建立,

這樣就不會報這種錯誤了

由於之前操作過一次,所以部分報不存在,第一次刪除時均正常

SQL> drop user sysman cascade;

         User dropped.

SQL> drop role MGMT_USER;

Role dropped.

SQL>  drop user MGMT_VIEW cascade;

drop user MGMT_VIEW cascade

           *

ERROR at line 1:

ORA-01918: user 'MGMT_VIEW' does not exist

SQL> drop public synonym MGMT_TARGET_BLACKOUTS;

Synonym dropped.

SQL> drop public synonym SETEMVIEWUSERCONTEXT;

drop public synonym SETEMVIEWUSERCONTEXT

                    *

ERROR at line 1:

ORA-01432: public synonym to be dropped does not exist

2. 重建測試,問題依然存在。

[oracle@xbfye7l01 ~]$ emca -repos create

 

STARTED EMCA at Aug 16, 2012 9:30:15 AM

EM Configuration Assistant, Version 11.2.0.0.2 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

Enter the following information:

Database SID: E7DEV

Listener port number: 1521

Password for SYS user:

Password for SYSMAN user:

 

Do you wish to continue? [yes(Y)/no(N)]: Y

Aug 16, 2012 9:30:24 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_30_15.log.

Aug 16, 2012 9:30:24 AM oracle.sysman.emcp.EMReposConfig createRepository

INFO: Creating the EM repository (this may take a while) ...

Aug 16, 2012 9:31:37 AM oracle.sysman.emcp.EMReposConfig invoke

SEVERE: Error creating the repository

Aug 16, 2012 9:31:37 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_repos_create_.log for more details.

Aug 16, 2012 9:31:37 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Error creating the repository

Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_30_15.log for more details.

Could not complete the configuration. Refer to the log file at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_30_15.log for more details.

[oracle@xbfye7l01 ~]$

3. 刪除資料庫的 Database Control配置

 

[oracle@xbfye7l01 ~]$ emca -deconfig dbcontrol db

STARTED EMCA at Aug 16, 2012 9:46:37 AM

EM Configuration Assistant, Version 11.2.0.0.2 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

Enter the following information:

Database SID: E7DEV

 

Do you wish to continue? [yes(Y)/no(N)]: Y

Aug 16, 2012 9:46:42 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_46_36.log.

Aug 16, 2012 9:46:42 AM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration

WARNING: EM is not configured for this database. No EM-specific actions can be performed.

Enterprise Manager configuration completed successfully

FINISHED EMCA at Aug 16, 2012 9:46:42 AM

[oracle@xbfye7l01 ~]$

 

4.  刪除EM資料庫

 

[oracle@xbfye7l01 ~]$ emca -repos drop

 

STARTED EMCA at Aug 16, 2012 9:47:09 AM

EM Configuration Assistant, Version 11.2.0.0.2 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

Enter the following information:

Database SID: E7DEV

Listener port number: 1521

Password for SYS user:

Password for SYSMAN user:

 

Do you wish to continue? [yes(Y)/no(N)]: Y

Aug 16, 2012 9:47:18 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_47_09.log.

Aug 16, 2012 9:47:18 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Dropping the EM repository (this may take a while) ...

Aug 16, 2012 9:47:56 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Repository successfully dropped

Enterprise Manager configuration completed successfully

FINISHED EMCA at Aug 16, 2012 9:47:56 AM

[oracle@xbfye7l01 ~]$

 

5.EM資料庫和Database Control重新建立。

 

[oracle@xbfye7l01 ~]$ emca -config dbcontrol db -repos create

 

STARTED EMCA at Aug 16, 2012 9:48:35 AM

EM Configuration Assistant, Version 11.2.0.0.2 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

Enter the following information:

Database SID: E7DEV

Listener port number: 1521

Listener ORACLE_HOME [ /apps/product/11.2.0/db_home ]:

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 ................ /apps/product/11.2.0/db_home

 

Local hostname ................ xbfye7l01

Listener ORACLE_HOME ................ /apps/product/11.2.0/db_home

Listener port number ................ 1521

Database SID ................ E7DEV

Email address for notifications ...............

Outgoing Mail (SMTP) server for notifications ...............

 

-----------------------------------------------------------------

Do you wish to continue? [yes(Y)/no(N)]: Y

Aug 16, 2012 9:48:54 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_16_09_48_35.log.

Aug 16, 2012 9:48:54 AM oracle.sysman.emcp.EMReposConfig createRepository

INFO: Creating the EM repository (this may take a while) ...

Aug 16, 2012 9:51:56 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Repository successfully created

Aug 16, 2012 9:51:58 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository

INFO: Uploading configuration data to EM repository (this may take a while) ...

Aug 16, 2012 9:52:26 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Uploaded configuration data successfully

Aug 16, 2012 9:52:29 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib

INFO: Software library configured successfully.

Aug 16, 2012 9:52:29 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary

INFO: Deploying Provisioning archives ...

Aug 16, 2012 9:52:47 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary

INFO: Provisioning archives deployed successfully.

Aug 16, 2012 9:52:47 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole

INFO: Securing Database Control (this may take a while) ...

Aug 16, 2012 9:54:05 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole

INFO: Database Control secured successfully.

Aug 16, 2012 9:54:05 AM oracle.sysman.emcp.util.DBControlUtil startOMS

INFO: Starting Database Control (this may take a while) ...

Aug 16, 2012 9:54:26 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: Database Control started successfully

Aug 16, 2012 9:54:26 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: >>>>>>>>>>> The Database Control URL is https://xbfye7l01:1158/em <<<<<<<<<<<

Aug 16, 2012 9:54:28 AM oracle.sysman.emcp.EMDBPostConfig invoke

WARNING:

************************  WARNING  ************************

 

Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /apps/product/11.2.0/db_home/xbfye7l01_E7DEV/sysman/config/emkey.ora.   Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.

 

***********************************************************

Enterprise Manager configuration completed successfully

FINISHED EMCA at Aug 16, 2012 9:54:28 AM

[oracle@xbfye7l01 ~]$

此次操作成功,問題得到解決,經測試https://xbfye7l01:1158/em登陸正常。

1.7.9  shell-init: error retrieving current directory

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

OC4J Configuration issue. /u01/app/oracle/product/11.2.0/client_1/oc4j/j2ee/OC4J_DBConsole_Error occurred during initialization of VM

java.lang.Error: Properties init: Could not determine current working directory._orcllinux not found.

 

當前的操作目錄已經不存在了或者已經刪掉重建了,所以切換到任意一個存在的目錄即可。。。。

 

 

1.7.10  Asm+11g+em

一次安裝過程中我殺掉了程式後使用命令重建就報錯了,這個時候手動清理一下相關使用者和下邊物件重建就可以了。

drop user sysman cascade;

drop role MGMT_USER;

drop user MGMT_VIEW cascade;

 

 

1.7.11  Accessibility Mode disable

OEM不能正常訪問:

wpsDC46.tmp 

wpsDC47.tmp 

 

解決方案:

1. 修改$ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/WEB-INF/uix-config.xml檔案,將inaccessible改成accessible

 

2. 然後重啟EM就可以了;

wpsDC48.tmp 

wpsDC59.tmp 

 

 

wpsDC5A.tmp 

 

 

1.8  瀏覽器出現  此網站的安全證照有問題

 

網上有很多解決辦法的,或者使用火狐瀏覽器就可以了。

wpsDC6A.tmp 

 

 

 

1.9  瀏覽器介面亂碼

wpsDC6B.tmp 

 

 

1.9.1  修改為英文

Internet-->常規-->語言,新增英語(美國) [en_us]”,並將其移動到第一個,再訪問em登陸介面,即可正常(英文)。

wpsDC7C.tmp 

修改後:

wpsDC7D.tmp 

 

1.9.2  EM介面顯示為英文

在實踐過程中,發現oracle em控制檯原先是中文的,選單翻譯的並不準確,不如英文的好對應管理,因此,需要修改linux系統的語言配置,將選單改為英文,查到的參考網文如下:

http://www.blogjava.net/parable-myth/archive/2006/09/27/72331.html

http://www.linuxidc.com/Linux/2008-04/12265.htm

http://www.linuxsky.org/doc/newbie/200707/84.html

http://lavasoft.blog.51cto.com/62575/155329

 

實際的配置過程比較簡單,為了減少對系統其他使用者的影響,將/etc/sysconfig下面的i18n配置檔案,拷貝到root使用者目錄下,命令是:cp /etc/sysconfig/i18n $root/.i18n

修改此檔案,LANG="en_US.UTF-8"xwindow會顯示英文介面,

經過此修改後,再重啟系統,root使用者的預設語言即為英語,開啟em控制檯也變成英文介面了。

 

1.9.3  修改字型

1.9.3.1  我試過了不行


em的亂碼是由java引起的,em的按鈕是由java生成的圖,oracle 11g使用的是jdk1.5,jdk1.5以後有了一個簡便方法來解決這個問題。
$ mkdir $ORACLE_HOME/jdk/jre/lib/fonts/fallback

把windows下的字型檔案simsun.ttc複製到$ORACLE_HOME/jdk/jre/lib/fonts/fallback目錄下 並改名 simsun.ttf(注意mssimsun字型是有版權的,所以商用換其他字型),相應的許可權改為oracle使用者可用.

之後需要清理一下Cache,重啟EM即可:
$ rm $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs/*.gif

$ emctl stop dbconsole
$ emctl start dbconsole

登陸Web頁面檢視,EM顯示就可以正常顯示中文了

 

1.9.3.2  第二種

第一步和第二步我沒找見相關的字型,但是後邊的我做完後重啟後就可以正常顯示字型了。。。

1 修改jdk 下面的字型

[oracle@dbserver db_1]$ cd $ORACLE_HOME/jdk/jre/lib/

[oracle@dbserver lib]$ mv font.properties font.properties_bak

[oracle@racdbserver  lib]$

[oracle@dbserver lib]$ cp font.properties.zh_CN.Redhat font.properties

[oracle@dbserver lib]$

2 修改jre 下面的字型

[oracle@dbserver lib]$ cd $ORACLE_HOME/jre/1.4.2/lib

[oracle@dbserver lib]$ mv font.properties font.properties_bak

[oracle@dbserver lib]$ cp font.properties.zh_CN.Redhat font.properties

3 新增簡體中文字型庫

在/usr/share/fonts目錄下建立zh_CN/TrueType目錄(如果目錄不存在時),並將zysong.ttf檔案複製到新目錄下

[oracle@dbserver lib]$ cd /usr/share/fonts;

[oracle@dbserver lib]$ mkdir -p zh_CN/TrueType;

[oracle@dbserver lib]$ cp /opt/zysong.ttf /usr/share/fonts/zh_CN/TrueType;

沒有這個檔案的話,可以到http://download.csdn.net/download/luohu_aispace/2640175下載。將zysong.ttf檔案屬主授權給oracle使用者和oinstall使用者組

[oracle@dbserver lib]$ chown -R oracle:oinstall zysong.ttf;

4 清除emcache

[oracle@dbserver lib]$ cd $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs

[oracle@dbserver zhs]$ rm *.gif

5 重新啟動em

[oracle@dbserver bin]$ cd $ORACLE_HOME/bin

[oracle@dbserver bin]$ emctl stop dbconsole

[oracle@dbserver bin]$ emctl start dbconsole

 

1.10  Linuxip地址修改後如何繼續使用EM

192.168.128.134  修改為:192.168.59.130

注意:

① 修改ip地址之後,還應該把/etc/hosts檔案中的地址也修改了

② 重新啟動linux

[oracle@rhel6_lhr ~]$ emctl status dbconsole

EM Configuration issue. /u01/app/oracle/product/11.2.0/dbhome_1/192.168.59.130_orclasm not found.

OC4J Configuration issue. /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_192.168.59.130_orclasm not found.

 

解決辦法:

第一步:

  重新配置之前需要把正在執行的OEM停掉,執行emctl stop dbconsole如果報錯,就設定下環境變數:export ORACLE_HOSTNAME=192.168.128.134,這裡的ip就是配置之前的老的ip地址。

第二步,執行:

mv  /u01/app/oracle/product/11.2.0/dbhome_1/192.168.128.134_orclasm  /u01/app/oracle/product/11.2.0/dbhome_1/192.168.59.130_orclasm

mv  /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_192.168.128.134_orclasm   /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_192.168.59.130_orclasm

 

最後還是沒有解決,還是刪掉重建吧:emca -config dbcontrol db -repos recreate 

 

 

 

1.11  其他錯誤

1.11.1  ORA-28001: the password has expired (DBD ERROR: OCISessionBegin) EM無法登入

 

 

今天開啟EM發現提示 

ORA-28001: the password has expired (DBD ERROR: OCISessionBegin)

wpsDC7E.tmp 

 

於是查詢了一下資料,密碼過期導致EM無法登入。ORACLE11G預設的口令期限是180天,為了永久解決這個問題只能修改配置檔案。

1、檢視目前資料庫中的口令期限

SYS@ orcl>select * from dba_profiles where profile='DEFAULT'
  2  and resource_name='PASSWORD_LIFE_TIME';

PROFILE                        RESOURCE_NAME                    RESOURCE         LIMIT
------------------------------ -------------------------------- ------------------------------------------------
DEFAULT                        PASSWORD_LIFE_TIME               PASSWORD    180

 

2、修改成無限制的


SYS@ orcl>alter profile default limit password_life_time unlimited;

3、檢視em的兩個賬號狀態sysmandbsnmp

SYS@ orcl>select username,account_status from dba_users;

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
TEST                           OPEN
TEST2                          OPEN
SCOTT                          OPEN
HR                             OPEN
ORACLE_OCM                     EXPIRED & LOCKED
XS$NULL                        EXPIRED & LOCKED
BI                             EXPIRED & LOCKED
PM                             EXPIRED & LOCKED
MDDATA                         EXPIRED & LOCKED
IX                             EXPIRED & LOCKED
SH                             EXPIRED & LOCKED

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
DIP                            EXPIRED & LOCKED
OE                             EXPIRED & LOCKED
APEX_PUBLIC_USER               EXPIRED & LOCKED
SPATIAL_CSW_ADMIN_USR          EXPIRED & LOCKED
SPATIAL_WFS_ADMIN_USR          EXPIRED & LOCKED
DBSNMP                         EXPIRED
SYSMAN                         EXPIRED

42個賬號都過期,於是修改密碼

SYS@ orcl>alter user dbsnmp identified by oracle;

User altered.

SYS@ orcl>alter user sysman identified by oracle;

User altered.

 

5、再重新開啟EM,能夠正常使用了。在修改密碼前我重新啟動過資料庫和EM

 

 

 

 

 

1.12  重建例子

1.12.1  Windows 下重建

命令如下
emca -config dbcontrol db -repos recreate
  ---建議重新建立

emca -config dbcontrol db -repos create

 

然後會出現以下資訊:

C:\Users\Administrator>emctl start dbconsole

Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to da

tabase unique name.

 

C:\Users\Administrator>emca -config dbcontrol db -repos recreate

 

EMCA 開始於 2012-3-12 16:28:39

EM Configuration Assistant, 11.2.0.0.2 正式版

版權所有 (c) 2003, 2005, Oracle。保留所有權利。

 

輸入以下資訊:

資料庫 SID: orcl

監聽程式埠號: 1521

監聽程式 ORACLE_HOME [ c:\app\Administrator\product\11.2.0\dbhome_1 ]:

SYS 使用者的口令:

DBSNMP 使用者的口令:

SYSMAN 使用者的口令:

SYSMAN 使用者的口令: 通知的電子郵件地址 (可選):

通知的發件 (SMTP) 伺服器 (可選):

-----------------------------------------------------------------

 

已指定以下設定

 

資料庫 ORACLE_HOME ................ c:\app\Administrator\product\11.2.0\dbhome_1

 

 

本地主機名 ................ lhr

監聽程式 ORACLE_HOME ................ c:\app\Administrator\product\11.2.0\dbhome

_1

監聽程式埠號 ................ 1521

資料庫 SID ................ orcl

通知的電子郵件地址 ...............

通知的發件 (SMTP) 伺服器 ...............

 

-----------------------------------------------------------------

是否繼續? [(Y)/(N)]: y

2012-3-12 16:31:41 oracle.sysman.emcp.EMConfig perform

資訊: 正在將此操作記錄到 c:\app\Administrator\cfgtoollogs\emca\orcl\emca_2012_03

_12_16_28_39.log

2012-3-12 16:31:44 oracle.sysman.emcp.EMReposConfig invoke

資訊: 正在刪除 EM 資料檔案庫 (此操作可能需要一段時間)...

2012-3-12 16:35:22 oracle.sysman.emcp.EMReposConfig invoke

資訊: 已成功刪除資料檔案庫

2012-3-12 16:35:23 oracle.sysman.emcp.EMReposConfig createRepository

資訊: 正在建立 EM 資料檔案庫 (此操作可能需要一段時間)...

2012-3-12 16:42:47 oracle.sysman.emcp.EMReposConfig invoke

資訊: 已成功建立資料檔案庫

2012-3-12 16:42:58 oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository

 

資訊: 正在將配置資料上載到 EM 資料檔案庫 (此操作可能需要一段時間)...

2012-3-12 16:45:05 oracle.sysman.emcp.EMReposConfig invoke

資訊: 已成功上載配置資料

2012-3-12 16:45:25 oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib

資訊: 軟體庫已配置成功。

2012-3-12 16:45:25 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary

資訊: 正在部署預配檔案...

2012-3-12 16:46:42 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary

資訊: 預配檔案部署成功。

2012-3-12 16:46:42 oracle.sysman.emcp.util.DBControlUtil secureDBConsole

資訊: 正在保護 Database Control (此操作可能需要一段時間)...

2012-3-12 16:46:56 oracle.sysman.emcp.util.DBControlUtil secureDBConsole

資訊: 已成功保護 Database Control

2012-3-12 16:46:56 oracle.sysman.emcp.util.DBControlUtil startOMS

資訊: 正在啟動 Database Control (此操作可能需要一段時間)...

2012-3-12 16:50:05 oracle.sysman.emcp.EMDBPostConfig performConfiguration

資訊: 已成功啟動 Database Control

2012-3-12 16:50:06 oracle.sysman.emcp.EMDBPostConfig performConfiguration

資訊: >>>>>>>>>>> Database Control URL https://lhr:5501/em <<<<<<<<<<<

2012-3-12 16:50:24 oracle.sysman.emcp.EMDBPostConfig invoke

警告:

************************  WARNING  ************************

 

管理資料檔案庫已置於安全模式下, 在此模式下將對 Enterprise Manager 資料進行加密。

加密金鑰已放置在檔案 c:/app/Administrator/product/11.2.0/dbhome_1/lhr_orcl/sysma

n/config/emkey.ora 中。請務必備份此檔案, 因為如果此檔案丟失, 則加密資料將不可用

 

***********************************************************

已成功完成 Enterprise Manager 的配置

EMCA 結束於 2012-3-12 16:50:24

 

C:\Users\Administrator>



方法二是自己實驗出來的,並不是一個正式的方法,但是比上一種方法簡單,易於操作。
資訊提示裡找不到一個目錄D:\oracle\product\10.1.0\db_1\oc4j\j2ee\OC4J_DBConsole_localhost_java, 到這個資訊提示的上一層目錄裡一看,可以看到有個類似的目錄, 形如OC4J_DBConsole_janes_java, 這裡janes是我的機器名,把這個目錄copy到當前目錄下,改成資訊提示裡沒有找到的目錄名,比如 我這裡就改成D:\oracle\product\10.1.0\db_1\oc4j\j2ee\OC4J_DBConsole_localhost_java

同時來到D:\oracle\product\10.1.0\db_1目錄下,可以找到一個名字形如janes_ORCL的目錄,
注意janes_ORCL這裡的janes是我的機器名,ORCL是我這裡ORacleSID,你可以根據你的具體情況,來找到類似的目錄, 同樣在當前copy到當前目錄,並改名為localhost_ORCL.

還有第三方法,不過沒有試過
有出現這樣問題的幫著試試

set ORACLE_HOSTNAME=localhost

export ORACLE_HOSTNAME=192.168.225.130

然後通過emctl start dbconsole或者服務裡的ORacleDBConsoleXXXX的服務就可以啟動了。

cmd裡輸入emctl start dbconsole後出現:

C:\Documents and Settings\Administrator>emctl start dbconsole

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

http://hexun1:1158/em/console/aboutApplication

Starting Oracle Enterprise Manager 10g Database Control ...OracleDBConsoleorcl

服務正在啟動 ...............

OracleDBConsoleorcl 服務已經啟動成功。

複製上面紅色標記的網址就可以通過瀏覽器訪問了。

 

 

 

 

 

如果還出現上述的錯誤:刪除dbconsole重新配置

 

emca  -deconfig  dbconsole  db  -repos  drop

 

如果刪除失敗,進入資料庫刪除dbconsole以前的使用者,並且修改DBSNMP密碼

 

      sql>alter user dbsnmp identified by orcl;

 

 

刪除早期DBCONSOLE建立的使用者:

 

sql>drop role MGMT_USER;

sql>drop user MGMT_VIEW cascade;

sql>drop user sysman cascade;

 

刪除早期DBCONSOLE建立的物件:

sql>drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;

sql>drop public synonym SETEMVIEWUSERCONTEXT;

 

重新建立DBCONSOLE:(如果是在windows下,要先到登錄檔刪除DBCONSOLE的服務,重啟電腦)

 

emca -config dbcontrol db -repos create

根據提示,先輸入SID,再輸入Y繼續;

輸入埠1521,輸入SYS密碼,輸入DBSNMP密碼,輸入SYSMAN 密碼,輸入Y繼續完成。

 

檢查狀態 emctl status dbconsole

 

emca -repos recreate

 

wpsDC8E.tmp 

 

 

1.12.2  Rac 下重建

[ZFXDESKDB1:oracle]:/oracle>emca -config dbcontrol db -repos  recreate  -cluster

 

STARTED EMCA at Mar 2, 2016 3:51:52 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: oraESKDB

Service name: oraESKDB

Listener port number: 1521

Listener ORACLE_HOME [ /oracle/app/11.2.0/grid ]:

Password for SYS user: 

Password for DBSNMP user: 

Password for SYSMAN user: 

Cluster name: ZFXDESKDB-cluster   ====》任意輸入一個名稱

Email address for notifications (optional):

Outgoing Mail (SMTP) server for notifications (optional):

ASM ORACLE_HOME [ /oracle/app/11.2.0/grid ]:

ASM port [ 1521 ]:

ASM username [ ASMSNMP ]:

ASM user password: 

-----------------------------------------------------------------

 

You have specified the following settings

 

Database ORACLE_HOME ................ /oracle/app/oracle/product/11.2.0/db

 

Database instance hostname ................ Listener ORACLE_HOME ................ /oracle/app/11.2.0/grid

Listener port number ................ 1521

Cluster name ................ ZFXDESKDB-cluster

Database unique name ................ oraESKDB

Email address for notifications ...............

Outgoing Mail (SMTP) server for notifications ...............

ASM ORACLE_HOME ................ /oracle/app/11.2.0/grid

ASM port ................ 1521

ASM user role ................ SYSDBA

ASM username ................ ASMSNMP

 

-----------------------------------------------------------------

----------------------------------------------------------------------

WARNING : While repository is dropped the database will be put in quiesce mode.

----------------------------------------------------------------------

Do you wish to continue? [yes(Y)/no(N)]: Y

Mar 2, 2016 3:53:22 PM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /oracle/app/oracle/cfgtoollogs/emca/oraESKDB/emca_2016_03_02_15_51_52.log.

Mar 2, 2016 3:53:26 PM oracle.sysman.emcp.EMReposConfig invoke

INFO: Dropping the EM repository (this may take a while) ...

Mar 2, 2016 3:56:23 PM oracle.sysman.emcp.EMReposConfig invoke

INFO: Repository successfully dropped

Mar 2, 2016 3:56:24 PM oracle.sysman.emcp.EMReposConfig createRepository

INFO: Creating the EM repository (this may take a while) ...

Mar 2, 2016 4:03:05 PM oracle.sysman.emcp.EMReposConfig invoke

INFO: Repository successfully created

Mar 2, 2016 4:03:13 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository

INFO: Uploading configuration data to EM repository (this may take a while) ...

Mar 2, 2016 4:04:37 PM oracle.sysman.emcp.EMReposConfig invoke

INFO: Uploaded configuration data successfully

Mar 2, 2016 4:04:38 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles

INFO: Propagating /oracle/app/oracle/product/11.2.0/db/oc4j/j2ee/OC4J_DBConsole_zfxdeskdb1_oraESKDB to remote nodes ...

Mar 2, 2016 4:04:44 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles

INFO: Propagating /oracle/app/oracle/product/11.2.0/db/oc4j/j2ee/OC4J_DBConsole_zfxdeskdb2_oraESKDB to remote nodes ...

Mar 2, 2016 4:04:53 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs

INFO: Propagating /oracle/app/oracle/product/11.2.0/db/zfxdeskdb1_oraESKDB to remote nodes ...

Mar 2, 2016 4:04:57 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs

INFO: Propagating /oracle/app/oracle/product/11.2.0/db/zfxdeskdb2_oraESKDB to remote nodes ...

Mar 2, 2016 4:05:02 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole

INFO: Securing Database Control (this may take a while) ...

Mar 2, 2016 4:05:27 PM oracle.sysman.emcp.util.DBControlUtil startOMS

INFO: Starting Database Control (this may take a while) ...

Mar 2, 2016 4:06:29 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: Database Control started successfully

Mar 2, 2016 4:06:29 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: >>>>>>>>>>> The Database Control URL is https://ZFXDESKDB1:1158/em <<<<<<<<<<<

Mar 2, 2016 4:06:33 PM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage

INFO:

****************  Current Configuration  ****************

INSTANCE            NODE           DBCONTROL_UPLOAD_HOST

----------        ----------        ---------------------

 

oraESKDB          zfxdeskdb1          ZFXDESKDB1

oraESKDB          zfxdeskdb2          ZFXDESKDB1

 

 

Mar 2, 2016 4:06:33 PM oracle.sysman.emcp.EMDBPostConfig invoke

WARNING:

************************  WARNING  ************************

 

Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /oracle/app/oracle/product/11.2.0/db/zfxdeskdb1_oraESKDB/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost.

 

***********************************************************

Enterprise Manager configuration completed successfully

FINISHED EMCA at Mar 2, 2016 4:06:33 PM

[ZFXDESKDB1:oracle]:/oracle>emctl status dbconsole

Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.

[ZFXDESKDB1:oracle]:/oracle>export ORACLE_UNQNAME=oraESKDB

[ZFXDESKDB1:oracle]:/oracle>emctl status dbconsole       

Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0

Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.

https://ZFXDESKDB1:1158/em/console/aboutApplication

Oracle Enterprise Manager 11g is running.

------------------------------------------------------------------

Logs are generated in directory /oracle/app/oracle/product/11.2.0/db/zfxdeskdb1_oraESKDB/sysman/log

 

 

1.12.2.1  Rac下建立EM2個問題

一、 監聽問題

Rac下必須配置asmscan-listener,否則配置的時候報錯:

Mar 2, 2016 11:10:11 AM 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

 

Mar 2, 2016 11:10:16 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely

WARNING: ORA-12541: TNS:no listener

 

Mar 2, 2016 11:10:17 AM 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

 

Mar 2, 2016 11:10:22 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely

WARNING: ORA-12541: TNS:no listener

 

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.

 

 

 

解決方案:

 

 

SYS@+ASM1> alter system set remote_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ZFXDESKDB-scan)(PORT=1521))))' sid='*';

 

System altered.

 

SYS@+ASM1>

SYS@+ASM1>

SYS@+ASM1> alter system register;

 

 

 

 

二、 Asmsnmp使用者密碼不對

 

Mar 2, 2016 3:41:53 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely

WARNING: ORA-01017: invalid username/password; logon denied

 

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: 

Mar 2, 2016 3:44:08 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely

WARNING: Error during db connection : ORA-01017: invalid username/password; logon denied

 

Mar 2, 2016 3:44:18 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely

WARNING: ORA-01017: invalid username/password; logon denied

 

null [ORA-01219: database not open: queries allowed on fixed tables/views only]

ASM user password: 

 

 

 

[ZFXDESKDB2:grid]:/home/grid>asmcmd

ASMCMD> lsdg

State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name

MOUNTED  EXTERN  N         512   4096  1048576    131100    72444                0           72444              0             Y  DATA/

ASMCMD> passwd sys

Enter old password (optional):

Enter new password: ******

----叢集環境下修改

ASMCMD> orapwusr --modify --password sys

Enter password: ******

ASMCMD>

 

----解決方案:

[ZFXDESKDB2:grid]:/oracle/app/11.2.0/grid/dbs>sqlplus / as sysasm

 

SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 2 15:46:27 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options

 

SQL> create user asmsnmp identified by dulala;

create user asmsnmp identified by dulala

                                  *

ERROR at line 1:

ORA-15306: ASM password file update failed on at least one node

 

 

SQL> grant sysdba to asmsnmp;

 

Grant succeeded.

 

SQL> alter user asmsnmp identified by dulala;

 

User altered.

 

SQL>

 

 



Oracle 自10g 以後,企業管理器(Oracle Enterprise ManagerOEM)變成了網頁形式。 OEM 分兩種:Grid Control(網格控制和 Database Control(資料庫控制)。 

Grid Control 是具有完整功能的全企業Oracle 生態系統管理工具。 

Database Control是可以只作為資料庫管理實用程式部署的OEM 版本。

Grid Control 和 Database Control 區別:

Grid Control 可以監控整個Oracle 生態環境,它具有一箇中心儲存倉庫,用於收集有關多個計算機上的多個目標的資料,並且提供一個介面來顯示所有已發現目標的共同資訊。

Database Control Grid Control 功能的一個子集,Database Control 只監控一個資料庫,並且不能用於監控多個資料庫。 它只在資料庫上執行。

從資料庫管理的觀點來看,兩個使用程式的功能幾乎是相同的,只不過網格控制提供了涉及多臺計算機的操作的更多功能。 大師,兩個使用程式的介面是相同的,底層程式碼也是相同的,並且只有很細微的區別。 從備份和恢復的觀點來看,兩個使用程式幾乎相等。

 

 

一. Grid Control

OEM 是一個Web 應用程式,它具有Web應用程式自帶的所有功能和限制。 OEM 控制檯是執行在HTTP伺服器上的web頁面,該HTTP伺服器將作為Grid Control 安裝的一部分安裝和配置,沒有任何客戶端安裝。

Grid Control 部署在Oracle 應用伺服器(Oracle Application ServerOAS)上。 當安裝Grid Control時,同時也會安裝OAS,然後Grid Control 應用程式作為Oracle Containers for J2EEOC4J)應用程式部署在OAS上。Grid Control 可以監控許多不同型別的目標(當Grid Control呼叫它們時): 資料庫,應用伺服器,主機自身,甚至是儲存裝置。

Grid Control 它收集遍及企業的計算系統的相關資訊,將這些資訊合併到中心儲存倉庫中,然後通過它的Web控制檯想DBA顯示這些資訊。 根據這些資訊,DBA 可以讓Grid Control 代表DBA 在這些計算系統中執行任務。

Grid Control 的體系結構

Grid Control 的體系結構從Oracle 管理服務(Oracle Management ServeiceOMS)開始,這是部署在應用伺服器上的應用程式。 OMS通過中心代理程式(central agent)從註冊的目標伺服器中收集資料。 中心代理程式安裝在目標伺服器上,它收集資訊並且將這些資料推入OMS。 OMS將資料載入到儲存倉庫資料庫中,然後根據倉庫中的資訊構建Web頁面,可以通過能夠定位OMS 伺服器URL 的任意瀏覽器檢索該Web頁面。

1. 中心代理程式

中心代理程式安裝在使用Grid Control 監控的每臺計算機上。 中心代理程式不可以獨立作出任何決策。 它使用Perl 指令碼收集資料,將這些資料通過HTTPS 推入OMS。 OMS 執行必須的任何智慧,然後將操作傳送給代理程式以執行該操作。

從儲存的觀點來看,中心代理程式佔用相對較少的儲存空間。 然而,由於其所做的工作,中心代理程式可能佔用大量的CPU資源。

2. Oracle 管理服務(OMS

OMS 是在Grid Control 體系結構的中間層上部署的Web應用程式,它不斷從代理程式處以XML檔案的形式接收資訊,然後將這些資訊載入到儲存倉庫表中。 它負責為提供控制檯Web 頁面的HTTP伺服器構建Web內容,由此可能向中心代理程式要求特定的資訊。 資料一般是從中心代理程式推入的。

3. 儲存倉庫資料庫

OMS 使用Oracle 資料庫作為它的資料來源。 儲存倉庫資料庫用於儲存有關管理目標以及Grid Control 操作(如作業或通知)的資訊。

在儲存倉庫中可以很好的利用高階的RDBMS特性;可以使用高階排隊(Advanced QueuingAQ)功能,大量使用分割槽技術,甚至是使用內部的DBMS_JOB.

二. 安裝和配置 Grid Control

根據安裝時的選擇,Grid Control的安裝過程可以有許多不同。 預設情況下,Grid Control的安裝在提供給按組昂的伺服器上建立3ORACLE_HOME目錄:OMS 目錄,儲存倉庫資料庫目錄和中心代理程式目錄。 可以選擇將儲存倉庫安裝在預先存在的資料庫中,這些資料庫位於與grid Control相同或不同的伺服器上。

如果選擇預先存在的資料庫,則必須提供主機,偵聽器埠,以及資料庫的SID。 我們也需要提供dba憑證(如SYSTEM)。 Oracle 通過安裝程式(Universal Installer)然後檢查已有的資料庫,檢視它是否具有Grid control儲存倉庫的所需的所有資料包和特性。 如果檢查通過,安裝繼續。 否則需要修改資料庫或選擇不同的選項。

10.1版本的grid Control中,預設的資料庫和OMS 位於相同的主目錄中,但是由於新增補丁和升級的原因而將它們分離到不同的主目錄中。 在 Grid Control 10.2中,3個主目錄可以分別應用補丁。 當有時間方面的考慮時,這一點非常重要。 如果存在必須通過新增補丁解決的代理程式問題,就可以關閉Grid Control伺服器上的代理程式,對代理程式ORACLE_HOME 新增補丁,同時OMS 和資料庫保持執行和操作,並且繼續監控其他已發現的伺服器。

2.1 資源考慮事項

不要將Grid Control 隨意安裝到某個位置。 如果採用預設的儲存倉庫資料庫,加上OMS 和它的底層OAS 以及以及中心代理程式,則需要使用1.5GB的儲存空間,並且這只是Grid Control 佔用的儲存空間,還沒有考慮執行在計算機上的其他內容。 因此,在安裝Grid Control之前,要確保已經在伺服器上至少有1.5GB的儲存空間。 如果沒有足夠的空間,則需要進行大量的儲存空間交換。

CPU 需求很難衡量。 這種需求取決與正在註冊和監控的多少目標,以及作業和通知的活躍程度。

2.2  Oracle 通用安裝程式

對於當前的任何Oracle 產品,其提供的安裝介面的通用安裝程式都是相同的。 通用安裝程式是一個嚮導驅動的過程,它請求你定製安裝的相關過程,且執行任意數量的系統檢查以新增這些資訊,這些系統檢查可實際地確認使用者請求的安裝過程是否可行。

Oracle Grid Control 的下載地址:http://www.oracle.com/technology/software/products/oem/index.html

要先下載第一個版本的,比如:10.2.0.1, 安裝之後在升級到其他版本,如10.2.0.5.

如果之前有安裝的話,在安裝之前要把之前的安裝解除安裝乾淨不然可能會報錯。

通過安裝程式首先詢問要安裝哪些內容。 有4個選項: 

Enterprise Manager 10g Grid Control Using a new Database

Using an Existing Database

Additional Management Service

Additional Management Agent

2.2.1 在新資料庫中安裝儲存倉庫

安裝程式會構建3ORACLE_HOME

(1)db10g: 儲存Oracle 資料庫中預先構建的儲存倉庫

(2)Oms10g:儲存Oracle應用伺服器

(3)Agent10g:儲存中心代理程式

2.2.2 在已有的資料庫中安裝儲存倉庫

如果希望使用自己的資料庫,需要滿足一下需求:

(1) SGA_TARGET 必須大於272MB.

(2) AQ_TM_PROCESSES 必須大於等於1.

(3) session_cached_cursors 引數值必須大於200

(4) 必須安裝dbms_shared_pool, 安裝方法是用sys使用者執行如下指令碼:

  ORACLE_HOME/rdbms/admin/dbmspool.sql

  ORACLE_HOME/rdbms/admin/prvtpool.plb

注意: Grid Control 儲存倉庫不可以與具有Database Control 儲存倉庫的系統共存(因為兩者都需要以SYSMAN模式存在)。因此如果嘗試使用已經被Database Control 監控的資料庫,則需要刪除SYSMAN使用者,或者由通用安裝程式來執行這項工作。

2.3 配置助手

安裝軟體後,通用程式會執行多個配置助手,這些助手會執行一系列配置操作以協調所有軟體的執行。 配置助手程式分為3個程式段以匹配3Oracle 主目錄: 首先是資料庫配置,其次是OMS 配置,最後是代理程式配置。 

總之,如果運氣好的話,就不需要了解關於這些助手的很多內容。 大多數助手都關注於配置和部署作為OMS OC4J應用程式。 如果任何時候產生故障,installActions.logORACLE_BASE/LOGS目錄下)中有大量可提供的資訊。

如果無法配置助手,可以在CliffsNotes中做如下工作:

 (1)確保沒有略過先決條件警告。

 (2)為了保險起見,重新嘗試配置助手。

 (3)確保具有足夠的儲存空間(>512MB

 (4)拋棄所有內容並再次嘗試。

2.4 安裝中心代理程式

安裝完Grid Control軟體並且啟動和執行OMS後,就可以準備開始監控企業中已有的目標。當然,一般必須現在希望被OEM 管理的所有計算機上安裝OEM 代理程式。

中心代理程式是獨立安裝的軟體,用於傳遞資訊給OMS 以及從OMS處接收命令。 中心代理程式必須安裝在所有要監控的目標主機的專用ORACLE_HOME目錄中。 安裝中心代理程式有兩種方法:一是用Grid Control 軟體來安裝(最後一個選項),二是使用OMS 功能來將代理程式推到不同的伺服器上。

Grid Control 安裝比較直觀。 它要求提供OMS 伺服器的主機名和埠。 預設情況下,上傳HTTP 埠與Grid Control 控制檯的埠相同:4889. 另外,我們也需要輸入代理程式註冊口令: 這是在Grid Control安裝期間提供的口令,代理程式需要使用該口令來驗證是否可以作為特定的OMS的有效資料來源。

在其他伺服器上安裝代理之後,查詢代理狀態:

C:/Documents and Settings/Administrator.HFCC-IT-176613>emctl status agent

Oracle Enterprise Manager 10g Release 10.2.0.2.0.

Copyright (c) 1996, 2006 Oracle Corporation.  All rights reserved.

---------------------------------------------------------------

Agent Version     : 10.2.0.2.0

OMS Version       : 10.2.0.2.0

Protocol Version  : 10.2.0.2.0

Agent Home        : F:/OracleHomes/agent10g

Agent binaries    : F:/OracleHomes/agent10g

Agent Process ID  : 4684

Agent URL         : https://HFCC-IT-176613:3872/emd/main/   --- 輸入該網址能看到agent is working

Repository URL    : https://HFCC-KF-111111:1159/em/upload   --- 在代理伺服器上更新資料的

Started at        : 2010-06-30 13:09:16

Started by user   : SYSTEM

Last Reload       : 2010-06-30 13:09:16

Last successful upload                       : (none)

Last attempted upload                        : (none)

Total Megabytes of XML files uploaded so far :     0.00

Number of XML files pending upload           :       11

Size of XML files pending upload(MB)         :     4.46

Available disk space on upload filesystem    :    34.45%

Last attempted heartbeat to OMS              : 2010-06-30 13:15:23

Last successful heartbeat to OMS             : unknown

---------------------------------------------------------------

Agent is Running and Ready

注意:我們需要在伺服器的端的IE裡輸入:https://HFCC-KF-111111:1159/em/upload

然後伺服器會和客戶端進行更新。更新完之後,就可以在伺服器端的目錄裡看到其他的資料庫了。

C:/Documents and Settings/Administrator.HFCC-IT-176613>emctl status agent

Oracle Enterprise Manager 10g Release 10.2.0.2.0.

Copyright (c) 1996, 2006 Oracle Corporation.  All rights reserved.

---------------------------------------------------------------

Agent Version     : 10.2.0.2.0

OMS Version       : 10.2.0.2.0

Protocol Version  : 10.2.0.2.0

Agent Home        : F:/OracleHomes/agent10g

Agent binaries    : F:/OracleHomes/agent10g

Agent Process ID  : 4684

Agent URL         : https://HFCC-IT-176613:3872/emd/main/

Repository URL    : https://HFCC-KF-111111:1159/em/upload

Started at        : 2010-06-30 13:09:16

Started by user   : SYSTEM

Last Reload       : 2010-06-30 13:09:16

Last successful upload                       : 2010-06-30 13:24:30

Total Megabytes of XML files uploaded so far :     4.48

Number of XML files pending upload           :        0

Size of XML files pending upload(MB)         :     0.00

Available disk space on upload filesystem    :    34.46%

Last successful heartbeat to OMS             : 2010-06-30 13:24:16

---------------------------------------------------------------

Agent is Running and Ready

2.5  啟動和停止所有Grid Control 元件 示例

 

2.5.1 停止順序

-- 停止中心代理程式

$ORACLE_HOME/bin/emctl stop agent

-- 停止OMS

$ORACLE_HOME/bin/emctl stop oms

-- 停止程式管理器

    $ORACLE_HOME/bin/opmnctl stopall

-- 停止儲存倉庫資料庫

Export ORACLE_SID=SID

Sqlplus /nolog

Shutdown immediate

-- 停止監聽程式

Lsnrctl stop

2.5.2 啟動順序

-- 啟動監聽

Lsnrctl start

-- 啟動儲存倉庫資料庫

Export ORACLE_SID=SID

Sqlplus /nolog

Startup

-- 啟動OMS

$ORACLE_HOME/bin/emctl start oms

-- 啟動中心代理程式

$ORACLE_HOME/bin/emctl start agent

 

 

三. Database Control

Database Control 是Grid Control功能的一個子集,它只管理和監控一個資料庫。Database Control 的功能是以資料庫為中心,但又不完全限於資料庫。由於會有一些為資料庫所在的伺服器收集的主機統計資訊,因此主機(並非單獨的“目標”)有一些報告資訊。 此外,可以配置Database Control 以監控和管理自動儲存管理(ASM)例項,目標資料庫可以使用該ASM例項進行儲存。

也可以配置Database Control以監控RAC 資料庫。由此監控多個主機,多個例項和多個ASM例項。當然,它只可以監控一個資料庫,因此Database Control的限制仍然是相同的。

3.1  Database Control的體系結構

Database Control 的體系結構非常類似與Grid Control的體系結構,但規模要小很多。 中心代理程式和OMS 合併到相同的OC4J應用程式,並且儲存倉庫駐留在目標資料庫本身中。

Database Control的儲存倉庫位於它監控的目標資料庫中,因此,如果目標資料庫停機,Database Control就不能正常執行,除非啟動該資料庫。 在Windows系統上,Database Control程式是單獨的程式,並且作為Services控制皮膚中單獨的服務啟動和停止。 在Linux 和 unix上,dbconsole作為單獨的應用程式被停止和啟動,但它仍然會產生單獨的代理程式和Java程式。

Database Control與RDBMS 一起安裝,並且它所在的ORACLE_HOME 目錄與其目標資料庫的相同。 在為資料庫配置dbconsole 後,就會在ORACLE_HOME中建立名為host_sid的新子目錄,其中host是計算機名,而sid是鎖監控的例項的SID. 例如:服務名為DavidDai,監控的資料庫為orcl, 則配置檔案在$ORACLE_HOME/DavidDai_orcl中。

RAC 環境中,一般根據叢集中的每個節點命名多個目錄,後面跟上RAC 資料庫的globalname. 因此,如果有2個節點的RAC叢集,兩個節點分別為RAC1和 RAC2,並且資料庫例項為orcl,則在每個節點的RDBMS主目錄上有兩個目錄ORACLE_HOME/RAC1_orcl 和 ORACLE_HOME/RAC2_orcl. 在每個節點上,只有名稱與節點對應的目錄才會實際地擁有檔案,而另一個目錄則為空。 這種約定在RAC叢集共享同一個位於共享驅動器上的$ORACLE_HOME軟體樹時也適用。

Database Control的啟動和關閉命令:

Emctl start dbconsole

Emctl stop dbconsole

 

 

四. 安裝和配置Database Control

Database Control 軟體不需要進行任何特定的安裝。 Database Control 預設與已有的RDBMS一起安裝。 實際上,在安裝例項時,會有個選項,是否配置Database Enterprise Manager. 選擇後就自動安裝了。

4.1 使用資料庫配置助手配置Database Control

如果在安裝例項的時候沒有安裝Database Control,那麼我們也可以用Database configuration Assistant: DBCA 來配置。開啟dbca後,有個配置資料庫選項,在這裡面就能新增Database Control

注意,dbca 不可以用於刪除或者修改已經新增的Database Control,它只是一個用於新增Database Control的工具。 如果要刪除Database Control,則需要使用命令列工具: emca.

4.2 使用企業管理器配置助手配置 Database Control

企業管理器配置助手(Enterprise Manager Configuration Assistant: emca) 的用法不是很直觀,但是功能比較強大。

執行一條命令後,emca 以一種互動的模式提示以下資訊: 配置資料庫SID,連線emca與資料庫的監聽器埠,以及所需的使用者口令。

4.2.1 使用emca 刪除已有的dbcontrol 配置 和 dbconsole 儲存倉庫

Emca -deconfig dbcontrol db -repos drop

C:/Documents and Settings/user.HQ-TEXT>emca -deconfig dbcontrol db -repos drop

EMCA 開始於 2010-6-30 9:37:00

EM Configuration Assistant 10.2.0.1.0 正式版

版權所有 (c) 2003, 2005, Oracle。保留所有權利。

輸入以下資訊:

資料庫 SID: dave

監聽程式埠號: 1521

SYS 使用者的口令:

SYSMAN 使用者的口令:

是否繼續? [yes(Y)/no(N)]: yes

2010-6-30 9:37:15 oracle.sysman.emcp.EMConfig perform

資訊正在將此操作記錄到 D:/oracle/product/10.2.0/db_1/cfgtoollogs/emca/dave/emc

a_2010-06-30_09-37-00-上午.log

2010-6-30 9:37:18 oracle.sysman.emcp.util.DBControlUtil stopOMS

資訊正在停止 Database Control (此操作可能需要一段時間)...

2010-6-30 9:38:02 oracle.sysman.emcp.EMReposConfig dropRepository

資訊正在刪除 EM 資料檔案庫 (此操作可能需要一段時間)...

2010-6-30 9:38:03 oracle.sysman.emcp.EMReposConfig invoke

資訊已成功刪除資料檔案庫

已成功完成 Enterprise Manager 的配置

EMCA 結束於 2010-6-30 9:38:04

4.2.2 使用emca 為資料庫建立新的dbcontrol 配置

Emca -config dbcontrol db -repos create

C:/Documents and Settings/user.HQ-TEXT>emca -config dbcontrol db -repos create

EMCA 開始於 2010-6-30 9:44:01

EM Configuration Assistant 10.2.0.1.0 正式版

版權所有 (c) 2003, 2005, Oracle。保留所有權利。

輸入以下資訊:

資料庫 SID: dave

監聽程式埠號: 1521

SYS 使用者的口令:

DBSNMP 使用者的口令:

SYSMAN 使用者的口令:

通知的電子郵件地址 (可選):

通知的發件 (SMTP) 伺服器 (可選):

-----------------------------------------------------------------

已指定以下設定

資料庫 ORACLE_HOME ................ D:/oracle/product/10.2.0/db_1

資料庫主機名 ................ HFCC-KF-111111

監聽程式埠號 ................ 1521

資料庫 SID ................ dave

通知的電子郵件地址 ...............

通知的發件 (SMTP) 伺服器 ...............

-----------------------------------------------------------------

是否繼續? [yes(Y)/no(N)]: yes

2010-6-30 9:44:23 oracle.sysman.emcp.EMConfig perform

資訊正在將此操作記錄到 D:/oracle/product/10.2.0/db_1/cfgtoollogs/emca/dave/emc

a_2010-06-30_09-44-01-上午.log

2010-6-30 9:44:32 oracle.sysman.emcp.EMReposConfig createRepository

資訊正在建立 EM 資料檔案庫 (此操作可能需要一段時間)...

2010-6-30 9:46:18 oracle.sysman.emcp.EMReposConfig invoke

資訊已成功建立資料檔案庫

2010-6-30 9:46:23 oracle.sysman.emcp.util.DBControlUtil startOMS

資訊正在啟動 Database Control (此操作可能需要一段時間)...

2010-6-30 9:47:04 oracle.sysman.emcp.EMDBPostConfig performConfiguration

資訊已成功啟動 Database Control

2010-6-30 9:47:04 oracle.sysman.emcp.EMDBPostConfig performConfiguration

警告無法建立 Database Control 快捷方式

2010-6-30 9:47:04 oracle.sysman.emcp.EMDBPostConfig performConfiguration

資訊: >>>>>>>>>>> Database Control URL 為 http://HFCC-KF-111111:5500/em <<<<<<<<

<<<

已成功完成 Enterprise Manager 的配置

EMCA 結束於 2010-6-30 9:47:04

Oracle OEM 重建

http://blog.csdn.net/tianlesoftware/archive/2009/10/21/4702978.aspx

4.3  emca 命令幫助

    C:/Users/Administrator.DavidDai>emca help

D:/app/Administrator/product/11.2.0/dbhome_1/bin/emca.bat [操作] [模式] [資料庫

型別] [標記] [引數]

-h | --h | -help | --help: 列印此幫助訊息

-version: 列印版本

-config dbcontrol db [-repos (create | recreate)] [-cluster] [-silent] [-backup]

 [引數]: 配置資料庫的 Database Control

-config centralAgent (db | asm) [-cluster] [-silent] [引數]: 配置中心代理管理

-config all db [-repos (create | recreate)] [-cluster] [-silent] [-backup] [引數

]: 配置 Database Control 和中心代理管理

-deconfig dbcontrol db [-repos drop] [-cluster] [-silent] [引數]: 取消配置 Datab

ase Control

-deconfig centralAgent (db | asm) [-cluster] [ -silent] [引數]: 取消配置中心代理

管理

-deconfig all db [-repos drop] [-cluster] [-silent] [引數]: 取消配置 Database Co

ntrol 和中心代理管理

-addNode (db | asm) [-silent] [引數]: 配置資料庫的新新增節點的 EM

-deleteNode (db | asm) [-silent] [引數]: 取消為資料庫 (位於要刪除的節點上配置

EM

-addInst (db | asm) [-silent] [引數]: 為新的 RAC 例項配置 EM

-deleteInst (db | asm) [-silent] [引數]: 取消為指定的 RAC 例項配置 EM

-reconfig ports [-cluster] [引數]: 重新明確分配 Database Control 

-reconfig dbcontrol -cluster [-silent] [引數]: 重新配置 RAC Database Control 

-displayConfig dbcontrol -cluster [-silent] [引數]: 顯示有關 RAC Database Contro

l 配置的資訊

-migrate -from dbcontrol -to centralAgent  [-repos drop] [-cluster] [-silent] [

引數]: 將 EM 配置從 Database Control 移植到中心代理

-upgrade (db | asm | db_asm) [-cluster] [-silent] [引數]: 將較低版本的 EM 配置升

級到當前版本

-updateTargets crs [-silent] [引數]: 更新 CRS 升級時所有 dbcontrol 和中心代理的

新 CRS 主目錄

-restore (db | asm | db_asm) [-cluster] [-silent] [引數]: 將當前版本的 EM 配置還

原到較低版本

引數和選項:

[引數]: [ -respFile fileName ] [ -paramName paramValue ]*

db: 對資料庫 (包括使用 ASM 的資料庫執行配置操作

asm: 僅對 ASM 例項執行配置操作

db_asm: 對資料庫和 ASM 例項執行升級/還原操作

-repos create: 建立新的 Database Control 資料檔案庫

-repos drop: 刪除當前的 Database Control 資料檔案庫

-repos recreate: 刪除當前的 Database Control 資料檔案庫並重新建立一個

-cluster: 對 RAC 資料庫執行配置操作

-silent: 在不提示引數的情況下執行配置操作

-backup: 配置資料庫的自動備份

單例項資料庫的引數

        ORACLE_HOSTNAME: 本地主機名

        SID: 資料庫 SID

        PORT: 監聽程式埠號

        ORACLE_HOME: 資料庫 ORACLE_HOME

        LISTENER_OH: 監聽程式 ORACLE_HOME

        HOST_USER: 自動備份的主機使用者名稱

        HOST_USER_PWD: 自動備份的主機使用者口令

        BACKUP_SCHEDULE: 自動備份排程 (HH:MM)

        EMAIL_ADDRESS: 通知的電子郵件地址

        MAIL_SERVER_NAME: 通知的發件 (SMTP) 伺服器

        ASM_OH: ASM ORACLE_HOME

        ASM_SID: ASM SID

        ASM_PORT: ASM 埠

        ASM_USER_ROLE: ASM 使用者角色

        ASM_USER_NAME: ASM 使用者名稱

        ASM_USER_PWD: ASM 使用者口令

        SRC_OH: 要升級的資料庫的 ORACLE_HOME

        DBSNMP_PWD: DBSNMP 使用者的口令

        SYSMAN_PWD: SYSMAN 使用者的口令

        SYS_PWD: SYS 使用者的口令

        DBCONTROL_HTTP_PORT: Database Control HTTP 埠

        AGENT_PORT: EM 代理埠

        RMI_PORT: Database Control 的 RMI 

        JMS_PORT: Database Control 的 JMS 

        EM_SWLIB_STAGE_LOC:  軟體庫位置

        PORTS_FILE: 用於指定要使用的埠的靜態檔案的路徑 (預設值: ${ORACLE_HOME}

/install/staticports.ini)。

叢集資料庫的其他引數

        CLUSTER_NAME: 叢集名

        DB_UNIQUE_NAME: 資料庫的唯一名稱

        SERVICE_NAME: 服務名

        EM_NODE: Database Control 節點名

        EM_NODE_LIST: 代理節點列表 [以逗號分隔]

Note: For Desktop Class Install always pass parameter ORACLE_HOSTNAME

      as "localhost" to any emca command

 

OEM 裡面的東西,開啟IE,自己研究下就ok

http://ip:port/em

https://ip:port/em

如: https://10.85.10.80:1158/em

這個埠可以在$ORACLE_HOME/instll/portlist.ini 檔案裡檢視。




About Me

...............................................................................................................................

● 本文作者:小麥苗,只專注於資料庫的技術,更注重技術的運用

● 本文在itpub(http://blog.itpub.net/26736162)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新

● 本文itpub地址:http://blog.itpub.net/26736162/viewspace-2029565/

● 本文部落格園地址:http://www.cnblogs.com/lhrbest

● 本文pdf版及小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● 資料庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/

● QQ群:230161599     微信群:私聊

● 聯絡我請加QQ好友(646634621),註明新增緣由

● 於 2016-03-03 10:00~ 2016-03-03 19:00 在魔都完成

● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

● 版權所有,歡迎分享本文,轉載請保留出處

...............................................................................................................................

拿起手機使用微信客戶端掃描下邊的左邊圖片來關注小麥苗的微信公眾號:xiaomaimiaolhr,掃描右邊的二維碼加入小麥苗的QQ群,學習最實用的資料庫技術。

【OEM】OEM安裝維護
DBA筆試面試講解
歡迎與我聯絡

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

相關文章