|
本帖最后由 botang 于 2014-11-27 11:49 编辑
migrate_chain_rows.sql
2014-11-13-index.sql
- create table t05318_d( a number ) ;
- insert into t05318_d values (1) ;
- commit;
- create index i05318_d on t05318_d ( a ) unusable;
- select * from user_segments s where s.segment_name='I05318_D';
- create table t05318_e( a number ) ;
- insert into t05318_e values (1) ;
- commit;
- create index i05318_e on t05318_e ( a ) ;
- select * from user_segments s where s.segment_name='I05318_E';
- alter index i05318_e unusable;
- select * from user_indexes i where i.INDEX_NAME='I05318_E';
- select * from user_segments s where s.segment_name='I05318_E';
- alter index i05318_e rebuild;
- select * from user_indexes i where i.INDEX_NAME='I05318_E';
- select * from user_segments s where s.segment_name='I05318_E';
- ----
- create table t05318_f ( a number )
- partition by range ( a )
- ( partition t05318_f_p1 values less than (10) tablespace users,
- partition t05318_f_p2 values less than (100) tablespace users,
- partition t05318_f_p3 values less than (maxvalue) tablespace example);
-
- select * from user_tables t where t.TABLE_NAME='T05318_F';
-
- select * from user_part_tables ;
-
-
- select * from user_segments s where s.segment_name='T05318_F';
-
- insert into t05318_f values (100) ;
-
- select * from user_segments s where s.segment_name='T05318_F';
-
- insert into t05318_f values (10) ;
-
- select * from user_segments s where s.segment_name='T05318_F';
-
-
- insert into t05318_f values (-0.001) ;
-
-
-
-
-
- select * from user_segments s where s.segment_name='T05318_F';
-
-
-
- create index i05318_f on t05318_f ( a ) local;
-
-
- select * from user_segments s where s.segment_name='I05318_F';
-
-
- alter table t05318_f move partition T05318_F_P3 tablespace users;
-
- select * from user_segments s where s.segment_name='T05318_F';
-
- select * from user_segments s where s.segment_name='I05318_F';
复制代码
2014-11-13-deferred.sql
- select * from CHAINED_ROWS;
- select dbms_rowid.rowid_block_number(rowid) myrow ,count( dbms_rowid.rowid_block_number(rowid) )
- from t05318_migrate group by dbms_rowid.rowid_block_number(rowid) ;
-
- update t05318_migrate set a='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaA';
- commit;
- -----
- create table t05318_a( a number ) ;
- select * from user_tables t where t.TABLE_NAME='T05318_A';
- select * from user_segments s where s.segment_name='T05318_A';
- select * from user_extents e where e.segment_name='T05318_A';
- insert into t05318_a values(1);
- rollback;
- ----
- create table t05318_b( a number ) ;
- select * from user_tables t where t.TABLE_NAME='T05318_B';
- select * from user_segments s where s.segment_name='T05318_B';
- select * from user_extents e where e.segment_name='T05318_B';
- ----
- create table t05318_c ( a number )
- segment creation immediate tablespace example;
-
- select * from user_tables t where t.TABLE_NAME='T05318_C';
- select * from user_segments s where s.segment_name='T05318_C';
- select * from user_extents e where e.segment_name='T05318_C';
- create index i05318_c on t05318_c(a);
- select * from user_segments s where s.segment_name='I05318_C';
复制代码
2014-11-13-comp.sql
- --sys--
- create tablespace tbs_nocompression datafile size 10M autoextend on;
- create tablespace tbs_basic datafile size 10M autoextend on default compress basic;
- create tablespace tbs_oltp datafile size 10M autoextend on default compress for oltp;
- create tablespace tbs_query datafile size 10M autoextend on default compress for query;
- create tablespace tbs_archive datafile size 10M autoextend on default compress for archive;
- select t.tablespace_name, t.def_tab_compression, t.compress_for from dba_tablespaces t
- where t.tablespace_name in ('TBS_NOCOMPRESSION',
- 'TBS_BASIC', 'TBS_OLTP',
- 'TBS_QUERY',
- 'TBS_ARCHIVE');
-
- --hr--
- create table t_nocompression (a varchar2(200)) tablespace tbs_nocompression;
- create table t_basic (a varchar2(200)) tablespace tbs_basic;
- create table t_oltp (a varchar2(200)) tablespace tbs_oltp;
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_nocompression values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_basic values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_oltp values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- select t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
- from user_tables t where t.TABLE_NAME in ('T_NOCOMPRESSION','T_BASIC','T_OLTP');
-
- select count(*) , substr(rowid, 10, 6 ) from hr.t_nocompression group by substr(rowid, 10, 6 );
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic group by substr(rowid, 10, 6 );
- select count(*) , substr(rowid, 10, 6 ) from hr.t_oltp group by substr(rowid, 10, 6 );
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
- from hr.T_NOCOMPRESSION group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
- from hr.T_BASIC group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP',row_id => rowid)
- from hr.T_OLTP group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP',row_id => rowid);
-
-
- --hr--
- create table t_basic2 (a varchar2(200)) tablespace tbs_nocompression compress;
- create table t_oltp2 (a varchar2(200)) tablespace tbs_nocompression compress for oltp;
- --hr-error--
- create table t_query2 (a varchar2(200)) tablespace tbs_nocompression compress for query;
- create table t_archive2 (a varchar2(200)) tablespace tbs_nocompression compress for archive;
- --hr--
- select t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
- from user_tables t where t.TABLE_NAME in ('T_NOCOMPRESSION','T_BASIC','T_OLTP', 'T_BASIC2','T_OLTP2' );
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_basic2 values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_oltp2 values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic2 group by substr(rowid, 10, 6 );
- select count(*) , substr(rowid, 10, 6 ) from hr.t_oltp2 group by substr(rowid, 10, 6 );
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC2',row_id => rowid)
- from hr.T_BASIC2 group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC2',row_id => rowid);
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP2',row_id => rowid)
- from hr.T_OLTP2 group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP2',row_id => rowid);
-
- --hr--
- alter table t_nocompression compress for oltp;
- select t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
- from user_tables t where t.TABLE_NAME in ('T_NOCOMPRESSION','T_BASIC','T_OLTP', 'T_BASIC2','T_OLTP2' );
- select count(*) , substr(rowid, 10, 6 ) from hr.t_nocompression group by substr(rowid, 10, 6 );
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
- from hr.T_NOCOMPRESSION group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
-
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_nocompression values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- select count(*) , substr(rowid, 10, 6 ) from hr.t_nocompression group by substr(rowid, 10, 6 );
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
- from hr.T_NOCOMPRESSION group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
- --hr--
- alter table t_nocompression move tablespace tbs_nocompression;
- select count(*) , substr(rowid, 10, 6 ) from hr.t_nocompression group by substr(rowid, 10, 6 );
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
- from hr.T_NOCOMPRESSION group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
-
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_nocompression values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
-
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
- from hr.T_NOCOMPRESSION group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
-
-
- --hr--
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic group by substr(rowid, 10, 6 );
- insert /*+ append */ into t_basic select * from t_basic;
- commit;
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic group by substr(rowid, 10, 6 );
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
- from hr.T_BASIC group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
-
-
- --hr--
- alter table t_basic move tablespace TBS_NOCOMPRESSION;
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic group by substr(rowid, 10, 6 );
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
- from hr.T_BASIC group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
-
-
-
-
-
复制代码
|
|