创建测试用表,,dba经常用到,通常都是基于dba_objects来创建的比较多。本文根据tom大师的big_table进行了整理,供大家参考。
一、基于oracle 10g下的big_table
--==============================================-- create a test table for oracle 10g-- file : cr_big_tb_10g.sql-- author : robinson-- blog : --==============================================promptpromptcreate a big table from all_objectsprompt ======================================create table big_tableas select rownum id, a.*from all_objects awhere 1=0;promptprompt modify table to nologgming modeprompt ==========================alter table big_table nologging;prompt promptplease input rows number to fill into big_tableprompt============================================declarel_cnt number;l_rows number := &1;begininsert /*+ append */into big_tableselect rownum, a.*from all_objects a;l_cnt := sql%rowcount;commit;while (l_cnt user,tabname => 'big_table',method_opt => 'for all indexed columns',cascade => true);end; /prompt promptcheck total rows for big_table prompt====================================select count(*)from big_table;二、基于oracle 11g下的big_table
--==============================================-- create a test table for oracle 11g-- file : cr_big_tb_11g.sql-- author : robinson-- blog : --==============================================promptpromptcreate a big table from all_objectsprompt ======================================create table big_tableas select rownum id, a.*from all_objects awhere 1=0;promptprompt modify table to nologgming modeprompt ==========================alter table big_table nologging;prompt promptplease input rows number to fill into big_tableprompt============================================declarel_cnt number;l_rows number := &1;begininsert /*+ append */into big_tableselect rownum, a.*from all_objects a;l_cnt := sql%rowcount;commit;while (l_cnt user,tabname => 'big_table',method_opt => 'for all indexed columns',cascade => true);end; /prompt promptcheck total rows for big_table prompt====================================select count(*)from big_table;
