Oracle Static data Dictionary

Source: Internet
Author: User

SELECT * from User_tab_comments a where a.comments like '% operation% ' data dictionary look up all tables in the database with the word "action"

static Data dictionary
This type of data dictionary consists primarily of tables and views, and it should be noted that tables in the data dictionary are not directly accessible, but can access the views in the data dictionary. Views in a static data dictionary are divided into three categories, each of which is made up of three prefixes: user_*, all_*, dba_*.


User_*
This view stores information about the objects that are owned by the current user. (That is, all objects in this user mode)

All_*
The attempt is made to store information about the objects that the current user can access. (all_* does not need to have the object as compared to user_*, only the right to access the object)

dba_*
This view stores information about all the objects in the database. (If the current user has permission to access these databases, you must generally have Administrator privileges)
As can be seen from the above description, the data stored between the three will certainly overlap, in fact, they are in addition to the scope of access (because the permissions are different, so the scope of access to the object is not the same), others have consistency. Specifically, because the data dictionary view is owned by the SYS (System user), in the case of a state, only SYS and users with DBA system privileges can see all views. Users who do not have DBA authority can only see user_* and all_*. If the relevant SELECT permission is not granted, they cannot see the dba_* view.
Because of the similarity of the three, the following example introduces several common static views in User_:
user_users View
mainly describes the current user's information, including the current user name, account ID, account status, tablespace name, creation time, and so on. For example, you can return this information by executing the following command.
SELECT * from User_users

user_tables View
This paper mainly describes the information of all the tables owned by the current user, including the table name, table space name, cluster name and so on. This view provides a clear understanding of what tables the current user can manipulate. The Execute command is: SELECT * from User_tables

user_objects View
It mainly describes the information of all objects owned by the current user, including tables, views, stored procedures, triggers, packages, indexes, sequences, and so on. This view is more comprehensive than the User_tables view. For example, to obtain information about an object type named "Package1" and its status, you can execute the following command:
  

Select Object_type,status
From User_objects
where Object_name=upper (' package1 ');

Note: The use of upper, all objects in the data dictionary are uppercase, and PL/SQL is not case sensitive, so be sure to pay attention to case matching in practice.

User_tab_privs View
The view is primarily to store permission information for all tables under the current user. For example, to understand the current user's permissions to table1, you can execute the following command:

SELECT * from User_tab_privs where Table_name=upper (' table1 ')
Knowing the current user's permissions on the table gives you a clear idea of what actions can be performed and what actions cannot be performed.
The previous view is User_, but the All_ beginning is exactly the same, but the information listed is the object that the current user can access instead of the current user. For Dba_ to start with administrator privileges, other uses are exactly the same, here is not to repeat.

-----------------------------------------------------------------------------------------------------------

select * from dictionary;

--Query which tables the user owns

--user_tables mainly describes the information of all tables owned by the current user.

----mainly include table name, table space name, cluster name, and so on. This view provides a clear understanding of what tables the current user can manipulate

Desc User_tables;

Select table_name from User_tables;

SELECT * from User_tables;

--Query which indexes the user owns

Select Index_name from User_indexes;

--Query What views the user has

Select View_name from User_views;

--Query the database objects that the user owns, including tables, views, stored procedures, triggers, packages, indexes, sequences, Java files, and so on.

Select object_name from User_objects;

--mainly describes the current user's information, including the current user name, account ID, account status, table space name, creation time, and so on.

SELECT * from User_users;

-----------------------------------------------------------------------------------------------------------

--user_/all_ differences:

The information listed----All_ is the object that the current user can access, not the current user-owned object.

--Query all the tables, procedures, functions and other information under a certain user.

Select owner, object_name, object_type from All_objects

-----------------------------------------------------------------------------------------------------------

--for Dba_ to start with administrator privileges,

--Querying tablespace information (the current user must have a DBA role).

SELECT * FROM Dba_data_files

-----------------------------------------------------------------------------------------------------------

Oracle Static data Dictionary

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.