今天一个客户打电话过来说他们的OEM出了问题用不起,OEM这个东西得说了很多次,但是自己从来没有玩过。下面就在自己的测试环境来玩一点,结果报错了。
环境:OS:RHEL 5.6 X86_64 DB:11.2.0.2 RAC
1,开始配置OEM
- [oracle@11rac1 ~]$ emca -config dbcontrol db -repos create -cluster
- STARTED EMCA at Nov 7, 2012 11:00:18 PM
- EM Configuration Assistant, Version 11.2.0.0.2 Production
- Copyright (c) 2003, 2005, Oracle. All rights reserved.
- Enter the following information:
- Database unique name: power
- Service name: power
- 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: test
- 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
- ASM user password:
- Nov 7, 2012 11:01:43 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
- Nov 7, 2012 11:01:48 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
- WARNING: ORA-12154: TNS:could not resolve the connect identifier specified
- Nov 7, 2012 11:01:49 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
- Nov 7, 2012 11:01:54 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
- WARNING: ORA-12154: TNS:could not resolve the connect identifier specified
- 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:
- ASM user password: Nov 7, 2012 11:12:21 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
- Nov 7, 2012 11:12:26 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
- WARNING: ORA-12154: TNS:could not resolve the connect identifier specified
- Nov 7, 2012 11:12:26 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
- Nov 7, 2012 11:12:32 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
- WARNING: ORA-12154: TNS:could not resolve the connect identifier specified
- 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.
2.查看监听消息
- [grid@11rac1 ~]$ ps -ef|grep lsn
- grid 3957 1 0 09:15 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
- grid 3990 1 0 09:15 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN1 -inherit
- grid 7006 6976 0 09:40 pts/0 00:00:00 grep lsn
- [grid@11rac1 ~]$ lsnrctl status listener
- LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 08-NOV-2012 09:40:51
- Copyright (c) 1991, 2010, 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.2.0 - Production
- Start Date 08-NOV-2012 09:15:15
- Uptime 0 days 0 hr. 25 min. 36 sec
- Trace Level off
- Security ON: Local OS Authentication
- SNMP OFF
- Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
- Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/11rac1/listener/alert/log.xml
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.40)(PORT=1521)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.45)(PORT=1521)))
- Services Summary...
- Service "+ASM" has 1 instance(s).
- Instance "+ASM1", status READY, has 1 handler(s) for this service...
- Service "power" has 1 instance(s).
- Instance "power1", status READY, has 1 handler(s) for this service...
- Service "powerXDB" has 1 instance(s).
- Instance "power1", status READY, has 1 handler(s) for this service...
- The command completed successfully
- [grid@11rac1 ~]$ lsnrctl status listener_scan1
- LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 08-NOV-2012 09:41:04
- Copyright (c) 1991, 2010, 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.2.0 - Production
- Start Date 08-NOV-2012 09:15:18
- Uptime 0 days 0 hr. 25 min. 45 sec
- Trace Level off
- Security ON: Local OS Authentication
- SNMP OFF
- Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
- Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/11rac1/listener_scan1/alert/log.xml
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.49)(PORT=1521)))
- Services Summary...
- Service "power" has 2 instance(s).
- Instance "power1", status READY, has 1 handler(s) for this service...
- Instance "power2", status READY, has 1 handler(s) for this service...
- Service "powerXDB" has 2 instance(s).
- Instance "power1", status READY, has 1 handler(s) for this service...
- Instance "power2", status READY, has 1 handler(s) for this service...
- The command completed successfully
- [grid@11rac1 ~]$ sqlplus asmsnmp/oracle@scan:1521/+ASM as sysdba
- SQL*Plus: Release 11.2.0.2.0 Production on Thu Nov 8 09:41:30 2012
- Copyright (c) 1982, 2010, Oracle. All rights reserved.
- ERROR:
- ORA-12514: TNS:listener does not currently know of service requested in connect
- descriptor
- Enter user-name:
- [grid@11rac1 ~]$ sqlplus asmsnmp/[email protected]:1521/+ASM as sysdba
- SQL*Plus: Release 11.2.0.2.0 Production on Thu Nov 8 09:44:57 2012
- Copyright (c) 1982, 2010, Oracle. All rights reserved.
- Connected to:
- Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
- With the Real Application Clusters and Automatic Storage Management options
- SQL> select instance_name from v$instance;
- INSTANCE_NAME
- ----------------
- +ASM1
- [grid@11rac1 ~]$ cd $ORACLE_HOME/network/admin
- [grid@11rac1 admin]$ cat listener.ora
- LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
- LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
- ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
- ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
- [grid@11rac1 admin]$ cat endpoints_listener.ora
- LISTENER_11RAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=11rac1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.40)(PORT=1521)(IP=FIRST)))) # line added by Agent
发现ASM的监听跑在LISTENER上面,没有注册到LISTENER_SCAN1里面,而OEM使用提LISTENER_SCAN1监听。
3.手动注册监听,并查看状态
- [grid@11rac1 ~]$ sqlplus / as sysdba
- SQL*Plus: Release 11.2.0.2.0 Production on Thu Nov 8 12:07:09 2012
- Copyright (c) 1982, 2010, Oracle. All rights reserved.
- Connected to:
- Oracle Database 11g Enterprise Edition Release 11.2.0.2.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
- SQL> alter system set remote_listener='scan:1521' scope=both sid='*';
- System altered.
- SQL> alter system register;
- System altered.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
- With the Real Application Clusters and Automatic Storage Management options
- [grid@11rac1 ~]$ ps -ef|grep lsn
- grid 3957 1 0 09:15 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
- grid 3990 1 0 09:15 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN1 -inherit
- grid 16378 16263 0 12:08 pts/0 00:00:00 grep lsn
- [grid@11rac1 ~]$ lsnrctl status listener_scan1
- LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 08-NOV-2012 12:08:54
- Copyright (c) 1991, 2010, 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.2.0 - Production
- Start Date 08-NOV-2012 09:15:18
- Uptime 0 days 2 hr. 53 min. 35 sec
- Trace Level off
- Security ON: Local OS Authentication
- SNMP OFF
- Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
- Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/11rac1/listener_scan1/alert/log.xml
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.49)(PORT=1521)))
- Services Summary...
- Service "+ASM" has 2 instance(s).
- Instance "+ASM1", status READY, has 1 handler(s) for this service...
- Instance "+ASM2", status READY, has 1 handler(s) for this service...
- Service "power" has 2 instance(s).
- Instance "power1", status READY, has 1 handler(s) for this service...
- Instance "power2", status READY, has 1 handler(s) for this service...
- Service "powerXDB" has 2 instance(s).
- Instance "power1", status READY, has 1 handler(s) for this service...
- Instance "power2", status READY, has 1 handler(s) for this service...
- The command completed successfully
4.再次配置OEM
- [oracle@11rac1 ~]$ emca -config dbcontrol db -repos recreate -cluster
- STARTED EMCA at Nov 8, 2012 12:13:04 PM
- EM Configuration Assistant, Version 11.2.0.0.2 Production
- Copyright (c) 2003, 2005, Oracle. All rights reserved.
- Enter the following information:
- Database unique name: power
- Service name: power
- Listener port number: 1521
- Listener ORACLE_HOME [ /u01/app/11.2.0/grid ]:
- Password for SYS user:
- Password for SYS user: oracle
- Password for SYSMAN user:
- Cluster name: test
- 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:
- -----------------------------------------------------------------
- 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 ................ test
- Database unique name ................ power
- 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
- -----------------------------------------------------------------
- ----------------------------------------------------------------------
- WARNING : While repository is dropped the database will be put in quiesce mode.
- ----------------------------------------------------------------------
- Do you wish to continue? [yes(Y)/no(N)]: Y
- Nov 8, 2012 12:13:30 PM oracle.sysman.emcp.EMConfig perform
- INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/power/emca_2012_11_08_12_13_03.log.
- Nov 8, 2012 12:13:32 PM oracle.sysman.emcp.EMReposConfig invoke
- INFO: Dropping the EM repository (this may take a while) ...
- Nov 8, 2012 12:16:59 PM oracle.sysman.emcp.EMReposConfig invoke
- INFO: Repository successfully dropped
- Nov 8, 2012 12:17:00 PM oracle.sysman.emcp.EMReposConfig createRepository
- INFO: Creating the EM repository (this may take a while) ...
- hNov 8, 2012 12:27:24 PM oracle.sysman.emcp.EMReposConfig invoke
- INFO: Repository successfully created
- Nov 8, 2012 12:27:33 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
- INFO: Uploading configuration data to EM repository (this may take a while) ...
- Nov 8, 2012 12:28:36 PM oracle.sysman.emcp.EMReposConfig invoke
- INFO: Uploaded configuration data successfully
- Nov 8, 2012 12:28:36 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
- INFO: Propagating /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_11rac1_power to remote nodes ...
- Nov 8, 2012 12:28:39 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
- INFO: Propagating /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_11rac2_power to remote nodes ...
- Nov 8, 2012 12:28:43 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
- INFO: Propagating /u01/app/oracle/product/11.2.0/db_1/11rac1_power to remote nodes ...
- Nov 8, 2012 12:28:45 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
- INFO: Propagating /u01/app/oracle/product/11.2.0/db_1/11rac2_power to remote nodes ...
- Nov 8, 2012 12:28:47 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
- INFO: Securing Database Control (this may take a while) ...
- Nov 8, 2012 12:29:08 PM oracle.sysman.emcp.util.DBControlUtil startOMS
- INFO: Starting Database Control (this may take a while) ...
- Nov 8, 2012 12:30:33 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
- INFO: Database Control started successfully
- Nov 8, 2012 12:30:33 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
- INFO: >>>>>>>>>>> The Database Control URL is https://11rac1:5500/em <<<<<<<<<<<
- Nov 8, 2012 12:32:23 PM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage
- INFO:
- **************** Current Configuration ****************
- INSTANCE NODE DBCONTROL_UPLOAD_HOST
- ---------- ---------- ---------------------
- power 11rac1 11rac1
- power 11rac2 11rac1
- Nov 8, 2012 12:32:23 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/11rac1_power/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 Nov 8, 2012 12:32:23 PM
已经显示successfully ,表示已经成功了。
5.查看运行状态。
- [oracle@11rac1 ~]$ emca -displayConfig dbcontrol -cluster
- STARTED EMCA at Nov 8, 2012 1:54:57 PM
- EM Configuration Assistant, Version 11.2.0.0.2 Production
- Copyright (c) 2003, 2005, Oracle. All rights reserved.
- Enter the following information:
- Database unique name: power
- Service name: power
- Do you wish to continue? [yes(Y)/no(N)]: Y
- Nov 8, 2012 1:55:02 PM oracle.sysman.emcp.EMConfig perform
- INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/power/emca_2012_11_08_13_54_57.log.
- Nov 8, 2012 1:55:05 PM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage
- INFO:
- **************** Current Configuration ****************
- INSTANCE NODE DBCONTROL_UPLOAD_HOST
- ---------- ---------- ---------------------
- power 11rac1 11rac1
- power 11rac2 11rac1
- Enterprise Manager configuration completed successfully
- FINISHED EMCA at Nov 8, 2012 1:55:05 PM
- [oracle@11rac1 ~]$ emctl -help
- Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.
- [oracle@11rac1 ~]$ export ORACLE_UNQNAME=power
- [oracle@11rac1 ~]$ emctl status dbconsole
- Oracle Enterprise Manager 11g Database Control Release 11.2.0.2.0
- Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.
- https://11rac1:5500/em/console/aboutApplication
- Oracle Enterprise Manager 11g is running.
- ------------------------------------------------------------------
- Logs are generated in directory /u01/app/oracle/product/11.2.0/db_1/11rac1_power/sysman/log
一切正常.OEM配置成功。