
本篇文章重点为大家讲解一下oracle中创建只读账号具体方法,有需要的小伙伴可以参考一下。
创建用户并授权
CREATE USER test identified by mL7TTD5XIt;
grant connect to test;
grant create view to test;
grant create session to test;
grant create synonym to test;
1.2.3.4.5.
将其他可查询的账号的权限提取出来
select 'grant select on '||owner||'.'||object_name||' to test;' from dba_objects where owner in ('OLD_USER') and object_type='TABLE';
1.
执行后得到返回值如下:
将返回值复制出来进行执行
在新账号端创建同位显示表
因为新创建的只读账号,Tables栏中显示为空,我们需要在PL/SQL显示栏中为新账号登录界面添加显示同位元素,如下:
select 'create or replace SYNONYM test.'||object_name|| ' for ' ||owner|| '.'||object_name||';' from dba_objects where owner in ('OLD_USER') and object_type='TABLE';
1.
得到返回值如下:
执行返回值
结果验证
使用刚创建的账号登陆,登陆某一行的数据,提示权限不足
文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/222660.html<