Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Saturday, 25 August 2012

Script: For Capturing system Privileges granted to users and roles.

SELECT NAME dbname  FROM v$database;
SELECT      'GRANT '
         || LOWER (PRIVILEGE)   || ' TO '   || LOWER (grantee)
         || DECODE (admin_option, 'YES', ' WITH ADMIN OPTION;', ';')
    FROM sys.dba_sys_privs
   WHERE grantee NOT IN ('SYS',  'CONNECT',  'RESOURCE',  'DBA',
                         'EXP_FULL_DATABASE',
                         'IMP_FULL_DATABASE'
                        )
ORDER BY grantee
/
This script must be run by a user with DBA role. running this script will create a script of all the grants of roles to users and other roles. Since role grants are not dependent on the schema that issue the grant, this script will not issue the grant of a role by the original grantor. All the grants will be issued by the user specified when running the script. Grants made to 'SYS', 'CONNECT', 'RESOURCE', 'DBA', 'EXP_FULL_DATABASE', 'IMP_FULL_DATABASE' are not captured.

0 comments:

Post a Comment