ORACLE 11R2 RAC EM 安装日记

来源:互联网 发布:玄界之门 知乎 编辑:程序博客网 时间:2024/05/16 06:55

解决问题列表
1 Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.
2 EM安装完成后仍启动failed.(TZ时区问题)

ORACLE环境说明

1) ORACLE版本

sys@HORACLED> select * from v$version;
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

2) RAC两个结点:

HOSTNAME         SID         SERVICE_NAME

   vmydb1         HoracleD1      HoraceDB

  vmydb2         HoracleD2      HoraceDB

3) host文件

[oracle@vmydb1 log]$ view /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.65.231   vmydb1   vmydb1.oracle.com
192.168.65.232  vmydb1-vip

192.168.65.233   vmydb2   vmydb2.oracle.com
192.168.65.234   vmydb2-vip

#scan ip
192.168.65.236   vmydb-cluster vmydb-cluster-scan

172.168.1.18   vmydb1-priv
172.168.1.19   vmydb2-priv

日记正文

记得之前安装库时,已选择安装OEM了,以为启动即可以,可是当尝试在vmydb1启动EM时,
[oracle@vmydb1 log]$ emctl start dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.
于是尝试设置ORACLE_UNQNAME,export ORACLE_UNQNAME=HoracleDB;
继续尝试:
[oracle@vmydb1 ~]$ emctl status dbconsole
OC4J Configuration issue. /s01/oracle/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_vmydb1_HoracleDB not found.
进入/s01/oracle/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee目录查看:
[oracle@vmydb1 j2ee]$ ls -lrt
total 28
drwxr-xr-x  5 oracle oinstall 4096 Apr 22 12:49 OC4J_Workflow_Component_Container
drwxr-x---  6 oracle oinstall 4096 Apr 22 12:49 OC4J_DBConsole
drwxr-xr-x  5 oracle oinstall 4096 Apr 22 12:49 OC4J_Workflow_Management_Container
drwxr-xr-x  3 oracle oinstall 4096 Apr 22 12:49 oc4j_applications
drwxr-xr-x  2 oracle oinstall 4096 Apr 22 12:58 utilities
drwxr-xr-x 14 oracle oinstall 4096 Apr 22 12:58 home
-rw-r--r--  1 oracle oinstall 1027 Apr 22 13:11 deploy_db_wf.ini
的确不存在指定目录OC4J_DBConsole_vmydb1_HoracleDB,故需重建EM;
RAC OEM与单结点的重建方法有所区别,RAC EM的重建方法可参考网上链接http://luoping.blog.51cto.com/534596/1053873。
由于OEM使用LISTENER_SCAN1进行监听,故需保证两个结点的ASM 实例有在LISTENER_SCAN1上注册;
于是,切换至grid用户进行检查:
[grid@vmydb1 ~]$ lsnrctl status listener_scan1
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 10-5月 -2014 21:49:51
Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                10-5月 -2014 16:37:40
Uptime                    0 days 2 hr. 12 min. 21 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /g01/11ggrid/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /g01/11ggrid/app/11.2.0/grid/log/diag/tnslsnr/vmydb1/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.65.236)(PORT=1521)))
Services Summary...
Service "HoracleDB" has 2 instance(s).
  Instance "HoracleD1", status READY, has 1 handler(s) for this service...
  Instance "HoracleD2", status READY, has 1 handler(s) for this service...
The command completed successfully

[grid@vmydb1 ~]$ lsnrctl status listner
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 10-5月 -2014 21:50:44
Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                10-5月 -2014 16:37:59
Uptime                    0 days 2 hr. 12 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /g01/11ggrid/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /g01/orabase/diag/tnslsnr/vmydb1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.65.231)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.65.232)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "HoracleDB" has 1 instance(s).
  Instance "HoracleD1", status READY, has 1 handler(s) for this service...
The command completed successfully
由上可见,ASM实例仅注册于listener,而没有注册于listener_scan1,故需通过设置remote_listner参数进行手动注册:
 首先,检查remote_listenr是否为空:
[grid@vmydb1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on 星期六 5月 10 22:08:52 2014
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> show parameter remote
NAME                                 TYPE                                       
VALUE
------------------------------------ ---------------------------------------------------------------
remote_listener                      string
remote_login_passwordfile            string                         EXCLUSIVE
remote_os_authent                    boolean                        FALSE
remote_os_roles                      boolean                          FALSE
证实remot_listner为空,接着:
SQL> alter system set remote_listener='vmydb-cluster-scan:1521' scope=both sid='*';
System altered.
SQL> alter system register;

System altered.
此时remote_listener已设置为scan-ip相对应的listener,已成功将ASM实例注册于listener_scan1。
现在,可切换至oracle系统用户,开始重建EM,

[oracle@vmydb1 ~]$ emca -config dbcontrol db -repos recreate -cluster
STARTED EMCA at May 10, 2014 10:17:11 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: HoracleDB
Service name: HoracleDB
Listener port number: 1521
Listener ORACLE_HOME [ /g01/11ggrid/app/11.2.0/grid ]:
Password for SYS user: 
Password for DBSNMP user: 
May 10, 2014 10:17:56 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: Error during db connection : ORA-28000: the account is locked

May 10, 2014 10:18:02 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: ORA-28000: the account is locked
Password for SYSMAN user: 
Cluster name: Horacle_cluster
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
ASM ORACLE_HOME [ /g01/11ggrid/app/11.2.0/grid ]:
ASM port [ 1521 ]:
ASM username [ ASMSNMP ]:
ASM user password: 
-----------------------------------------------------------------
You have specified the following settings
Database ORACLE_HOME ................ /s01/oracle/app/oracle/product/11.2.0/dbhome_1
Database instance hostname ................ Listener ORACLE_HOME ................ /g01/11ggrid/app/11.2.0/grid
Listener port number ................ 1521
Cluster name ................ Horacle_cluster
Database unique name ................ HoracleDB
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
ASM ORACLE_HOME ................ /g01/11ggrid/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)]: yes
May 10, 2014 10:20:04 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /s01/orabase/cfgtoollogs/emca/HoracleDB/emca_2014_05_10_22_17_09.log.
May 10, 2014 10:20:07 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
May 10, 2014 10:20:09 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
May 10, 2014 10:20:10 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...

