Thursday, March 18, 2010

How To Drop, Create And Recreate DB Control In A 10g Database


  1. Drop the DB Control Repository Objects manualy
    Drop AQ related objects in the SYSMAN schema connect with SYSMAN (sqlplus sysman)

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

    Drop the DB Control Repository 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;

  2. Remove configration files and reposotistoy by emca
    emca -deconfig dbcontrol db -repos drop

  3. Create the DB Control Repository Objects and Configuration Files
    emca -config dbcontrol db -repos create

  4. Recreate the DB Control Configuration Files and Repository
    emca -config dbcontrol db -repos recreate

  5. Create dbconsole on RAC system
    1-ORACLE_HOME and ORACLE_SID must be set
    2-ORACLE_HOME and ORACLE_HOME/bin are set in the environment variable $PATH
    3-Note the followings
    Database unique name (Database unique name)
    Listener port
    password of SYS,SYSMAN,DBSNMP (SYSMAN will be set)
    CLUSTER_NAME($CRS_HOME/bin/cemutlo -n)
    4-Check space in SYSAUX tablespace
    5-emca -config dbcontrol db -repos create -cluster
    6-emctl stat dbconsole

No comments: