-bash-4.2$ ./emca -deconfig dbcontrol db
STARTED EMCA at Apr 8, 2012 9:25:17 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: TEST
Do you wish to continue? [yes(Y)/no(N)]: Y
Apr 8, 2012 9:25:36 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /db1/oracle/TEST/cfgtoollogs/emca/TEST/emca_2012_04_08_09_25_16.log.
Apr 8, 2012 9:25:36 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 8, 2012 9:25:46 AM
-bash-4.2$ emca -deconfig dbcontrol db -repos drop
STARTED EMCA at Apr 8, 2012 9:37:27 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: TEST
Listener port number: 1571
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
Apr 8, 2012 9:39:03 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /db1/oracle/TEST/cfgtoollogs/emca/TEST/emca_2012_04_08_09_37_27.log.
Apr 8, 2012 9:39:04 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly
WARNING: ORA-01017: invalid username/password; logon denied
Apr 8, 2012 9:39:04 AM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
WARNING: Error initializing SQL connection. SQL operations cannot be performed
Apr 8, 2012 9:39:04 AM 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
Apr 8, 2012 9:39:04 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Apr 8, 2012 9:39:05 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 8, 2012 9:39:05 AM
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP RESTRICT;
ORACLE instance started.
Total System Global Area 6415597568 bytes
Fixed Size 2170304 bytes
Variable Size 1409286720 bytes
Database Buffers 4865392640 bytes
Redo Buffers 138747904 bytes
Database mounted.
Database opened.
SQL> EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
PL/SQL procedure successfully completed.
SQL> EXEC sysman.setEMUserContext('',5);
PL/SQL procedure successfully completed.
SQL> REVOKE dba FROM sysman;
REVOKE dba FROM sysman
*
ERROR at line 1:
ORA-01951: ROLE 'DBA' not granted to 'SYSMAN'
SQL> DECLARE
CURSOR c1 IS
2 3 SELECT owner, synonym_name name
4 FROM dba_synonyms
5 WHERE table_owner = 'SYSMAN';
6 BEGIN
7 FOR r1 IN c1 LOOP
8 IF r1.owner = 'PUBLIC' THEN
9 EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
10 ELSE
11 EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
12 END IF;
13 END LOOP;
14 END;
15 /
PL/SQL procedure successfully completed.
SQL> DROP USER mgmt_view CASCADE;
User dropped.
SQL> DROP ROLE mgmt_user;
Role dropped.
SQL> DROP USER sysman CASCADE;
User dropped.
SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION;
System altered.
-bash-4.2$ emca -config dbcontrol db -repos create
STARTED EMCA at Apr 8, 2012 9:42:12 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: TEST
Listener port number: 1571
Listener ORACLE_HOME [ /db1/oracle/TEST/product/11.2.0 ]:
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 ................ /db1/oracle/TEST/product/11.2.0
Local hostname ................ localhost.my
Listener ORACLE_HOME ................ /db1/oracle/STEST/product/11.2.0
Listener port number ................ 1571
Database SID ................ TEST
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Apr 8, 2012 9:43:08 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /db1/oracle/TEST/cfgtoollogs/emca/TEST/emca_2012_04_08_09_42_12.log.
Apr 8, 2012 9:43:10 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Apr 8, 2012 9:48:49 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Apr 8, 2012 9:48:53 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Apr 8, 2012 9:50:13 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Apr 8, 2012 9:50:47 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Apr 8, 2012 9:50:53 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Apr 8, 2012 9:50:54 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Apr 8, 2012 9:51:25 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Apr 8, 2012 9:51:25 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://localhost.my:5500/em <<<<<<<<<<<
Apr 8, 2012 9:51:28 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: /db1/oracle/TEST/product/11.2.0/localhost.me_TEST/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
Ref: When to Use the Create/Drop Dbconsole Commands which are Given in Note:278100.1 [ID 1377211.1]
How To Drop, Create And Recreate the Database Control (DB Control) Release 10g and 11g [ID 278100.1]