第一步、創建用戶。使用有管理員權限的用戶創建一個新的用戶:
create user 用戶名 identified by 密碼 default tablespace 表空間;
第二步、賦連接權限:
grant connect to 用戶名;
第三步、賦表權限
grant select on owner.表名 to 用戶名;
如果有多表,可以用selece轉換批量執行語句:
select 'grant select on '||owner||'.'||object_name||' to 用戶名;'
from dba_objects
where owner in ('owner')
and object_type='TABLE';
第四步、創建同義詞:
create or replace SYNONYM 用戶名.表名 FOR owner.表名;
如果有多表,可以用selece轉換批量執行語句:
SELECT 'create or replace SYNONYM 用戶名.'||object_name||' FOR '||owner||'.'||object_name||';' from dba_objects
where owner in ('owner')
and object_type='TABLE';
原文:https://blog.csdn.net/antma/article/details/53435704
