ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 检查角色和权限设置

检查角色和权限设置

原创 Linux操作系统 作者:golden_zhou 时间:2011-09-15 17:44:17 0 删除 编辑
本节包含了多个V$脚本,用于显示各种安全权限。下列程序清单中每个脚本的标题将简要说明了它们
将检索的信息。输出结果依据系统不同可能很大,因此要小心运行。
根据用户名进行授权的对象级特权
select b.owner || '.' || b.table_name obj,
b.privilege what_granted, b.grantable,
a.username
from sys.dba_users a, sys.dba_tab_privs b
where a.username = b.grantee
order by 1,2,3;
根据被授权人进行授权的对象级特权
Select owner || '.' || table_name obj,
privilege what_granted, grantable, grantee
from sys.dba_tab_privs
where not exists
(select 'x'
from sys.dba_users
where username = grantee)
order by 1,2,3;
315
根据用户名进行授予的系统级特权
select b.privilege what_granted,
b.admin_option, a.username
from sys.dba_users a, sys.dba_sys_privs b
where a.username = b.grantee
order by 1,2;
根据被授权人进行授予的系统级特权
select privilege what_granted,
admin_option, grantee
from sys.dba_sys_privs
where not exists
(select 'x' from sys.dba_users
where username = grantee)
order by 1,2;
根据用户名授予的角色
select b.granted_role ||
decode(admin_option, 'YES',
' (With Admin Option)',
null) what_granted, a.username
from sys.dba_users a, sys.dba_role_privs b
where a.username = b.grantee
order by 1;
根据被授权人授予的角色
select granted_role ||
decode(admin_option, 'YES',
' (With Admin Option)', null) what_granted,
grantee
from sys.dba_role_privs
where not exists
(select 'x'
from sys.dba_users
where username = grantee)
order by 1;
316
用户名及已被授予的相应权限
select a.username,
b.granted_role || decode(admin_option,'YES',
' (With Admin Option)',null) what_granted
from sys.dba_users a, sys.dba_role_privs b
where a.username = b.grantee
UNION
select a.username,
b.privilege || decode(admin_option,'YES',
' (With Admin Option)', null) what_granted
from sys.dba_users a, sys.dba_sys_privs b
where a.username = b.grantee
UNION
select a.username,
b.table_name || ' - ' || b.privilege
|| decode(grantable,'YES',
' (With Grant Option)',null) what_granted
from sys.dba_users a, sys.dba_tab_privs b
where a.username = b.grantee
order by 1;
技巧:
记录系统中已有的特权,这样您就可以应对各种类型的安全场景。
查询用户名及相应的配置文件、默认的表空间和临时表空间
Select username, profile, default_tablespace,
temporary_tablespace, created
from sys.dba_users
order by username;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25198367/viewspace-707606/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 等待事件V$视图
请登录后发表评论 登录
全部评论

注册时间:2011-03-09

  • 博文量
    238
  • 访问量
    344445