13. Oracle Data dictionary and dynamic performance view

Source: Internet
Author: User
Tags dba

First, the concept
The data dictionary is the most important part of the Oracle database, and it provides some system information about the database.
The dynamic performance View records information about the startup of the routine.

Second, the data dictionary
1), the data dictionary records the system Information of the database, which is a collection of read-only tables and views, the owner of the data dictionary is the SYS user.
2), the user can only perform query operations (SELECT statements) on the data dictionary, and its maintenance and modifications are automatically completed by the system.
3), here we talk about the composition of the data dictionary: The data Dictionary includes the data Dictionary base table and the data dictionary view, where the base table stores the basic information of the database, the ordinary user cannot directly access the data dictionary base table. The Data dictionary view is a view based on the base table of the data dictionary, and the normal user can obtain system information by querying the data dictionary view. The data dictionary view consists mainly of user_xxx,all_xxx,dba_xxx three types.

User_tables: Used to display all tables owned by the current user, which only returns all tables of the user's corresponding scheme
For example: SELECT table_name from User_tables;

All_tables: Used to display all tables that the current user can access, which not only returns all tables for the current user scenario, but also returns tables for other scenarios that the current user can access
For example: SELECT table_name from All_tables;

Dba_tables: It displays the database tables owned by all the scenarios. However, querying this view of the database dictionary requires that the user must be a DBA role or have select any table system permissions.
For example: When querying the data dictionary view dba_tables with the system user, the System,sys,scott is returned ... The database table corresponding to the scenario.

Third, user name, permissions, role
When a user is established, Oracle stores the user's information in a data dictionary, and Oracle stores the permissions and role information in the data dictionary when the user is granted permissions or roles.
Query Dba_users can display the details of all database users;
By querying the data dictionary view Dba_sys_privs, you can display the system permissions that the user has;
By querying the data dictionary view Dba_tab_privs, you can display the object permissions that the user has;
Query the data dictionary Dba_col_privs can display the user has the column permission;
By querying the database dictionary view dba_role_privs you can display the roles that the user has.

Here's a talk about the relationship between roles and permissions.
1), to see the role Scott has, can query dba_role_privs;
Sql> SELECT * from Dba_role_privs where grantee= ' SCOTT ';
2), query all system permissions in Orale, usually DBA
SELECT * from System_privilege_map order by name;
3), querying all object permissions in Oracle, typically DBA
Select distinct privilege from Dba_tab_privs;
4), querying all roles in Oracle, typically DBA
SELECT * from Dba_roles;
5), Query the table space of the database
Select Tablespace_name from Dba_tablespaces;

Question 1: How do I query the permissions that a role includes?
A. System permissions that a role contains
SELECT * from Dba_sys_privs where grantee= ' role name '
Alternatively, you can view this:
SELECT * from Role_sys_privs where role= ' role name '
B. The object permissions that a role contains
SELECT * from Dba_tab_privs where grantee= ' role name '

Question 2:oracle How many kinds of roles are there?
Sql> select * from Dba_roles;

Question 3: How do I see what role a user has?
SELECT * from Dba_role_privs where grantee= ' username '

Displays all data dictionary views that the current user can access.
SELECT * from dict where comments like '%grant% ';

Displays the full name of the current database
SELECT * from Global_name;

Other instructions
The data dictionary records all system information for the Oracle database. The following system information can be obtained by querying the data dictionary: for example,
1. Definition of objects
2. Object Occupy space size
3. Column information
4. Constraint information
...
But because of this information, it can be queried by the PL/SQL developer tool, so here I am drifting.

Four, dynamic performance view
The dynamic performance view is used to record the activity information of the current routine, and when the Oracle server is started, a dynamic performance view is established and the dynamic performance view is removed when the Oracle server is stopped. All of Oracle's dynamic performance views start with v_$, and Oracle provides synonyms for each dynamic performance view, with synonyms starting with v$, such as v_$datafile synonyms v$datafile; Dynamic Performance View's owner is SYS , the dynamic performance view is typically queried by a DBA or a privileged user.
Because this is used less in practice, so fly over

13. Oracle Data dictionary and dynamic performance view

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.