Thursday, September 22, 2011

Drop and Create enterprise manager database control ( emca) for 11G R2 RAC


With 11G R2 , drop ,creation, de-config,re creation of enterprise manager database console does not put the database in quiesce mode.
The followed to drop , create , de config and re create emca for 11G R2 single instance or RAC.

I have tried ./bin/emca -config dbcontrol db -repos drop to drop enterprise manager repository objects, but it got hung at some point. Finally, I have tried the manual drop option which is very simple and you are almost sure that it will work !

1.Drop db control repository manually

1. stop dbconsole , if running and the following process from ORACLE_HOME (from each node)
$ps -ef | grep console                                           
$ps -ef| grep emwd
$ps -ef | grep emagent
$ps -ef |grep java

2. Set environment  variables
SET ORACLE_HOSTNAME=< Hostname of your machine "
SET ORACLE_HOME=< Location where your database is installed >
SET ORACLE_SID=< name of your database "
SET PATH=%ORACLE_HOME%\bin;%PATH%
Note : You will have to replace SET command with EXPORT for *nix environments

3. Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account and management objects:

a. drop user sysman cascade;
b. drop role MGMT_USER;
c. drop user MGMT_VIEW cascade;
d. drop public synonym MGMT_TARGET_BLACKOUTS;
e. drop public synonym SETEMVIEWUSERCONTEXT;
f. drop public synonym MGMT_target_blackouts;                  
g. drop public synonym mgmt_severity_array;
h. drop public synonym mgmt_guid_obj;                
 Verify any left over object owned by SYSMAN

SQL> SELECT owner,TABLE_NAME, synonym_name name FROM dba_synonyms WHERE table_owner = 'SYSMAN';

if yo notice any public synonym or any rows returned by the above query .
SQL>

DECLARE
CURSOR c1 IS
SELECT owner, synonym_name name
FROM dba_synonyms
WHERE table_owner = 'SYSMAN';
BEGIN
FOR r1 IN c1 LOOP
IF r1.owner = 'PUBLIC' THEN
EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
ELSE
EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;     
END IF;
END LOOP;
END;
/

4.Move or rename config folders on each node :
$rm -rf $ORACLE_HOME/
$rm -rf $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole__

You would replace the values in the <> with the correct values.

5.Create DBconsole repos and configure dbconsole : (Use -cluster when its RAC DB)

$export ORACLE_HOME= (Please give the physical path avoid symbolic links)
$



2.Create emca  repository objects

Execute the below command to create emca db console for RAC
./bin/emca -config dbcontrol db -repos create -cluster
-bash-3.00$ ./bin/emca -config dbcontrol db -repos create -cluster

STARTED EMCA at Aug 19, 2011 8:47:46 AM
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: bvnprd
Service name: bvnprd
Listener ORACLE_HOME [ /project/11.2.0/grid ]:
Password for SYS user: ^R < Give SYS password in single quotes if there are special characters >
Password for SYS user: ^R
Password for SYS user: ^R
Password for SYS user:
Database Control is already configured for the database bvnprd
You have chosen to configure Database Control for managing the database bvnprd
This will remove the existing configuration and the default settings and perform a fresh configuration
Do you wish to continue? [yes(Y)/no(N)]: yes
Password for DBSNMP user:
Password for SYSMAN user:
Cluster name: crs
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
ASM ORACLE_HOME [ /project/11.2.0/grid ]:
ASM port [ 1521 ]:
ASM username [ ASMSNMP ]: SYS < You can also give ASMSNMP user and password below >
ASM user password:
Invalid username/password or database/scan listener not up or database service is not registered with scan listener.
ASM user password:
Invalid username/password or database/scan listener not up or database service is not registered with scan listener.
ASM user password: 3LHj*5x
Invalid username/password or database/scan listener not up or database service is not registered with scan listener.
ASM user password:
Invalid username/password or database/scan listener not up or database service is not registered with scan listener.
ASM user password:  LHj*5x
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /project/oracle/orabase/product/11.2.0/dbhome_1

Database instance hostname ................ dom-ash-sr147.domdc.com
Listener ORACLE_HOME ................ /project/11.2.0/grid
Listener port number ................ 1521
Cluster name ................ crs
Database unique name ................ bvnprd
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
ASM ORACLE_HOME ................ /project/11.2.0/grid
ASM port ................ 1521
ASM user role ................ SYSDBA
ASM username ................ SYS

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: yes
Aug 19, 2011 9:19:52 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /project/oracle/orabase/cfgtoollogs/emca/bvnprd/emca_2011_08_19_08_47_45.log.
Aug 19, 2011 9:19:55 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Aug 19, 2011 9:20:02 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Aug 19, 2011 9:30:49 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Aug 19, 2011 9:31:06 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Aug 19, 2011 9:31:49 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Aug 19, 2011 9:31:50 AM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /project/oracle/orabase/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_dom-ash-sr147_bvnprd to remote nodes ...
Aug 19, 2011 9:31:53 AM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /project/oracle/orabase/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_dom-ash-sr149_bvnprd to remote nodes ...
Aug 19, 2011 9:32:02 AM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /project/oracle/orabase/product/11.2.0/dbhome_1/dom-ash-sr147_bvnprd to remote nodes ...
Aug 19, 2011 9:32:11 AM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /project/oracle/orabase/product/11.2.0/dbhome_1/dom-ash-sr149_bvnprd to remote nodes ...
Aug 19, 2011 9:32:16 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO:  Location /project/oracle/orabase/product/11.2.0/dbhome_1/EMStagePatches_bvnprd is not shared. Software library could not be configured. Provisioning archives will not be deployed. Please configure it manually.
Aug 19, 2011 9:32:16 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Aug 19, 2011 9:32:32 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Aug 19, 2011 9:33:10 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Aug 19, 2011 9:33:10 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://dom-ash-sr147.domdc.com:1158/em <<<<<<<<<<<
Aug 19, 2011 9:33:12 AM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage
INFO:
****************  Current Configuration  ****************
 INSTANCE            NODE           DBCONTROL_UPLOAD_HOST
----------        ----------        ---------------------

bvnprd            dom-ash-sr147     dom-ash-sr147.domdc.com
bvnprd            dom-ash-sr149     dom-ash-sr147.domdc.com


Aug 19, 2011 9:33:12 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: /project/oracle/orabase/product/11.2.0/dbhome_1/dom-ash-sr147_bvnprd/sysman/config/emkey.ora.   Please 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 Aug 19, 2011 9:33:12 AM
-bash-3.00$

0 comments:

Post a Comment

 

ORA-BLOG. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com