One thought on “Monitor

  1. set head off
    set pages 0
    set long 9999999
    spool user_script.sql
    SELECT DBMS_METADATA.GET_DDL(‘USER’, USERNAME) || ‘/’ DDL
    FROM DBA_USERS
    UNION ALL
    SELECT DBMS_METADATA.GET_GRANTED_DDL(‘TABLESPACE_QUOTA’, USERNAME) || ‘/’ DDL
    FROM DBA_USERS where username in (select username from dba_ts_quotas)
    UNION ALL
    SELECT DBMS_METADATA.GET_GRANTED_DDL(‘ROLE_GRANT’, USERNAME) || ‘/’ DDL
    FROM DBA_USERS where username in (select grantee from dba_role_privs)
    UNION ALL
    SELECT DBMS_METADATA.GET_GRANTED_DDL(‘SYSTEM_GRANT’, USERNAME) || ‘/’ DDL
    FROM DBA_USERS where username in (select grantee from dba_sys_privs)
    UNION ALL
    SELECT DBMS_METADATA.GET_GRANTED_DDL(‘OBJECT_GRANT’, USERNAME) || ‘/’ DDL
    FROM DBA_USERS where username in (select grantee from dba_tab_privs);
    spool off;

Leave a Reply

Your email address will not be published. Required fields are marked *