View information under Oracle Current user (user, table view, index, tablespace, synonym, stored procedure function, constraints)

Source: Internet
Author: User

0. Table Space

Sql>Select Username,default_tablespace from User_users;

View the role of the current user

Sql>SELECT * from User_role_privs;

View system and table-level permissions for the current user

Sql>select * from User_sys_privs;

Sql>select * from User_tab_privs;

View all the tables under the user

Sql>SELECT * from User_tables;

1. Users

View the default tablespace for the current user

Sql>Select Username,default_tablespace from user_users; only the tables that are owned by the current user are queried.

Sql>select * from Dba_tables where owner= ' username ';--user name to capitalize, query all tables

View the role of the current user

Sql>SELECT * from User_role_privs;

View system and table-level permissions for the current user

Sql>select * from User_sys_privs;

Sql>select * from User_tab_privs;

Displays the permissions that the current session has

Sql>select * from Session_privs;

Displays the system permissions that the specified user has

Sql>select * from Dba_sys_privs where grantee= ' GAME ';

2. Table

View all the tables under the user

Sql>SELECT * from User_tables;

  SELECT * from All_tables;

View a table with a name that contains a log character

Sql>select object_name,object_id from User_objects where InStr (object_name, ' LOG ') >0;

To 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 tables placed in Oracle's memory area

Sql>select Table_name,cache from User_tables where InStr (Cache, ' Y ') >0;

3. Index

View index number and category

Sql>select Index_name,index_type,table_name from User_indexes ORDER by TABLE_NAME;

View the fields indexed by the index

Sql>select * from User_ind_columns where Index_name=upper (' &index_name ');

To view the size of an index

Sql>select sum (bytes)/(1024*1024) as "size (M)" from User_segments where Segment_name=upper (' &index_name ');

4. Serial number

View serial number, Last_number is the current value

Sql>select * from User_sequences;

5. View

View the name of the view

Sql>Select view_name from User_views;

View the SELECT statement that created the view

Sql>set view_name,text_length from User_views;

Sql>set Long 2000; Description: The size of the set long can be set according to the Text_length value of the view

Sql>select text from User_views where View_name=upper (' &view_name ');

6. Synonyms

View the name of a synonym

Sql>select * from user_synonyms;

SELECT * from all_sysnonyms;

7. Constraint conditions

View constraints on 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 procedures

View the status of functions and procedures

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 source code for functions and procedures

Sql>select text from All_source where Owner=user and Name=upper (' &plsql_name ');

View information under Oracle Current user (user, table view, index, tablespace, synonym, stored procedure function, constraints)

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.