oralce 11g OEM组件及相関概念请参考dave大神的一片博文http://blog.csdn.net/tianlesoftware/article/details/5704374。
由于公司生产环境是前辈搭建的,当时在安装的时候没有搭建OEM,最近领导要看报表,所以想着基于生产环境搭建一套OEM好应付差事。
准备工作:
1、配置db_unqname
2、配置ORACLE_HOST_NAME,双节点都需要配置,并且ORACLE_HOSTNAME在/etc/hosts有定义
3、设置ssh对等性
4、配置sys,sysman,dbsnmp用户及密码
5、确保service_name或者SID正常注册到监听
6、确定集群名称
一般部署流程:
查看dbconsole状态
oracle@rac1 emctl status dbconsole
OC4J Configuration issue. /home/u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_server2_ghsjdb not found.
查看集群名:
grid@rac2:/home/grid>$ORACLE_HOME/bin/cemutlo -n
rac-cluster
删除之前的配置:
oracle@rac1:/home/oracle>emca -deconfig dbcontrol db -repos drop -cluster
配置11gR2 RC OEM:
oracle@rac1:/home/oracle>emca -config dbcontrol db -repos create -cluster
OEM常用的命令
(1)创建一个EM资料库
emca -repos create
(2)重建一个EM资料库
emca -repos recreate
(3)删除一个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 -reconfig ports -agent_port 3940
(7)先设置ORACLE_SID环境变量后,启动EM console服务
emctl start dbconsole
(8)先设置ORACLE_SID环境变量后,停止EM console服务
emctl stopd bconsole
(9)先设置ORACLE_SID环境变量后,查看EM console服务的状态
emctl status dbconsole
(10)配置dbconsole的步骤
emca -repos create
emca -config dbcontrol db
emctl start dbconsole
(11)重新配置dbconsole的步骤
emca -repos drop
emca -repos create
emca -config dbcontrol db
emctl start dbconsole
问题1:
oracle.ops.mgmt.cluster.ClusterInfoException: PRKC-PRKC-1044 : Failed to check remote command execution setup for node jhdb02 using shells /usr/bin/ssh and /usr/bin/rsh
File "/usr/bin/rsh" does not exist on node "jhdb02"
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). : <null>
at oracle.ops.mgmt.cluster.ClusterInfo.getHostName(ClusterInfo.java:413)
at oracle.ops.mgmt.cluster.ClusterInfo.getHostName(ClusterInfo.java:381)
从提示来看,权限不对,使用rsh,ssh登录 jhdb02没有权限,自己尝试了下,ssh对等性验证失败,应为在部署RAC OEM的时候需要收集两个节点的信息
,所以需要配置ssh对等性。
设置ssh对等性,可以直接使用oracle提供的脚本/home/oralce/database/sshsetup/sshUserSetup.sh
jhdb02-> emca -config dbcontrol db -repos create -cluster
STARTED EMCA at Sep 21, 2017 4:26:55 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: jhdb
Service name: jhdb
Listener port number: 1521
Listener ORACLE_HOME [ /u01/app/11.2.0/grid ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Cluster name: jhdbcluster
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
ASM ORACLE_HOME [ /u01/app/11.2.0/grid ]:
ASM port [ 1521 ]:
ASM username [ ASMSNMP ]:
ASM user password:
ASM user password: Sep 21, 2017 4:28:15 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
-----------------------------------------------------------------
You have specified the following settings
Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1
Database instance hostname ................ Listener ORACLE_HOME ................ /u01/app/11.2.0/grid
Listener port number ................ 1521
Cluster name ................ jhdbcluster
Database unique name ................ jhdb
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
ASM ORACLE_HOME ................ /u01/app/11.2.0/grid
ASM port ................ 1521
ASM user role ................ SYSDBA
ASM username ................ ASMSNMP
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: yes
Sep 21, 2017 4:28:23 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/jhdb/emca_2017_09_21_16_26_55.log.
Sep 21, 2017 4:28:27 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Sep 21, 2017 4:32:49 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Sep 21, 2017 4:32:53 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Sep 21, 2017 4:33:50 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Sep 21, 2017 4:33:50 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_jhdb01_jhdb to remote nodes ...
Sep 21, 2017 4:33:53 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_jhdb02_jhdb to remote nodes ...
Sep 21, 2017 4:33:58 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /u01/app/oracle/product/11.2.0/db_1/jhdb01_jhdb to remote nodes ...
Sep 21, 2017 4:34:02 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /u01/app/oracle/product/11.2.0/db_1/jhdb02_jhdb to remote nodes ...
Sep 21, 2017 4:34:07 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Sep 21, 2017 4:34:33 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 21, 2017 4:34:58 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Sep 21, 2017 4:34:58 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://jhdb02:1158/em <<<<<<<<<<<
Sep 21, 2017 4:35:01 PM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage
INFO:
**************** Current Configuration ****************
INSTANCE NODE DBCONTROL_UPLOAD_HOST
---------- ---------- ---------------------
jhdb jhdb01 jhdb02
jhdb jhdb02 jhdb02
Sep 21, 2017 4:35:01 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: /u01/app/oracle/product/11.2.0/db_1/jhdb02_jhdb/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 Sep 21, 2017 4:35:01 PM
至此OEM创建完成。
但是过了一段时间发现OEM登录不上,决定重建OEM,为了投方便直接执行:
SQL > alter user syssnmp identified by oracle123 account unlock;
jhdb02-> emca -config dbcontrol db -repos recreate -cluster