View the information under the current user of Oracle (user, table view, index, tablespace, synonym, etc.)
1. Users
View the current user's default tablespace
SQL > select username,default_tablespace from user_users
View the role of the current user
SQL > select * from user_role_privs
View the system permissions and table-level permissions of the current user
SQL > select * from user_sys_privs;SQL > select * from user_tab_privs
Displays the permissions for the current session
SQL > select * from session_privs
Displays the system permissions of the specified user
SQL > select * from dba_sys_privs where grantee='EZXX'
2. Table
View all the tables under the user
SQL > select * from user_tables
View a table whose name contains 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 memory area of ORACLE
SQL > select table_name,cache from user_tables where instr (cache,'Y') > 0
3. Index
View the number of indexes and categories
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')
View the size of the index
SQL > select sum (bytes) / (1024-1024) as "size (M)" from user_segments where segment_name=upper ('& index_name')
4. Serial number
Check the 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 creates the view
SQL > set view_name,text_length from user_views;SQL > set long 2000; note: you can set the size of set long according to the text_ value of the view SQL > select text from user_views where view_name=upper ('& view_name')
6. Synonyms
View the name of the synonym
SQL > select * from user_synonyms
7. Constraint conditions
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. Originalnamereagenc. Originaltypedcc.columnaccountname from user_constraints cmeme userconsensual 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. Store 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 the source code of functions and procedures
SQL > select text from all_source where owner=user and name=upper ('& plsql_name')
9. View the table creation statement
SELECT DBMS_METADATA.GET_DDL ('TABLE','TABLE_NAME') FROM DUAL; # (table name TABLE_NAME must be capitalized)