Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

View the information under the current user of Oracle (user, table view, index, tablespace, synonym, etc.)

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report