Oracle 创建只读帐号

首先登录Sys as sysdba


--创建用户 
 create user ordldy identified by ordldy;
--给他一些基础的权限
 grant connect to ordldy;
 grant create synonym to ordldy;
 grant create session to ordldy;
 
--找到所有的表 做同义词授权 把结果复制出来 执行1次
select 'grant select on '||owner||'.'||object_name||' to ordldy;'
 from dba_objects
 where owner in ('DLDY')
 and object_type='TABLE';
 
 
--找到所有的表 做同义词赋值 把结果复制出来 执行1次
SELECT 'create or replace SYNONYM ordldy. ' || object_name|| ' FOR ' || owner || '.' || object_name|| ';' 
from dba_objects where owner in ('DLDY')
and object_type='TABLE';

 

你可能感兴趣的:(sql)