1. 程式人生 > >oracle將A使用者下的所有table,packe的許可權賦予給B使用者

oracle將A使用者下的所有table,packe的許可權賦予給B使用者

1 表許可權:

登入scott/tiger,然後查詢select 'grant select on '||tname||' to robbie;' from tab
tab表儲存當前登入使用者的所有表,tname是表名,查詢結果:
 grant select on DEPT to robbie; 
 grant select on EMP to robbie;
 grant select on BONUS to robbie;
 grant select on SALGRADE to robbie;
 grant select on STOCK_RECEIVED to robbie;
然後執行這個查詢結果集,就可以了,需要主意的是,scott使用者必須有grant許可權。


注意

:grant select any table to robbie;       //該語句意思是將所有表的訪問許可權賦予給robbie.

2 包許可權

A、如果只想授予一個使用者對一個包的執行許可權,但不能檢視包體:
grant execute on package_name to user_name;
B、如果想授予一個使用者所有包的執行許可權,並且能檢視包體,但不能修改編譯:
grant create any procedure,select any table,execute any procedure to user_name;