Query the information of some tables or a table in Oracle (remarks, primary key, owner, etc.)

查询某张或者某些表的整体信息:

/**first**/
select distinct a.table_name,
                 b.comments,
                 A.OWNER,
                 a.tablespace_name,
                 null as is_used
   from all_tables a, all_tab_comments b
where a.table_name = b.table_name
    and a.table_name like '%YOUR_TABLE_SPECIAL_PART%'
    and a.tablespace_name = 'YOUR_TABSPACE_NAME'
  
/**second**/
select distinct a.table_name,
                b.comments,               
                c.constraint_name,
                d.column_name,
                A.OWNER,
                a.tablespace_name,
                null as is_used
from all_tables       a,
       all_tab_comments b,
       all_constraints c,
       all_cons_columns d
where a.table_name = b.table_name
   and b.table_name = c.table_name
   and c.table_name = d.table_name and c.constraint_name = d.constraint_name
   and a.table_name like '%%YOUR_TABLE_SPECIAL_PART%%' and c.constraint_type = 'P'
   and a.tablespace_name = 'YOUR_TABSPACE_NAME'

【编写于 2009-02-13】

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326711120&siteId=291194637