Home  >  Article  >  Database  >  How to query roles in oracle

How to query roles in oracle

青灯夜游
青灯夜游Original
2022-03-17 15:34:546595browse

Query method: 1. Use "select*from dba_roles;" to view all roles; 2. Use "select*from dba_role_privs;" or "select * from user_role_privs;" to view the roles owned by the current user .

How to query roles in oracle

The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.

What is a role

A role. A role is a set of permissions. If a role is assigned to a user, the user will have all the permissions in the role.

Permission management is the essence of the Oracle system. Different users who log in to the same database may see different numbers of tables and have different permissions.

Oracle’s permissions are divided into system permissions and data object permissions. There are more than 100 types in total. It would be awkward to authorize users individually. Some users need the same permissions, so these users are classified into the same Class - a certain role, which simplifies and clearly authorizes operations by setting up some roles with predetermined permissions. The motivation for the emergence of roles is to simplify permission management. It is a collection of permissions.

The general approach is: the system assigns permissions to roles, and then assigns the roles to users. Of course, you can also directly assign certain permissions to users. Oracle provides fine-grained permissions. Permissions can be set individually for a certain column of the table, and where restrictions can be automatically added to a user's query of a certain table.

Oracle's roles are stored in the table dba_roles, the system permissions contained in a role are stored in dba_sys_privs, and the object permissions included are stored in dba_tab_privs.

oracle query role

1. View all roles:

select * from dba_roles;

2. View the roles owned by the current user:

select * from dba_role_privs;
select * from user_role_privs;

Expand knowledge:

View the system permissions and table-level permissions of the current user

select * from user_sys_privs
select * from user_tab_privs

View all tables under the user

select * from user_tables

Display user information (belonging table space)

select default_tablespace,temporary_tablespace from dba_users

Display the permissions of the current session

select * from session_privs

Display the system permissions of the specified user

select * from dba_sys_privs

Display Privileged user

select * from v$pwfile_users

recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to query roles in oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn