-
Notifications
You must be signed in to change notification settings - Fork 6
/
user_system_privileges.sql
47 lines (39 loc) · 1.02 KB
/
user_system_privileges.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
SET LINESIZE 500
SET PAGESIZE 1000
set verify off
COLUMN username FORMAT A15
COLUMN granted_role FORMAT A25
COLUMN privilege FORMAT A25
prompt ****************************
prompt ** User system privileges **
prompt ****************************
prompt
select a.username,
a.granted_role,
a.privilege
from (
-- Privileges obtained through Roles
select u.username,
r.granted_role,
s.privilege
from dba_role_privs r,
dba_users u,
dba_sys_privs s
where r.grantee = u.username
and u.username <> 'SYS'
and s.grantee = r.granted_role
union all
-- Privileges obtained directly
select u.username,
'GRANTED DIRECTLY' GRANTED_ROLE,
s.privilege
from dba_users u,
dba_sys_privs s
where u.username <> 'SYS'
and s.grantee = u.username ) a
where
-- Uncomment to list privileges for just one user
-- a.username = UPPER('&1')
order by a.username, a.granted_role
set verify on
/