查看用户在某个对象上面的使用权限

来源:互联网 发布:caj转换word软件 编辑:程序博客网 时间:2024/04/30 12:01
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

查看用户在某个对象上面的使用权限可以用数据字典表DBA_TAB_PRIVS.表结构如下:
Name                        Null?   Type
----------------------------------------------------------------
GRANTEE            NOTNULLVARCHAR2(30) <==权限获得者
OWNER               NOTNULLVARCHAR2(30)
TABLE_NAME      NOTNULLVARCHAR2(30)
GRANTOR            NOTNULLVARCHAR2(30) <--权限授予者
PRIVILEGE           NOTNULLVARCHAR2(40)
GRANTABLE                           VARCHAR2(3) <--权限获得者是否有权限授予别人权限


权限由命令GRANT授予由命令REVOKE收回:
GRANTselect,insert,update,delete,referencesONmy_tableTOuser_joe;
REVOKEinsert,deleteONmy_tableFROMuser_joe;
GRANTcreatepublicsynonymTOuser_joe;

其他相关权限的数据字典表有:
ALL_TAB_PRIVS  
ALL_TAB_PRIVS_MADE 
ALL_TAB_PRIVS_RECD 
DBA_SYS_PRIVS  
DBA_ROLES  
DBA_ROLE_PRIVS  
ROLE_ROLE_PRIVS  
ROLE_SYS_PRIVS  
ROLE_TAB_PRIVS  
SESSION_PRIVS  
SESSION_ROLES  
USER_SYS_PRIVS  
USER_TAB_PRIV  


在做完EXP/IMP后,权限需要重新授予时可用下面的脚本:

setechooff
 rem
 rem 19980729 MDPowell  Newscript.
 rem
 setverifyoff
 setpagesize0
 setfeedbackoff
 spoolgrt_&&owner._&&table_name..sql

 select'REM grantson&&owner..&&table_name'
 fromsys.dual;

 select'grant'||privilege||'on'||lower(owner)||'.'||
        lower(table_name)||'to'||grantee||
        decode(grantable,'YES','withgrantoption',NULL)||
        ';'
 from  sys.dba_tab_privs
 where owner     =upper('&&owner')
 and   table_name=upper('&&table_name')
 orderbygrantee,privilege;

 spooloff
 undefineowner
 undefinetable_name

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>