Common Oracle Data Dictionary tables

Source: Internet
Author: User
Common Oracle Data Dictionary tables view the default tablespace of the current user
SQL> select username, default_tablespace from user_users;

View the role of the current user
SQL> select * From user_role_privs;

View the system and table-level permissions of the current user
SQL> select * From user_sys_privs;
SQL> select * From user_tab_privs;

View All tables under a user
SQL> select * From user_tables;

View column attributes of all tables under a user

SQL> select * From user_tab_columns where table_name =: table_name;

Display User Information (tablespace)
Select default_tablespace, temporary_tablespace
From dba_users where username = 'game ';

1. User

View the default tablespace of the current user
SQL> select username, default_tablespace from user_users;

View the role of the current user
SQL> select * From user_role_privs;

View the system and table-level permissions of the current user
SQL> select * From user_sys_privs;
SQL> select * From user_tab_privs;

Displays the permissions of the current session.
SQL> select * From session_privs;

Displays the system permissions of a specified user.
SQL> select * From dba_sys_privs where grantee = 'game ';

Show privileged users
Select * from V $ pwfile_users;

Display User Information (tablespace)
Select default_tablespace, temporary_tablespace
From dba_users where username = 'game ';

Show user profile
Select profile from dba_users where username = 'game ';


2. Tables

View All tables under a user
SQL> select * From user_tables;

View tables whose names contain log characters
SQL> select object_name, object_id from user_objects
Where instr (object_name, 'log')> 0;

View the creation time of a table
SQL> select object_name, created from user_objects where object_name = upper ('& table_name ');

View the size of a table
SQL> select sum (bytes)/(1024*1024) as "size (m)" from user_segments
Where segment_name = upper ('& table_name ');

View the table in the Oracle memory Partition
SQL> select table_name, cache from user_tables where instr (cache, 'y')> 0;

3. Index

View the number and category of Indexes
SQL> select index_name, index_type, table_name from user_indexes order by table_name;

View indexed fields
SQL> select * From user_ind_columns where index_name = upper ('& index_name ');

View index size
SQL> select sum (bytes)/(1024*1024) as "size (m)" from user_segments
Where segment_name = upper ('& index_name ');

4. Serial number

View the serial number. last_number is the current value.
SQL> select * From user_sequences;

5. View

View view name
SQL> select view_name from user_views;

View the SELECT statement for creating a view
SQL> set view_name, text_length from user_views;
SQL> set long 2000; Description: You can set the size of set long based on the text_length value of the view.
SQL> select text from user_views where view_name = upper ('& view_name ');

6. Synonyms

View synonym name
SQL> select * From user_synonyms;

7. Constraints

View the constraints of a table
SQL> select constraint_name, constraint_type, search_condition, r_constraint_name
From user_constraints where table_name = upper ('& table_name ');

SQL> select C. constraint_name, C. constraint_type, CC. column_name
From user_constraints C, user_cons_columns CC
Where C. Owner = upper ('& table_owner') and C. table_name = upper ('& table_name ')
And C. Owner = cc. Owner and C. constraint_name = cc. constraint_name
Order by CC. position;

8. storage functions and processes

View the status of functions and processes
SQL> select object_name, status from user_objects where object_type = 'function ';
SQL> select object_name, status from user_objects where object_type = 'Procedure ';

View functions and processesSource code
SQL> select text from all_source where owner = user and name = upper ('& plsql_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.