Friday, August 24, 2012

Drop DB Control Repository

I know that i post this topic before , you use emca to drop dbcontrol but what if this command fails 
what should i do ? I post This Topic to show second way to drop dbcontrol let Start :
 
emca
should be used to drop DB Control repository as follows:
emca -deconfig dbcontrol db -repos drop

Steps :

1.Shutdown database


 SHUTDOWN IMMEDIATE;
2.Remove EM job

EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
3.Revoke DBA privilages from SYSMAN user

REVOKE dba FROM sysman;
4.Run 

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;
/
 5.Drop MGMT_VIEW user.

DROP USER MGMT_VIEW CASCADE;
6.Drop MGMT_VIEW role

DROP ROLE mgmt_user;
7.Drop SYSMAN user

DROP USER sysman CASCADE;
8.Disable restricted mode

ALTER SYSTEM DISABLE RESTRICTED SESSION;


 Thank you
Osama


    2 comments:

    1. Hi you missed out the following in your step 2:
      STARTUP RESTRICT;

      Khalid
      Oracle DBA.

      ReplyDelete
      Replies
      1. depend if you want restrict access to Database then you should use it otherwise nope

        Delete