4 Replies Latest reply: Aug 28, 2009 9:05 AM by 539769 RSS

    remove sysman

    650532
      Hello everyone,

      is there any script which allows me to make a clean remove of the sysman user?

      regards
        • 1. Re: remove sysman
          202099
          Use Repmanager. cd to the folder C:\oracle\product\10.2.0\db_1\sysman\admin\emdrep\bin (for 10g) and the syntax will be something like this for windows:

          c:\...bin> repmanager -connect oursid -action drop

          I would not suggest attempted to drop the sysman user yourself as you will leave a good deal of orphaned records in the data dictionary which are painful to hack out.
          • 2. Re: remove sysman
            ivw
            emca -repos drop
            1. Remove the repository objects from the database with the following commands:
            
            Stop the DB Control web site and logon to SQLPLUS as user SYS or SYSTEM, and drop the sysman account 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 = '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;
            DROP USER mgmt_view CASCADE;
            DROP ROLE mgmt_user;
            DROP USER sysman CASCADE;
            ALTER SYSTEM DISABLE RESTRICTED SESSION;
            
            Note that the section from "DECLARE" to "END;" is PL/SQL and, while it can be copied and pasted into a SQL*Plus session, it will need to be terminat
            ed with a slash (/) on its own line before executing with a carriage return.
            You can see if sysman exists in dba_users to verify the effectiveness of the proced
            ure (select * from dba_users;).
            
            
            2. Remove the existing DB Control web site configuration in the OS file system by running the command:
            
            emca -x <sid> (where you supply the SID name, i.e. emca -x orcl)
            
            This command remove the following directories from the database Oracle Home:
            
            O_H/<host>_<sid>
            O_H/oc4j/j2ee/OC4J_DBConsole_<host>_<SID>
            
            If they are not removed in the emca -x <sid> process, delete them manually.
            
            
            3. Recreate both the repository objects and the DB control web site with the following command:
            
            emca
            
            This command opens up an interview process in which you will pass the information required to both recreate the rep
            ository objects and the web site configuration.
            Note:
            Port number refers to tnslistener port
            The value for sid and service name are normally the same
            You can leave the email configuration entries blank, since they can be added later
            You will need to remember the passwords for sys and dbsnmp from the database, so reset
            them in SQL*Plus if you have forgotten them.
            
            At the end of the emca command, the DB Control web site should be started and you should be able to log in through
            a browser.
            • 3. Re: remove sysman
              650532
              Cool. i will try this script in a minute...

              thanks
              • 4. Re: remove sysman
                539769
                You can also do the following sequence of steps:
                DROP USER sysman CASCADE;
                DROP ROLE mgmt_user;
                DROP USER mgmt_view CASCADE;
                DROP PUBLIC SYNONYM mgmt_target_blackouts;
                DROP PUBLIC SYNONYM Setemviewusercontext;
                emca -deconfig dbcontrol db -repos drop;

                Rgds.