2011-03-18 82 views

回答

4

这里是如何你找到你的用户的权限:

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; 

这将显示哪些用户已膨胀的特权。您可以通过键入

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; 
5

在Oracle中,“root”或“adminstrative”特权意味着什么?你想让用户获得SYSDBA吗?或者,在较早的Oracle版本中,有DBA角色,它具有广泛的特权集,使用户能够执行大部分任务。它在11g中具有减少的一组功能。 @ client09给出的答案对于确切地确定每个用户可以做什么很有用。

对我而言,Oracle中的root用户是SYSDBA帐户,默认情况下是SYS用户。任何被授予此权限的人都可以登录“AS SYSDBA”,从而使该用户完全控制数据库。您可以通过此选择列表授予此权限的用户:

SELECT * FROM v$pwfile_users; 

有趣的是,如果我授予SYSDBA角色,和我身份登录SYSDBA,在Oracle会话的实际用户是SYS:

SQL> create user test identified by test; 

User created. 

SQL> grant create session to test; 

Grant succeeded. 

SQL> grant sysdba to test; 

Grant succeeded. 

SQL> connect test/test as sysdba 
Connected. 
SQL> select user from dual; 

USER 
------------------------------ 
SYS 

SQL> select * from v$pwfile_users; 

USERNAME      SYSDB SYSOP SYSAS 
------------------------------ ----- ----- ----- 
SYS       TRUE TRUE FALSE 
TEST       TRUE FALSE FALSE