背景:有时候需要给数据库创建只读用户分给不同权限的数据使用人员


环境:oracle11G


操作步骤:

1.创建用户  

sql>create user new_username identified by new_passwd;


2.赋予新用户连接权限

sql>grant connect to new_username;


3.生成SQL脚本

select 'grant select on '||owner||'.'||object_name||' to new_username;'from dba_objects where owner in ('old_username') and object_type in ('TABLE', 'VIEW', 'SEQUENCE');


4.执行第3步生成的SQL脚本



操作实例图:

153240276.jpg