May 10, 2014 11:30:17 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
May 10, 2014 11:30:53 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
May 10, 2014 11:42:19 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
May 10, 2014 11:42:26 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /s01/oracle/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_vmydb1_HoracleDB to remote nodes ...
May 10, 2014 11:42:29 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /s01/oracle/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_vmydb2_HoracleDB to remote nodes ...
May 10, 2014 11:42:35 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb1_HoracleDB to remote nodes ...
May 10, 2014 11:42:38 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb2_HoracleDB to remote nodes ...
May 10, 2014 11:43:04 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
May 10, 2014 11:43:34 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
May 10, 2014 11:47:40 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://vmydb1:1158/em <<<<<<<<<<<
May 10, 2014 11:47:50 PM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage
INFO:
****************  Current Configuration  ****************
INSTANCE            NODE           DBCONTROL_UPLOAD_HOST
----------        ----------        ---------------------
HoracleDB         vmydb1         vmydb1
HoracleDB         vmydb2         vmydb1

May 10, 2014 11:47:50 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: /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb1_HoracleDB/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost.

***********************************************************
May 10, 2014 11:47:50 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING: Error starting Database Control on nodes vmydb2. Execute the following command(s) on nodes: vmydb2.
1) Set the environment variable ORACLE_UNQNAME to Database unique name
2) /s01/oracle/app/oracle/product/11.2.0/dbhome_1/bin/emctl start dbconsole

Error starting Database Control on nodes vmydb2. Execute the following command(s) on nodes: vmydb2.
1) Set the environment variable ORACLE_UNQNAME to Database unique name
2) /s01/oracle/app/oracle/product/11.2.0/dbhome_1/bin/emctl start dbconsole

EM创建成功,并且在vmydb1结点已成功启动;
[oracle@vmydb1 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
https://vmydb1:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb1_HoracleDB/sysman/log
 
但从输出日志可知,在vmydb2并没启动成功,于是按它提供的两个步骤去执行:
切换至vmydb2结点,执行:
[oracle@vmydb2 log]export ORACLE_UNQNAME=HoracledDB
[oracle@vmydb2 log]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
https://vmydb1:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ............................................................................................. failed.
Logs are generated in directory /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb2_HoracleDB/sysman/log 
仍然启动失败,进入/s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb2_HoracleDB/sysman/log查看日志
agabend.log为:
The agentTZRegion value in /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb2_HoracleDB/sysman/config/emd.properties is not in agreement with what agent thinks it should be.Please verify your environment to make sure that TZ setting has not changed since the last start of the agent.
If you modified the timezone setting in the environment, please stop the agent and exectute 'emctl resetTZ agent' and also execute the script mgmt_target.set_agent_tzrgn(<agent_name>, <new_tz_rgn>) to get the value propagated to repository.
通过此日志推断因emd.properties设置的时区与系统时区不符,于是调整时区,方法参考:
http://wenku.baidu.com/view/e424a130b90d6c85ec3ac632.html,
首先,切换至vmydb1查看emd.properties的时区设置:
[oracle@vmydb1 ~]$ cat /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb1_HoracleDB/sysman/config/emd.properties| grep TZ
agentTZRegion=PRC
再查看vmydb2emd.properties的时区设置,
[oracle@vmydb1 ~]$ cat /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb2_HoracleDB/sysman/config/emd.properties| grep TZ
agentTZRegion=US/Eastern,
果然是因为vmydb2时区设置不对导致启动失败。故进行以下操作纠正vmydb2的emd.properties的时区设置:
[oracle@vmydb2 ~]$ export TZ=PRC
[oracle@vmydb2 ~]$ emctl resetTZ agent
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
Updating /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb2_HoracleDB/sysman/config/emd.properties...
Successfully updated /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb2_HoracleDB/sysman/config/emd.properties.
Login as the em repository user and run the  script:
exec mgmt_target.set_agent_tzrgn('vmydb2:3938','PRC')
and commit the changes
This can be done for example by logging into sqlplus and doing
SQL> exec mgmt_target.set_agent_tzrgn('vmydb2:3938','PRC')
SQL> commit
查看是否已成功修改emd.properties
[oracle@vmydb2 ~]$ cat $ORACLE_HOME/vmydb2_HoracleDB/sysman/config/emd.properties|grep TZ
agentTZRegion=PRC
[oracle@vmydb2 ~]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
https://vmydb1:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control .............................. started.
------------------------------------------------------------------
Logs are generated in directory /s01/oracle/app/oracle/product/11.2.0/dbhome_1/vmydb2_HoracleDB/sysman/log
确认修改成功,同时vmydb2的EM也可正常启动了。
 
现在,可以通过访问https://vmydb1:1158/em去使用EM了 。
0 0