Data Dictionary and Data Dynamics Performance View

The data dictionary is the most important part of the oracle database, it provides some system information of the database. That is, some static information is stored. The

dynamic performance view records the relevant information after the routine is started. That is to record some frequently changed data


Data dictionary
The data dictionary records the system information of the database. It is a collection of read-only tables and views. The owner of the data dictionary is the sys user
. Users can only perform query operations (select statements) on the data dictionary. , and its maintenance and modification are done automatically by the system.

The composition of the data dictionary: The data dictionary includes the data dictionary base table and the data dictionary view. The base table stores the basic information of the database, and ordinary users cannot directly access the base table of the data dictionary. The data dictionary view is a view established based on the base table of the data dictionary. Ordinary users can obtain system information by querying the data dictionary view.

The data dictionary view mainly includes: user_xxx, all_xxx, dba_xxx three types

user_tables:
used to display all the tables owned by the current user, it only returns all tables of the user's corresponding scheme. For
example: select table_name from user_tables;

all_tables:
used to display the current All tables that the user can access. It will return not only all tables for the current user's schema, but also tables for other schemas that the current user can access.
For example: select table_name from all_tables;

dba_tables:
It will display the database tables of all schema users, but to query this database dictionary view, the user must be a dba user or have the select any table system privilege.
For example: when the system user is used to query the data dictionary view dba_tables, it will return the database table

user name, authority, and role

corresponding to the system, sys, scott... scheme. When creating a user, oracle will store the user's information in the data dictionary. , when a user is granted a permission or a role, oracle will store the permission and role information in the data dictionary.

By querying dba_users , you can display the detailed information of all database users;
by querying the data dictionary view dba_sys_privs , you can display the system privileges the user has;
by querying the data dictionary view dba_tab_privs , you can display the object privileges the user has;
by querying the data dictionary dba_col_privs , you can Display the column privileges the user has;
by querying the database dictionary view dba_role_privs , you can display the roles the user has;


for example: to view the roles scott has, you can query dba_role_privs;
SQL> select * from dba_role_privs where grantee='SCOTT';


1. Query all system privileges in oracle, generally dba
select * from system_privilege_map order by name;

2. Query all object privileges in oracle, generally dba
select distinct privilege from dba_tab_privs;

3. How to query the privileges included in

    a role a. System privileges included in a role
   
    SQL> select * from dba_sys_privs where grantee='role name';
or   
    SQL> select * from role_sys_privs where role='role name ';

    b. Object privileges contained in a role

    SQL> select * from dba_tab_privs where grantee='role name';

Note: the role name needs to be capitalized to indicate


4. Query the tablespace of the database select
tablespace_name from dba_tablespaces;

role, usually dba
select * from dba_roles;

6. How many roles does oracle have
select count(*) from dba_roles;

7. How to check what role a user has
select * from dba_role_privs where grantee='username' ;

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

Display the full name of the current database
select * from global_name;

For example:
SQL> select * from global_name;

GLOBAL_NAME
------- -------------------------------------------------- -----------------------

ORCL


other instructions
The data dictionary records all the system information of the oracle database, and the following system information can be obtained by querying the data dictionary:
1) Object Definition
2) Object occupied space size
3) Column information
4) Constraint information

These information can be queried through the pl/sql developer tool

The dynamic performance view is used to record the activity of the current routine. When the oracle server is started, the system will establish a dynamic performance view; when the oracle server is stopped, the system will delete the dynamic performance view. All dynamic performance views of oracle are displayed in v_$ Started, and Oracle provides corresponding synonyms for each dynamic performance view, and its synonyms all start with v$.
For example, the synonym of v_$datafile is v$datafile; the owner of the dynamic performance view is sys, in general Next, the dynamic performance view is queried by the dba or a privileged user.

It is rarely used in practice, and it is enough to know that there is such a thing.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327069952&siteId=291194637