测试环境: windows 2000 server sp4, oracle9206
本文的测试说明,任何一ORACLE数据库用户,只要具备grant any object privilege
权限,即可把别的用户的对象权限赋予给第3方。
1 该用户dep 只有对sys.tab和scott.pp分别有读和执行的权限。
SQL> connect dep/1
已连接。
SQL> select * from user_tab_privs;
GRANTEE OWNER TABLE_NAME GRANTOR PRIVILEGE GRA HIE
------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------------------------- --- ---
SCOTT SYS TAB DEP SELECT NO NO
DEP SCOTT PP SCOTT EXECUTE NO NO
2 scott用户的对象
SQL> connect scott/1
已连接。
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
CUSTPSIDATA3 TABLE
CUSTPSIDATA4 TABLE
DT TABLE
INDX_TAB TABLE
OBJECTS TABLE
T1 TABLE
TEMP_TABLE TABLE
TRAN TABLE
V_OBJECTS VIEW
已选择9行。
3 以超级用户登录数据库,新创建一用户,赋予开辟会话和grant any object privilege的权限。
SQL> connect / as sysdba
已连接。
SQL> create user grant_all identified by "1";
用户已创建
SQL> grant create session, grant any object privilege to grant_all;
授权成功。
4 以新创建的用户登录,测试:将scott.temp_table 的读取权限授予dep. 权限授予成功
SQL> connect grant_all/1
已连接。
SQL> grant select on scott.temp_table to dep;
授权成功。
5 dep用户可以读取scott.temp_table 表。
SQL> connect dep/1
已连接。
SQL> select * from scott.temp_table;
未选定行
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1112/viewspace-103706/ ,如需转载,请注明出处,否则将追究法律责任。