您好,欢迎访问一九零五行业门户网

Oracle用户权限 -- 新建用户权限继承另一用户的权限

题记:今天要为监控服务器i2000在现网数据库中新建用户,要求该用户的权限与数据库已经存在的某一用户的权限一致!这里提供了我的
题记:今天要为监控服务器i2000在现网数据库中新建用户,要求该用户的权限与数据库已经存在的某一用户的权限一致!这里提供了我的做法,方法应该不是很好,不知道哪位大侠有更好的方法,希望给予指教,,谢谢!
实验:
要求:新建用户i2ksnmp的权限要和数据库已经存在的dbsnmp用户的权限一样。
1. 创建新用户i2ksnmp
create user i2ksnmp identified by i2ksnmp;
2. 查看dbsnmp用户的所有系统权限
select privilege from dba_sys_privs where grantee='dbsnmp' 
union 
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='dbsnmp' );
如下,得到dbsnmp用户的所有系统权限:
privilege
----------------------------------------
advisor
analyze any
analyze any dictionary
create job
create procedure
create session
create table
manage any queue
select any dictionary
unlimited tablespace
3. 然后将上面的权限都赋予新建用户即可
比如:
grant analyze any dictionary to i2ksnmp;
附加:
这里简单的整合了上面的方法:
set feedback off heading off verify off trimspool off
set pagesize 0 linesize 200
define user=test   ---> 这里是新建用户名
select 'grant  '||privilege||'  to &user;' from dba_sys_privs where grantee = 'dbsnmp'
union 
select 'grant  '||privilege||'  to &user;' from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee = 'dbsnmp');
然后将上面打印在屏幕上的拷贝执行就可以了。
其它类似信息

推荐信息