Friday, September 14, 2012


Issues during recreating DB Control Console in 11gR2

Error - 
[oracle@devtstdbsrv bin]$ ./emca -config dbcontrol db -repos recreate
INFO: Stopping Database Control (this may take a while) ...
Sep 13, 2012 12:00:22 AM oracle.sysman.emcp.EMConfig perform
SEVERE: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .
Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2012_09_12_23_59_03.log for more details.
Could not complete the configuration. Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2012_09_12_23_59_03.log for more details.

Since, I cannot drop the re
[oracle@devtstdbsrv bin]$ hostname
[oracle@devtstdbsrv bin]$ emca -deconfig dbcontrol db
STARTED EMCA at Sep 13, 2012 12:04:04 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: orcl
Do you wish to continue? [yes(Y)/no(N)]: yes
Sep 13, 2012 12:04:11 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2012_09_13_00_04_04.log.
Sep 13, 2012 12:04:11 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 13, 2012 12:05:07 AM

-- However drop repos operation failed with following error. 
[oracle@devtstdbsrv bin]$ emca repos drop 
....................................
SEVERE: Error creating the repository
Sep 13, 2012 12:35:19 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_repos_create_<date>.log for more details.

Looking at the log file reveals following error...

CONFIG: ORA-20001: SYSMAN already EXISTS..
ORA-06512: at line 17
 oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-20001: SYSMAN already EXISTS..
ORA-06512: at line 17


Work around - 

Perform following actions in your DB 
SQL> drop user sysman cascade;
User dropped.
SQL> DROP PUBLIC SYNONYM setemviewusercontext;
Synonym dropped.
SQL> DROP ROLE mgmt_user;
Role dropped.
SQL> DROP PUBLIC SYNONYM mgmt_target_blackouts;
Synonym dropped.
SQL> DROP USER mgmt_view;
User dropped.

There is one more thing to add here is that since my repos drop operation failed earlier I have to manually drop the repos using following method..


[oracle@devtstdbsrv bin]$ pwd
/u01/app/oracle/product/11.0/db_1/sysman/admin/emdrep/bin
[oracle@devtstdbsrv bin]$ ./RepManager devtstdbsrv 1521 orcl -action drop
Enter SYS user's password :
Enter repository user name : sysman
Getting temporary tablespace from database...
Found temporary tablespace: TEMP
Checking SYS Credentials ... rem error switch
OK.
rem error switch
Dropping the repository..
Checking for Repos User ... Exists.
Repos User exists..
Clearing EM Contexts ... OK.
Dropping EM users ...
Done.
Dropping Repos User ...
Dropping Roles/Synonymns/Tablespaces ... Done.
Dropped Repository Successfully.


If this is not done then later during create repos operation you will face following error..

CONFIG: ORA-00955: name is already used by an existing object
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-00955: name is already used by an existing object



Now try to re-create the repository once again. We will try to create first repository and then db-control in separate steps as follows.

[oracle@devtstdbsrv dbs]$ emca -repos create
STARTED EMCA at Sep 13, 2012 12:53:10 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
Enter the following information:
Database SID: orcl
Listener port number: 1531
Password for SYS user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: yes
Sep 13, 2012 12:53:21 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2012_09_13_00_53_10.log.
Sep 13, 2012 12:53:21 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...

Sep 13, 2012 2:05:44 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 13, 2012 2:05:45 AM


--If you check the logfile during this time, you will see following messages

Sep 13, 2012 12:53:21 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngine
CONFIG: isLocalConnectionRequired: true. Connecting to database instance locally.
Sep 13, 2012 12:53:21 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly
CONFIG: SQLEngine connecting with SID: orcl, oracleHome: /u01/app/oracle/product/11.0/db_1, and user: SYS
Sep 13, 2012 12:53:21 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly
CONFIG: SQLEngine created successfully and connected
Sep 13, 2012 12:53:21 AM oracle.sysman.emcp.EMReposConfig createRepository

