[英]How to identify user account in DBA_SYS_PRIVS table in Oracle Database
I'm trying to look for all the users with certain privileges in the DBA_SYS_PRIVS table. 我正在尝试在DBA_SYS_PRIVS表中查找具有某些特权的所有用户。 The table has a GRANTEE column and according to Oracle Official website, the GRANTEE column shows "Grantee name, user, or role receiving the grant". 该表具有GRANTEE列,并且根据Oracle官方网站,GRANTEE列显示“接受授予的被授予者姓名,用户或角色”。 So how could I know if the GRANTEE is an account or a role? 那么我怎么知道GRANTEE是帐户还是角色? For example, there is role called SYS and also an account called SYS in the Oracle DB. 例如,在Oracle DB中有一个名为SYS的角色,还有一个名为SYS的帐户。 So how do I know if this is an account or role???? 那么我怎么知道这是一个帐户还是角色????
Also in table DBA_TAB_PRIVS, there is a column called GRANTEE. 同样在表DBA_TAB_PRIVS中,有一列称为GRANTEE。 And in this table, the column GRANTEE is "Name of the user to whom access was granted". 在此表中,GRANTEE列是“授予访问权限的用户名”。 So I am really confused because the "GRANTEE" column means different things in two different tables 所以我很困惑,因为“ GRANTEE”列在两个不同的表中表示不同的东西
Please help, thanksssssssssssssss 请帮忙,谢谢ssssssssssss
No there is no SYS
role in Oracle. 在Oracle中没有SYS
角色。
SQL> select * from dba_roles where role='SYS';
no rows selected
Actually you cant create roles same name as usernames. 实际上,您无法创建与用户名相同名称的角色。
SQL> create role sys;
create role sys
*
ERROR at line 1:
ORA-01921: role name 'SYS' conflicts with another user or role name
To get only the roles without usernames. 仅获取不带用户名的角色。
SQL>select grantee from dba_sys_privs where grantee not in(select username from all_users);
To get only users without roles. 仅获取没有角色的用户。
SQL>select grantee from dba_sys_privs where grantee in(select username from all_users)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.