1.获取建表语句:
select t.OWNER,t.COLUMN_ID,t.COLUMN_NAME,' ','STRING',concat(concat('COMMENT" ',t2.COMMENTS),'",') as commentname from all_tab_columns t left join all_tab_comments t1 on t.OWNER=t1.OWNER and t.TABLE_NAME=t1.TABLE_NAME left join all_col_comments t2 on t.OWNER=t2.OWNER and t.TABLE_NAME=t2.TABLE_NAME and t.COLUMN_NAME=t2.COLUMN_NAME where t.TABLE_NAME='表名' order by t.OWNER,t.TABLE_NAME,COLUMN_ID;
2.获取字段中间用逗号隔开
select wm_concat(COLUMN_NAME) from ( select t.COLUMN_NAME from all_tab_columns t where t.TABLE_NAME='表名' and t.OWNER='属主'order by t.OWNER,COLUMN_ID)
3.查询表的大小(根据表大小判断是否增量或者全量迁移数据1G一下全量,1G以上增量)
Select Segment_Name,to_char( Sum(bytes) / 1024 / 1024/1024,'FM999999.99') From dba_segments t where t.Segment_Name='表名' Group By Segment_Name