1.查询表的相关信息
select tt1.owner, tt1.table_name, tt1.comments, tt1.last_analyzed, tt1.num_rows, tt2.colcnt from (select t1.owner, t1.table_name, c1.comments, t1.last_analyzed, t1.num_rows from all_tables t1, ALL_TAB_COMMENTS c1 where t1.owner = c1.owner and t1.table_name = c1.table_name) tt1, (select t5.OWNER, t5.TABLE_NAME, count(1) as colcnt from dba_tab_columns t5 where t5.OWNER not in ('SYS', 'SYSTEM', 'OUTLN', 'DIP', 'ORACLE_OCM', 'DBSNMP', 'APPQOSSYS', 'WMSYS', 'EXFSYS', 'CTXSYS', 'XDB', 'ANONYMOUS', 'ORDSYS', 'ORDDATA', 'ORDPLUGINS', 'SI_INFORMTN_SCHEMA', 'MDSYS', 'OLAPSYS', 'MDDATA', 'SPATIAL_WFS_ADMIN_USR', 'SPATIAL_CSW_ADMIN_USR', 'SYSMAN', 'MGMT_VIEW', 'FLOWS_FILES', 'APEX_PUBLIC_USER', 'APEX_030200', 'OWBSYS', 'OWBSYS_AUDIT', 'SCOTT', 'HR', 'OE', 'IX', 'SH', 'PM', 'BI', 'XS$NULL') group by t5.OWNER, t5.TABLE_NAME) tt2 where tt1.owner = tt2.owner and tt1.table_name = tt2.table_name order by tt1.owner, tt1.table_name