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

How to query roles in oracle

青灯夜游
Release: 2022-03-17 15:34:54
Original
6614 people have browsed it

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;
Copy after login

2. View the roles owned by the current user:

select * from dba_role_privs;
select * from user_role_privs;
Copy after login

Expand knowledge:

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

select * from user_sys_privs
select * from user_tab_privs
Copy after login

View all tables under the user

select * from user_tables
Copy after login

Display user information (belonging table space)

select default_tablespace,temporary_tablespace from dba_users
Copy after login

Display the permissions of the current session

select * from session_privs
Copy after login

Display the system permissions of the specified user

select * from dba_sys_privs
Copy after login

Display Privileged user

select * from v$pwfile_users
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template