Tuesday, August 2, 2011

How To Drop/Create EM dbconsole of Single Instance Database

Manually recreate dbconsole 10gR2

Single Instance : $ORACLE_HOME/bin/emca -config dbcontrol db -repos create
RAC Database : $ORACLE_HOME/bin/emca -config dbcontrol db -repos create -cluster

First remove repository and files

How to drop DBConsole configuration files using EMCA (leave repository intact) ?

  •  




  • To remove DBConsole configuration files (leaving repository intact) run following EMCA command.

    <ORACLE_HOME>/bin/emca -deconfig dbcontrol db

    Enter the following information:
    Database SID: orcl
    Do you wish to continue? [yes(Y)/no(N)]:

    Note: This command will remove only the DBConsole configuration files which are under  




  • <ORACLE_HOME>/<Hostname_SID> and 




  • <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<Hostname>_<SID>







  • EXAMPLE

    D:>emca -deconfig dbcontrol db

    STARTED EMCA at Aug 2, 2011 12:38:43 PM
    EM Configuration Assistant, Version 10.2.0.1.0 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)]: Y
    Aug 2, 2011 12:38:54 PM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at D:\oracle\product\10.2.0\db_1\cfgtoollog
    s\emca\emca_2011-08-02_12-38-43-PM.log.
    Aug 2, 2011 12:38:56 PM oracle.sysman.emcp.EMDBPreConfig invoke
    WARNING: Database instance unavailable.
    Aug 2, 2011 12:38:56 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
    INFO: Stopping Database Control (this may take a while) ...
    Aug 2, 2011 12:39:01 PM oracle.sysman.emcp.target.TargetManager cleanupAgent
    WARNING: Error initializing SQL connection. SQL operations cannot be performed
    Enterprise Manager configuration completed successfully
    FINISHED EMCA at Aug 2, 2011 12:39:02 PM

    Drop DBConsole configuration files manually
    remove both directories

  • <ORACLE_HOME>/<Hostname_SID>




  • <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<Hostname>_<SID>




  • How to drop DBConsole repository objects manually ?

    DBConsole repository can be dropped manually by executing following SQL statements.


    Step 1: Drop AQ related objects in the SYSMAN schema Logon SQLPLUS as user SYS
     
    SQL> exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force=>TRUE);

    Step 2: Drop the DB Control Repository Objects Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account and management objects:

     
    SQL> SHUTDOWN IMMEDIATE;
    SQL> STARTUP RESTRICT;
    SQL> EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
    SQL> EXEC sysman.setEMUserContext('',5);
    SQL> REVOKE dba FROM sysman;
    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;
    /
    SQL> DROP USER mgmt_view CASCADE;
    SQL> DROP ROLE mgmt_user;
    SQL> DROP USER sysman CASCADE;
    SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION;


    On Windows you also need to delete the DB Console service:

    Using regedit
    - run regedit
    - navigate to HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services
    - locate the OracleDBConsole<sid> entry and delete it
    Or
    On Windows XP and Windows Server 2003 you can run the following from the command line:
    CMD> sc delete <service_name>
    - where <service_name> is the DB Control service name (typically: OracleDBConsole<sid>)
    Or
    CMD> nmesrvops delete <servicename>
    - where <service_name> is the DB Control service name (typically: OracleDBConsole<sid>)
    .



    No comments:

    Post a Comment