如何通过查询获取表空间中包含某特定字符的所有表名称?数据库为oracle,谢谢!

解决方案 »

  1.   

    dba_tables
      

  2.   

    补充下:如果你的表还包括分区表,最好加上dba_tab_partitions和dba_tab_subpartitions
      

  3.   

    select * from dba_tables where tablename like and tablespce_name=
      

  4.   

    每一行都是动态sql。循环执行输出。
    select max(str1)  ||
           max(ext_str)  ||
           replace(replace(to_char(wm_concat(str2) ), ',', ''), '$*||', ',') || 
           ')'
      from (
    select ' select max(''' || t1.OWNER || '.' || t1.TABLE_NAME || ''') from ' || t1.OWNER || '.' || t1.TABLE_NAME || ' where 1 = 1 and exists(' str1,
           ' or instr(' || t1.COLUMN_NAME || ', ' || '$*|| ''字符串''' || ') > 0' str2,
           ' select 1 from ' || t1.OWNER || '.' || t1.TABLE_NAME || ' where 1 = 2 ' ext_str,
           t1.OWNER || '.' || t1.TABLE_NAME part_str
      from all_tab_columns t1
     where t1.OWNER = upper('user_name')
       --and t1.TABLE_NAME = upper('table_name')
    ) t1
    group by part_str
    ;