生产环境经常有这样的需求:创建只读用户,防止用户误操作
简单列出步骤:
使用具有dba权限用户登录
1.创建新用户
create user xx_report identified xx_report temporary tablespace temp;
2.赋予用户登陆权限
grant connect to xx_report ;
3.赋予查询权限(可以根据需求针对单表进行授权)
grant select any table to xx_report ;
4.赋予新用户创建同义词权限
grant create synonym to xx_report;
5.使用xx_report登陆数据库,测试查询权限是否正常,正常后创建同义词
select * from aaa.city; (aaa 指需要授权的用户)
create synonym city for aaa.city; (同义词名字可以随意取,不超过oracle 31字符限制即可)
6.使用dba权限用户登录,收回xx_report 创建同义词权限。
revoke create synonym from xx_report;
至此,只读用户以及使用同义词创建别名完成。
简单列出步骤:
使用具有dba权限用户登录
1.创建新用户
create user xx_report identified xx_report temporary tablespace temp;
2.赋予用户登陆权限
grant connect to xx_report ;
3.赋予查询权限(可以根据需求针对单表进行授权)
grant select any table to xx_report ;
4.赋予新用户创建同义词权限
grant create synonym to xx_report;
5.使用xx_report登陆数据库,测试查询权限是否正常,正常后创建同义词
select * from aaa.city; (aaa 指需要授权的用户)
create synonym city for aaa.city; (同义词名字可以随意取,不超过oracle 31字符限制即可)
6.使用dba权限用户登录,收回xx_report 创建同义词权限。
revoke create synonym from xx_report;
至此,只读用户以及使用同义词创建别名完成。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14855094/viewspace-681046/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14855094/viewspace-681046/