Oracle 11.2.0.4 RAC重建EM案例

时间:2022-06-13 15:32:58

环境:Oracle 11.2.0.4 RAC 重建EM

背景:客户之前的EM已经被损坏,需要重建EM

重建EM的方案有很多,其中最简单的方法是:直接使用emca重建,oracle用户下,只需一条命令搞定:

emca -config dbcontrol db -repos recreate -cluster

注意:之前需要先确认是否有正在运行的job:

SQL> select * from DBA_JOBS_RUNNING;

在测试中通过观察数据库的alert日志:

Tue Jan 15 12:10:55 2019
ALTER SYSTEM SET job_queue_processes=0 SCOPE=BOTH SID='*';
...
Tue Jan 15 12:16:50 2019
ALTER SYSTEM SET job_queue_processes=1000 SCOPE=BOTH SID='*';

以及对应emca操作显示的日志:

Jan 15, 2019 12:10:47 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Jan 15, 2019 12:16:59 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped

可以看到在删除em资料库的时候,会将job_queue_processes参数修改为0,测试该阶段大概需要6分钟,期间job无法运行(如果期间没有job需要运行,就对业务无影响)。整个过程中,数据库均可以正常连接,特别注意下面这个提示:

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

看到这个警告很唬人,但实际确认,在11.2版本中可以忽略这个警告,因为测试发现,整个过程中数据库都不会置为静默状态,具体参见MOS文档说明:

  • How To Drop, Create And Recreate Database Control (dbconsole) Web Site in Releases 10g and 11g (文档 ID 278100.1)

IMPORTANT: When dropping the repository with EMCA or RepManager on an 11.2 database, this warning will be displayed:

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

This warning can be safely ignored (only on 11.2 databases).

可以看到MOS也说在11.2版本可以忽略这个警告。

重建完成,可以查看EM的状态:

[oracle@db50 ~]$ export ORACLE_UNQNAME=jyzhao
[oracle@db50 ~]$ 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://db50:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /opt/app/oracle/product/11.2.0/dbhome_1/db50_jyzhao/sysman/log

附:记录一次测试环境中重建EM的完整日志:

[oracle@db50 ~]$ emca -config dbcontrol db -repos recreate -cluster

STARTED EMCA at Jan 15, 2019 10:52:04 AM
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: jyzhao
Service name: jyzhao
Listener port number: 1521
Listener ORACLE_HOME [ /opt/app/11.2.0/grid ]:
Password for SYS user: ra
Password for DBSNMP user:
Password for SYSMAN user:
Cluster name: db-cluster
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
ASM ORACLE_HOME [ /opt/app/11.2.0/grid ]:
ASM port [ 1521 ]:
ASM username [ ASMSNMP ]:
ASM user password:
----------------------------------------------------------------- You have specified the following settings Database ORACLE_HOME ................ /opt/app/oracle/product/11.2.0/dbhome_1 Database instance hostname ................ Listener ORACLE_HOME ................ /opt/app/11.2.0/grid
Listener port number ................ 1521
Cluster name ................ db-cluster
Database unique name ................ jyzhao
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
ASM ORACLE_HOME ................ /opt/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
Jan 15, 2019 10:54:03 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /opt/app/oracle/cfgtoollogs/emca/jyzhao/emca_2019_01_15_10_52_04.log.
Jan 15, 2019 10:54:07 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Jan 15, 2019 11:00:30 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Jan 15, 2019 11:00:31 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Jan 15, 2019 11:13:58 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Jan 15, 2019 11:14:13 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Jan 15, 2019 11:15:45 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Jan 15, 2019 11:15:46 AM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /opt/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_db50_jyzhao to remote nodes ...
Jan 15, 2019 11:15:49 AM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /opt/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_db52_jyzhao to remote nodes ...
Jan 15, 2019 11:15:55 AM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /opt/app/oracle/product/11.2.0/dbhome_1/db50_jyzhao to remote nodes ...
Jan 15, 2019 11:15:57 AM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /opt/app/oracle/product/11.2.0/dbhome_1/db52_jyzhao to remote nodes ...
Jan 15, 2019 11:16:00 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Jan 15, 2019 11:16:31 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Jan 15, 2019 11:18:30 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Jan 15, 2019 11:18:30 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://db50:1158/em <<<<<<<<<<<
Jan 15, 2019 11:18:49 AM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage
INFO:
**************** Current Configuration ****************
INSTANCE NODE DBCONTROL_UPLOAD_HOST
---------- ---------- --------------------- jyzhao db50 db50
jyzhao db52 db50 Jan 15, 2019 11:18:49 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: /opt/app/oracle/product/11.2.0/dbhome_1/db50_jyzhao/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 Jan 15, 2019 11:18:49 AM
[oracle@db50 ~]$