oracle給使用者分配特定使用者下特定表的只讀許可權

kisslfcr發表於2016-01-18
以下是測試過程,測試環境oracle 11.2.0.3 linux平臺:
模擬將HR使用者下的employees表的只讀許可權非配給test_ycr
建立使用者:
SQL> create user test_ycr identified by oracle;
SQL> grant create session to test_ycr;
Grant succeeded.
此時使用者無法選擇employee表:
SQL> conn test_ycr/oracle;
Connected.
SQL> select employee_id from hr.employees;
select employee_id from hr.employees
                           *
ERROR at line 1:
ORA-00942: table or view does not exist
給test_ycr使用者賦予employees表的只讀許可權後實現只讀:
SQL> conn / as sysdba
Connected.
SQL> grant select on hr.employees to test_ycr;
Grant succeeded.
SQL> conn test_ycr/oracle
Connected.
SQL> select employee_id from hr.employees where employee_id=206;
EMPLOYEE_ID
-----------
        206
但是無法修改:
SQL> update hr.employees set employee_id=333 where employee_id=206;
update hr.employees set employee_id=333 where employee_id=206
          *
ERROR at line 1:
ORA-01031: insufficient privileges
功能實現。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29135257/viewspace-1978188/,如需轉載,請註明出處,否則將追究法律責任。

相關文章