日期:2014-05-16  浏览次数:20395 次

oracle 如何知道给了用户和角色 select权限
SQL> desc user_tab_privs
Name                                      Null?    Type
----------------------------------------- -------- ----------------
GRANTEE                                   NOT NULL VARCHAR2(30)
OWNER                                     NOT NULL VARCHAR2(30)
TABLE_NAME                                NOT NULL VARCHAR2(30)
GRANTOR                                   NOT NULL VARCHAR2(30)
PRIVILEGE                                 NOT NULL VARCHAR2(40)
GRANTABLE                                          VARCHAR2(3)
HIERARCHY                                          VARCHAR2(3)

SQL> grant select on syslog to slxml;
SQL> select * from user_tab_privs

GRANTEE              OWNER           TABLE_NAME           GRANTOR
-------------------- --------------- -------------------- --------------------
PRIVILEGE            GRA HIE
-------------------- --- ---
SLXML                SL              SYSLOG               SL
SELECT               NO  NO

如果要把一个用户下的所有表的select权限授予给另外一个用户,可以考虑用这个。
SQL> spool c:\2.sql
SQL> select 'grant select on ' || object_name || ' to sl; ' from user_objects where object_type='TABLE';
grant select on TEST to s
grant select on SC to sl;
grant select on S to sl;
grant select on SYSLOG to
grant select on FROMSYSLO
SQL> spool off
SQL> @ c:\2.sql