So the listener issue as described earlier during drop operation was not really a issue. It was more like a place holder error rather than actual error!!!

Now one needs to config the db-control as follows
[oracle@devtstdbsrv dbs]$ emca -config dbcontrol db

STARTED EMCA at Sep 13, 2012 2:40:50 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
Enter the following information:
Database SID: orcl
The database orcl is already being monitored by central agent(s)
Database Control will monitor the exisiting targets
Do you wish to continue? [yes(Y)/no(N)]: yes
Listener ORACLE_HOME [ /u01/app/oracle/product/11.0/db_1 ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------
You have specified the following settings
Database ORACLE_HOME ................ /u01/app/oracle/product/11.0/db_1
Local hostname ................ devtstdbsrv.localdomain
Listener ORACLE_HOME ................ /u01/app/oracle/product/11.0/db_1
Listener port number ................ 1521
Database SID ................ orcl
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: yes
Sep 13, 2012 2:41:05 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2012_09_13_02_40_49.log.
Sep 13, 2012 2:41:13 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Sep 13, 2012 2:42:39 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Sep 13, 2012 2:42:46 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Sep 13, 2012 2:42:46 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
INFO: Provisioning archives deployed successfully.
Sep 13, 2012 2:44:33 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Sep 13, 2012 2:44:48 AM oracle.sysman.emcp.util.PlatformInterface executeCommand
WARNING: Error executing /u01/app/oracle/product/11.0/db_1/bin/emctl secure dbconsole -host devtstdbsrv.localdomain -sid orcl
Sep 13, 2012 2:44:48 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
WARNING: Error securing Database control.
Sep 13, 2012 2:44:48 AM oracle.sysman.emcp.EMDBPostConfig setWarnMsg
INFO: Error securing Database Control, Database Control has been brought up in non-secure mode. To secure the Database Control execute the following command(s):

 1) Set the environment variable ORACLE_SID to orcl
 2) /u01/app/oracle/product/11.0/db_1/bin/emctl stop dbconsole
 3) /u01/app/oracle/product/11.0/db_1/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user > 
 4) /u01/app/oracle/product/11.0/db_1/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user >
 5) /u01/app/oracle/product/11.0/db_1/bin/emctl start dbconsole

 To secure Em Key, run /u01/app/oracle/product/11.0/db_1/bin/emctl config emkey -remove_from_repos -sysman_pwd < Password for SYSMAN user >
Sep 13, 2012 2:44:48 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...



Sep 13, 2012 2:47:55 AM oracle.sysman.emcp.util.PlatformInterface executeCommand
WARNING: Error executing /u01/app/oracle/product/11.0/db_1/bin/emctl start dbconsole
Sep 13, 2012 2:47:55 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is http://devtstdbsrv.localdomain:1158/em <<<<<<<<<<<
Sep 13, 2012 2:47:55 AM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING: Error starting Database Control.Please execute the following command(s).

 1) Set the environment variable ORACLE_UNQNAME to Database unique name
 2) /u01/app/oracle/product/11.0/db_1/bin/emctl start dbconsole

Error securing Database Control, Database Control has been brought up in non-secure mode. To secure the Database Control execute the following command(s):

 1) Set the environment variable ORACLE_SID to orcl
 2) /u01/app/oracle/product/11.0/db_1/bin/emctl stop dbconsole
 3) /u01/app/oracle/product/11.0/db_1/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user > 
 4) /u01/app/oracle/product/11.0/db_1/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user >
 5) /u01/app/oracle/product/11.0/db_1/bin/emctl start dbconsole

 To secure Em Key, run /u01/app/oracle/product/11.0/db_1/bin/emctl config emkey -remove_from_repos -sysman_pwd < Password for SYSMAN user >
Error starting Database Control.Please execute the following command(s).
 1) Set the environment variable ORACLE_UNQNAME to Database unique name
 2) /u01/app/oracle/product/11.0/db_1/bin/emctl start dbconsole



I ran the commands from 1 thru 5 and my dbconsole was up and running...