oracle中怎样查询用户权限
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle中怎样查询用户权限相关的知识,希望对你有一定的参考价值。
"ORACLE数据字典视图的种类分别为:USER,ALL 和 DBA.USER_*:有关用户所拥有的对象信息,即用户自己创建的对象信息
ALL_*:有关用户可以访问的对象的信息,即用户自己创建的对象的信息加上
其他用户创建的对象但该用户有权访问的信息
DBA_*:有关整个数据库中对象的信息
(这里的*可以为TABLES,INDEXES,OBJECTS,USERS等。)
1、查看所有用户
select * from dba_user;
select * from all_users;
select * from user_users;
2、查看用户系统权限
select * from dba_sys_privs;
select * from all_sys_privs;
select * from user_sys_privs;
3、查看用户对象权限
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
4、查看所有角色
select * from dba_roles;
5、查看用户所拥有的角色
select * from dba_role_privs;
select * from user_role_privs;
6、查看当前用户的缺省表空间
select username,default_tablespace from user_users;
7、查看某个角色的具体权限
如grant connect,resource,create session,create view to TEST;
8、查看RESOURCE具有那些权限
用SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE=\'RESOURCE
" 参考技术A 查看用户系统权限:
select * from dba_sys_privs;
select * from session_privs;
select * from user_sys_privs;
查看用户对象权限:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;赞同0| 评论 参考技术B 查看用户系统权限:
select * from dba_sys_privs;
select * from session_privs;
select * from user_sys_privs;
查看用户对象权限:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs; 参考技术C 到PL/SQL里在用户上点右键查看
oracle中怎样让一个用户查询其它用户的trigger?
在工作期间,有时候遇到这种需求,需要将一个用户下的trigger查询权限授予给其他的用户
怎样将某个用户的trigger查询权限,授予其他用户?
方法一:
授予 create any trigger权限。这个权限太大,一般都不会考虑将这种权限授予出去
方法二:
将表的bebug权限授予其他用户。这样就能查看到该用户表上的trigger了
测试:
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 14 10:37:08 2018
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> grant connect to erwa identified by erwa;
Grant succeeded.
SQL> select OWNER,TRIGGER_NAME from all_triggers where owner=‘SCOTT‘;
no rows selected
SQL>
在其他的会话创建一个trigger
[[email protected] ~]$ sqlplus scott/tiger
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 14 11:23:18 2018
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> create or replace trigger test
2 before delete on emp
3 for each row
4 declare
5 -- local variables here
6 begin
7 dbms_output.put_line(‘test‘);
8 end test;
9 /
Trigger created.
SQL>
将表的debug权限授予erwa
SQL> grant debug on emp to erwa;
Grant succeeded.
SQL>
再次查询就可以看到scott下面新建立的trigger
SQL> show user
USER is "ERWA"
SQL> select OWNER,TRIGGER_NAME from all_triggers where owner=‘SCOTT‘;
OWNER TRIGGER_NAME
------------------------------ ------------------------------
SCOTT TEST
SQL>
以上是关于oracle中怎样查询用户权限的主要内容,如果未能解决你的问题,请参考以下文章