Oracle Database Management-query objects and Roles

Source: Internet
Author: User

1. Data Dictionary:
The system information of the database is recorded. It is a set of read-only tables and views. All users of the data dictionary are sys users. You can only execute the SELECT statement on the data dictionary, and the maintenance and modification are automatically completed by the system. The data dictionary includes the data dictionary base table and data dictionary view.
In Oracle, data dictionary Views are divided into three categories, with different prefixes: User, all, and DBA. Many data dictionary views contain similar information.
User _ *: Information about objects owned by users, that is, information about objects created by users
All _ *: Information about objects that can be accessed by users, that is, information about objects created by users plus objects created by other users, which can be accessed by users.
DBA _ *: Information about objects in the entire database

2. query the table corresponding to the user
1) display all tables owned by the current user. It returns only all tables of the corresponding solution.
SQL> select table_name from user_tables;
2) display all tables accessible to the current user. It not only returns all tables of the current user's solution, but also returns tables of other schemes accessible to the current user.
SQL> select table_name from all_tables;
3) it is used to display the database tables owned by all solutions. However, to query this database dictionary view, the user must be a DBA role or have the select any table system permission.
Eg: When the System user queries the data dictionary view dba_tables, the database tables corresponding to the system, sys, Scott · solution are returned.
SQL> conn system/manager;
SQL> select table_name from dba_tables;

3. User Name, permission, and role
1) show the details of all database users
SQL> DESC dba_users;
SQL> select username, password from dba_users;
2) show the system permissions that the user has
SQL> DESC dba_sys_privs
SQL> select * From dba_sys_privs where grantee = 'dba ';
3) show the object permissions that the user has
SQL> DESC dba_tab_privs
SQL> select * From dba_tab_privs where grantee = 'dba'
4) show the user's role
SQL> DESC dba_sys_privs
SQL> select * From dba_role_privs where grantee = 'Scott ';
the user has the role of connect and resource, admin_option cannot be derived

eg:
1) query roles of a user
SQL> select * From dba_role_privs where grantee = 'username';
2) view the system permissions of a role
SQL> select * From dba_sys_privs where grantee = 'connection ';
or
SQL> select * From role_sys_privs where role = 'connection'
eight system permissions (SYSTEM privileges), no object permissions (Object privileges)
3) view a role that includes object permissions
SQL> select * From dba_tab_privs where grantee = 'connection';
4) query all roles in Oracle, generally, it is DBA
SQL> select * From dba_roles;
for example, it has the following roles: connect, resource, DBA
5) query all system permissions in Oracle
SQL> select * From system_privilege_map order by name;
6) query all object permissions in Oracle, generally, it is DBA
SQL> select distinct privilege from dba_tab_privs;
7) query the tablespace of the database
SQL> select tablespace_name from dba_tablespaces;
8) show all data dictionary views that the current user can access
SQL> select * From dict where comments like '% grant %';
9) display the full name of the current database
SQL> select * From global_name;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.