Oracle 把一个用户所有表的读权限授予另一个用户

时间:2021-09-16 08:47:08

 

create user <USER_NAME> identified by <PASSWORD>;

 

grant create session TO <USER_NAME>;

 

 

方法一  

有权限的用户执行

declare
cursor tab_names is select table_name from user_tables;
begin
for tab in tab_names loop
execute immediate 'GRANT SELECT ON '||tab.table_name||' to <USER_NAME>';
end loop;
end;

----------------------------------------------------------------------

方法二

用dba权限用户执行

select 'grant select on user1.'||table_name||' to user2;'
from all_tables
where owner = 'user1';

生成授权语句,再执行生成语句.

 

 

 

 

http://www.catgovind.com/oracle/how-to-grant-select-all-tables-and-views-to-user-oracle-db/

https://blog.csdn.net/maxracer/article/details/8434357