--创建用户 test,密码123456
create user test identified by 123456;
--授权登录
grant connect to test;
--授权同义词
grant create synonym to test;
--授权会话
grant create session to test;
--授权视图
grant create view to test;
--授权读取权限
(1)select 'grant select on '||owner||'.'||object_name||' to test;'
from dba_objects
where owner in ('USER1','USER2')
and object_type='TABLE';
---当(1)无效时使用(2)
select 'Grant all on '||table_name||'to 创建的用户 ;' from all_tables
where owner = upper('当前用户');
复制查询到的数据到新创窗口执行
--授权同义词表
select 'create or replace SYNONYM test.' || object_name|| ' FOR ' || owner || '.' || object_name|| ';'
from dba_objects
where owner in ('USER1','USER2')
and object_type='TABLE';
复制查询结果到新创建sql窗口执行后可以在test的同义词查看到所有表