oracle 如何查看授予另一个用户的架构哪些权限

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14604576/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:49:04  来源:igfitidea点击:

How to see what privileges are granted to schema of another user

oracle

提问by Bharti Pandita

Consider the case : In a database , I have two users A and B and their corresponding schema.

考虑这种情况:在一个数据库中,我有两个用户 A 和 B 以及它们对应的模式。

I want to know , How can I get the information : what permissions are there for USER A in Schema B .

我想知道,如何获取信息:架构 B 中的用户 A 有哪些权限。

Consider the case : We have two users and their associated scehmas. We have user A and user B. In A, say we have TB1 TB2, in B,say we have TBa, TBb. Now I want to know how can I find what privileges User A has on Schema B.

考虑这种情况:我们有两个用户和他们关联的 sehmas。我们有用户 A 和用户 B。在 A 中,假设我们有 TB1 TB2,在 B 中,假设我们有 TBa,TBb。现在我想知道如何找到用户 A 对架构 B 的权限。

For example : User A is writing : select * from B.TBbThis means USER A is accessing User B's table so , it shows he has SELECT Privilege. I want to know what all privileges User A has on Schema B.

例如:用户 A 正在写入:select * from B.TBb这意味着用户 A 正在访问用户 B 的表,因此,这表明他具有 SELECT 权限。我想知道用户 A 对架构 B 拥有的所有权限。

Which query shall be executed to get the list of privileges that User A has on Schema B.

应该执行哪个查询来获取用户 A 对模式 B 的权限列表。

回答by Donato Szilagyi

You can use these queries:

您可以使用这些查询:

select * from all_tab_privs;
select * from dba_sys_privs;
select * from dba_role_privs;

Each of these tables have a granteecolumn, you can filter on that in the where criteria:

这些表中的每一个都有一grantee列,您可以在 where 条件中对其进行过滤:

where grantee = 'A'

To query privileges on objects (e.g. tables) in other schema I propose first of all all_tab_privs, it also has a table_schemacolumn.

要查询我首先建议的其他模式中对象(例如表)的权限all_tab_privs,它也有一个table_schema列。

If you are logged in with the same user whose privileges you want to query, you can use user_tab_privs, user_sys_privs, user_role_privs. They can be queried by a normal non-dba user.

如果您使用要查询其权限的同一用户登录,则可以使用user_tab_privsuser_sys_privsuser_role_privs。普通的非 dba 用户可以查询它们。

回答by JuanRios

Use example with from the post of Szilágyi Donát.

使用来自Szilágyi Donát帖子的示例

I use two querys, one to know what roles I have, excluding connect grant:

我使用两个查询,一个是知道我有哪些角色,不包括连接授权:

SELECT * FROM USER_ROLE_PRIVS WHERE GRANTED_ROLE != 'CONNECT'; -- Roles of the actual Oracle Schema

SELECT * FROM USER_ROLE_PRIVS WHERE GRANTED_ROLE != 'CONNECT'; -- Roles of the actual Oracle Schema

Know I like to find what privileges/roles my schema/user have; examples of my roles ROLE_VIEW_PAYMENTS & ROLE_OPS_CUSTOMERS. But to find the tables/objecst of an specific role I used:

知道我喜欢查找我的架构/用户拥有的权限/角色;我的角色 ROLE_VIEW_PAYMENTS 和 ROLE_OPS_CUSTOMERS 的示例。但是要找到我使用的特定角色的表/对象:

SELECT * FROM ALL_TAB_PRIVS WHERE GRANTEE='ROLE_OPS_CUSTOMERS'; -- Objects granted at role.

SELECT * FROM ALL_TAB_PRIVS WHERE GRANTEE='ROLE_OPS_CUSTOMERS'; -- Objects granted at role.

The owner schema for this example could be PRD_CUSTOMERS_OWNER (or the role/schema inself).

此示例的所有者架构可以是 PRD_CUSTOMERS_OWNER(或角色/架构本身)。

Regards.

问候。

回答by RDB

Login into the database. then run the below query

登录数据库。然后运行以下查询

select * from dba_role_privs where grantee = 'SCHEMA_NAME';

select * from dba_role_privs where grantee = 'SCHEMA_NAME';

All the role granted to the schema will be listed.

将列出授予架构的所有角色。

Thanks Szilagyi Donatfor the answer. This one is taken from same and just where clause added.

感谢Szilagyi Donat的回答。这个是取自相同的,只是添加了 where 子句。