我想知道在Oracle中具有root(管理)特权的所有用户的列表。
我想要在脚本或C ++应用程序中使用它。脚本是首选。
最佳答案
这是您查找用户特权的方法:
select
lpad(' ', 2*level) || granted_role "User, his roles and privileges"
from
(
/* THE USERS */
select
null grantee,
username granted_role
from
dba_users
/* THE ROLES TO ROLES RELATIONS */
union
select
grantee,
granted_role
from
dba_role_privs
/* THE ROLES TO PRIVILEGE RELATIONS */
union
select
grantee,
privilege
from
dba_sys_privs
)
start with grantee is null
connect by grantee = prior granted_role;
这将向您显示哪些用户具有特权。您可以通过输入以下内容在Shell脚本中执行此操作
sqlplus / as sysdba --(if you are root on the box)
spool user_privileges.txt
@whos_a_root.sql --(if that's what you call your script)
spool off
exit;