Feb 28, 2017

Re-configure Oracle Enterprise Manager (OEM) in Oracle 2 Node RAC

Go through below steps:

Step#1 : Drop the existing EM repository

$ emctl status dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.
$

$ export ORACLE_UNQNAME=PROD
$
$ emctl status dbconsole
OC4J Configuration issue. /oracle/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_racdb1_PROD not found.

$ cd $ORACLE_HOME
$ pwd
/oracle/app/oracle/product/11.2.0/dbhome_1/bin
$ emca -deconfig dbcontrol db -repos drop

STARTED EMCA at Feb 27, 2017 1:07:56 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:
Database SID: PROD1
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:

----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Feb 27, 2017 1:08:19 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/app/oracle/cfgtoollogs/emca/PROD/emca_2017_02_27_13_07_56.log.
Feb 27, 2017 1:08:19 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed. Some of the possible reasons may be:
 1) EM is configured with different hostname then physical host. Set environment variable ORACLE_HOSTNAME=<hostname> and re-run EMCA script
 2) ORACLE_HOSTNAME is set. Unset it and re-run EMCA script
Feb 27, 2017 1:08:19 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Feb 27, 2017 1:10:21 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Feb 27, 2017 1:10:21 PM
bash-4.2$

Note : 
Database in Quiesce Mode:  For more information about Quiesce Mode, refer to My Oracle Support Note 375946.1, "Running EMCA Results in Database Quiesce" and "No New Connections or Operations Can Be Performed During the DB Control Repository Creation"

Step#2 : Cheking of directory structure 

Once done, check that the following directories have been removed :
<ORACLE_HOME>/<hostname_sid>
<ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>

=> replace <hostname> and <sid> by the appropriate values.
Remove them if they still exist from both the cluster nodes.

Step#3 : Reconfigure the package

In 11.2 the DBMS_AQADM package is not owned by SYSMAN
so the command :

"exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'MGMT_NOTIFY_QTABLE',force =>TRUE);"

Need to be run as 'SYS' and SYSMAN would have to be appended to the object name.

See Oracle Note 1076401.1 about this

at sqlplus connect SYS/SYS_password as sysdba

exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force =>TRUE);

Step#4 : Set ORACLE_SID and HOME detail 

Ensure that ORACLE_SID environment variable is set to the correct sid value.
Ensure that no ORACLE_HOSTNAME environment is set.

Step#5 : Configure OEM

Follow the below document for Installing the dbconsole for RAC databases
How to manage DB Control 11.x for RAC Database with emca ( Doc ID 578011.1 )

Run emca in interactive mode:

$ emca -config dbcontrol db -repos create -cluster
Enter the following information:

Cluster Name
To find out the value of your CLUSTER_NAME from CRS (OCR), do the following from the CRS_HOME:

$ cd $CRS_HOME/bin
$ ./cemutlo -n
rac-cluster
$

Database unique name

If you're not sure of the values for Database unique name and service name, execute the following statement connected as a DBA user to any instance of the RAC database:
SQL> show parameter db_unique_name;
NAME                                 TYPE        VALUE
-----------------------  -------------------   -----------
db_unique_name                       string      PROD
SQL>

Listener port
SYS password
DBSNMP password
SYSMAN password
ASM ORACLE_HOME (ASM_OH)
ASM SID (ASM_SID)
ASM ROLE (ASM_USER_ROLE)
ASM USERNAME (ASM_USER_NAME)
ASM PORT (ASM_PORT)
or

Run emca in silent mode:
It is also possible to run emca in silent mode, providing a response file with all the parameters needed:

$ emca -config dbcontrol db -repos create -cluster -silent -respfile /u01/app/oracle/admin/EM111/scripts/emca_configandrep.rsp

e.g.,

bash-4.2$ emca -config dbcontrol db -repos create -cluster

STARTED EMCA at Feb 28, 2017 3:06:45 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: PROD
Service name: PROD
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: rac-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:
Feb 28, 2017 3:07:58 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 ................ /oracle/app/oracle/product/11.2.0/dbhome_1

Database instance hostname ................ Listener ORACLE_HOME ................ /oracle/app/11.2.0/grid
Listener port number ................ 1521
Cluster name ................ rac-cluster
Database unique name ................ PROD
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

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Feb 28, 2017 3:08:10 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/app/oracle/cfgtoollogs/emca/PROD/emca_2017_02_28_15_06_44.log.
Feb 28, 2017 3:08:15 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Feb 28, 2017 3:14:35 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Feb 28, 2017 3:14:41 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Feb 28, 2017 3:16:05 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Feb 28, 2017 3:16:05 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /oracle/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_racdb1_PROD to remote nodes ...
Feb 28, 2017 3:16:13 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /oracle/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_racdb2_PROD to remote nodes ...
Feb 28, 2017 3:16:22 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /oracle/app/oracle/product/11.2.0/dbhome_1/racdb1_PROD to remote nodes ...
Feb 28, 2017 3:16:27 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /oracle/app/oracle/product/11.2.0/dbhome_1/racdb2_PROD to remote nodes ...
Feb 28, 2017 3:16:35 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Feb 28, 2017 3:17:01 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Feb 28, 2017 3:17:44 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Feb 28, 2017 3:17:44 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://racdb1.orcl.com:5500/em <<<<<<<<<<<
Feb 28, 2017 3:17:49 PM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage
INFO:
****************  Current Configuration  ****************
 INSTANCE            NODE           DBCONTROL_UPLOAD_HOST
----------        ----------        ---------------------
PROD             racdb1             racdb.orcl.com
PROD             racdb2             racdb.orcl.com


Feb 28, 2017 3:17:49 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/dbhome_1/racdb1_PROD/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 Feb 28, 2017 3:17:49 PM
$

Step#6 : Check EM status

$ export ORACLE_UNQNAME=PROD
$ 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://racdb.orcl.com:5500/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /oracle/app/oracle/product/11.2.0/dbhome_1/racdb1_PROD/sysman/log
$

Translate >>