Wednesday, February 2, 2011

Drop OMS Repository - 11g

Remove the repository objects from the database with the following commands:

Stop the Grid Control web site and logon to SQLPLUS as user SYS or SYSTEM, and drop the sysman  and sysman_mds accounts and mangement objects:

SHUTDOWN IMMEDIATE;
STARTUP RESTRICT;


EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
EXEC sysman.setEMUserContext('',5);
REVOKE dba FROM sysman;


DECLARE
   CURSOR c1 IS
     SELECT owner, synonym_name name
       FROM dba_synonyms
     WHERE table_owner IN ('SYSMAN', 'SYSMAN_MDS');
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;
/


DROP USER mgmt_view CASCADE;
DROP ROLE mgmt_user;
DROP USER sysman CASCADE;
DROP USER sysman_mds CASCADE;
delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='Metadata Services';
ALTER SYSTEM DISABLE RESTRICTED SESSION;

No comments: