Bo's Oracle Station

查看: 1779|回复: 0

第64次:2014-11-13 空间管理

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2014-11-14 10:02:02 | 显示全部楼层 |阅读模式
本帖最后由 botang 于 2014-11-27 11:49 编辑

migrate_chain_rows.sql
  1. create table t05318_chain(a varchar2(2000), b varchar2(2000), c varchar2(2000), d varchar2(2000));

  2. insert into t05318_chain(a) values('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';

  7. select  * from t05318_chain;

  8. select  * from CHAINED_ROWS;

  9. analyze table t05318_chain  list chained rows;

  10. select  * from CHAINED_ROWS;

  11. update t05318_chain set d='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';

  12. analyze table t05318_chain  list chained rows;

  13. select  * from CHAINED_ROWS;

  14. select  * from dba_tablespaces;

  15. select  * from dba_Tables t where t.owner='HR' and t.table_name='T05318_CHAIN';

  16. create tablespace tbs16k  datafile size 5M blocksize  16384;

  17. alter system set db_16k_cache_size=1M;

  18. create tablespace tbs16k  datafile size 5M blocksize  16384;

  19. alter table hr.T05318_CHAIN move tablespace tbs16k;

  20. select  * from CHAINED_ROWS;

  21. analyze table t05318_chain  list chained rows;


  22. select  * from CHAINED_ROWS;

  23. -----

  24. create table t05318_migrate( a varchar2(2000))  pctfree 0;

  25. truncate  table t05318_migrate;

  26. begin
  27.    for i in 1..733
  28.    loop
  29.       insert into  t05318_migrate values('A');
  30.     end loop;
  31.     commit;
  32. end;


  33. analyze table t05318_migrate  list chained rows;

  34. select  * from CHAINED_ROWS;

  35. select     distinct dbms_rowid.rowid_block_number(rowid)
  36.    from t05318_migrate;


  37. select      dbms_rowid.rowid_block_number(rowid)  myrow ,count( dbms_rowid.rowid_block_number(rowid)  )
  38.    from t05318_migrate  group by    dbms_rowid.rowid_block_number(rowid)     ;
  39.    
  40.    insert into    t05318_migrate values('A');
  41.    
  42.    
  43.    update  t05318_migrate set a='AAAAAA';
  44.    
  45.    analyze table t05318_migrate  list chained rows;

  46. select  * from CHAINED_ROWS;

  47. select     distinct dbms_rowid.rowid_block_number(rowid)
  48.    from t05318_migrate;


  49. select      dbms_rowid.rowid_block_number(rowid)  myrow ,count( dbms_rowid.rowid_block_number(rowid)  )
  50.    from t05318_migrate  group by    dbms_rowid.rowid_block_number(rowid)     ;
  51.    
  52.    select * from user_Tables t where t.TABLE_NAME='T05318_MIGRATE';
  53.    
  54.    
  55.    alter table T05318_MIGRATE  move tablespace users;
  56.    
  57.    truncate table CHAINED_ROWS;
  58.    
  59.    analyze table t05318_migrate  list chained rows;

  60. select  * from CHAINED_ROWS;

  61. select     distinct dbms_rowid.rowid_block_number(rowid)
  62.    from t05318_migrate;


  63. select      dbms_rowid.rowid_block_number(rowid)  myrow ,count( dbms_rowid.rowid_block_number(rowid)  )
  64.    from t05318_migrate  group by    dbms_rowid.rowid_block_number(rowid)     ;
  65.    
  66.    
复制代码

2014-11-13-index.sql
  1. create table t05318_d( a number ) ;

  2. insert into t05318_d values (1) ;

  3. commit;

  4. create index i05318_d on t05318_d ( a )  unusable;

  5. select  * from user_segments s where s.segment_name='I05318_D';


  6. create table t05318_e( a number ) ;

  7. insert into t05318_e values (1) ;

  8. commit;

  9. create index i05318_e on t05318_e ( a ) ;

  10. select  * from user_segments s where s.segment_name='I05318_E';

  11. alter index i05318_e unusable;

  12. select  * from user_indexes i where i.INDEX_NAME='I05318_E';

  13. select  * from user_segments s where s.segment_name='I05318_E';


  14. alter index i05318_e rebuild;

  15. select  * from user_indexes i where i.INDEX_NAME='I05318_E';

  16. select  * from user_segments s where s.segment_name='I05318_E';

  17. ----



  18. create table t05318_f ( a  number )
  19. partition by  range ( a )
  20. ( partition t05318_f_p1 values less than (10)  tablespace users,
  21.    partition t05318_f_p2 values less than (100)  tablespace users,
  22.     partition t05318_f_p3 values less than (maxvalue)  tablespace example);
  23.    
  24.     select * from user_tables t where t.TABLE_NAME='T05318_F';
  25.    
  26.     select * from user_part_tables  ;
  27.    
  28.    
  29.     select * from user_segments s where s.segment_name='T05318_F';
  30.    
  31.     insert into t05318_f values (100) ;
  32.    
  33.         select * from user_segments s where s.segment_name='T05318_F';
  34.         
  35.         insert into t05318_f values (10) ;
  36.    
  37.     select * from user_segments s where s.segment_name='T05318_F';
  38.    
  39.    
  40.        insert into t05318_f values (-0.001) ;
  41.       
  42.       
  43.       
  44.       
  45.       
  46.         select * from user_segments s where s.segment_name='T05318_F';
  47.    
  48.    
  49.    
  50.     create index i05318_f  on t05318_f ( a )  local;
  51.    
  52.    
  53.          select * from user_segments s where s.segment_name='I05318_F';
  54.          
  55.          
  56.          alter table t05318_f move partition T05318_F_P3  tablespace users;
  57.          
  58.                  select * from user_segments s where s.segment_name='T05318_F';
  59.                  
  60.                    select * from user_segments s where s.segment_name='I05318_F';
复制代码

2014-11-13-deferred.sql

  1. select  * from CHAINED_ROWS;

  2. select      dbms_rowid.rowid_block_number(rowid)  myrow ,count( dbms_rowid.rowid_block_number(rowid)  )
  3.    from t05318_migrate  group by    dbms_rowid.rowid_block_number(rowid)     ;
  4.    
  5. update  t05318_migrate set a='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaA';

  6. commit;

  7. -----
  8. create table t05318_a( a number ) ;

  9. select * from user_tables t where t.TABLE_NAME='T05318_A';

  10. select  * from user_segments s where s.segment_name='T05318_A';

  11. select  * from user_extents e where e.segment_name='T05318_A';

  12. insert into t05318_a values(1);

  13. rollback;

  14. ----

  15. create table t05318_b( a number ) ;

  16. select * from user_tables t where t.TABLE_NAME='T05318_B';

  17. select  * from user_segments s where s.segment_name='T05318_B';

  18. select  * from user_extents e where e.segment_name='T05318_B';

  19. ----

  20. create table t05318_c ( a number )
  21. segment creation  immediate  tablespace example;

  22. select * from user_tables t where t.TABLE_NAME='T05318_C';

  23. select  * from user_segments s where s.segment_name='T05318_C';

  24. select  * from user_extents e where e.segment_name='T05318_C';

  25. create index  i05318_c on   t05318_c(a);

  26. select  * from user_segments s where s.segment_name='I05318_C';
复制代码

2014-11-13-comp.sql
  1. --sys--
  2. create tablespace tbs_nocompression datafile size 10M autoextend on;

  3. create tablespace tbs_basic datafile size 10M autoextend on default compress basic;

  4. create tablespace tbs_oltp datafile size 10M autoextend on default compress for oltp;


  5. create tablespace tbs_query datafile size 10M autoextend on default compress for query;


  6. create tablespace tbs_archive datafile size 10M autoextend on default compress for archive;


  7. select  t.tablespace_name, t.def_tab_compression, t.compress_for  from dba_tablespaces t
  8. where t.tablespace_name in ('TBS_NOCOMPRESSION',
  9.                                                   'TBS_BASIC', 'TBS_OLTP',
  10.                                                    'TBS_QUERY',
  11.                                                    'TBS_ARCHIVE');
  12.                                                    
  13.    --hr--                                                   
  14. create table t_nocompression (a varchar2(200)) tablespace tbs_nocompression;

  15. create table t_basic (a varchar2(200)) tablespace tbs_basic;

  16. create table t_oltp (a varchar2(200)) tablespace tbs_oltp;                                                
  17.                                                    --hr--
  18. begin
  19.    for i in 1..400
  20.    loop
  21.       insert into t_nocompression values('AAAAAAAAAAAAAAAAAAAA');
  22.    end loop;
  23.    commit;
  24. end;
  25. --hr--
  26. begin
  27.    for i in 1..400
  28.    loop
  29.       insert into t_basic values('AAAAAAAAAAAAAAAAAAAA');
  30.    end loop;
  31.    commit;
  32. end;
  33. --hr--
  34. begin
  35.    for i in 1..400
  36.    loop
  37.       insert into t_oltp values('AAAAAAAAAAAAAAAAAAAA');
  38.    end loop;
  39.    commit;
  40. end;  
  41. --hr--
  42. select  t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
  43. from user_tables t where t.TABLE_NAME   in ('T_NOCOMPRESSION','T_BASIC','T_OLTP');

  44. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_nocompression  group by  substr(rowid, 10, 6 );

  45. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_basic  group by  substr(rowid, 10, 6 );      


  46. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_oltp  group by  substr(rowid, 10, 6 );  

  47. --sys--
  48. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
  49.       from hr.T_NOCOMPRESSION  group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
  50. --sys--
  51. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
  52.       from hr.T_BASIC group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
  53. --sys--      
  54. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP',row_id => rowid)
  55.       from hr.T_OLTP group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP',row_id => rowid);
  56.       
  57.      
  58. --hr--      
  59. create table t_basic2 (a varchar2(200)) tablespace tbs_nocompression compress;
  60. create table t_oltp2 (a varchar2(200)) tablespace tbs_nocompression compress for oltp;
  61. --hr-error--
  62. create table t_query2 (a varchar2(200)) tablespace tbs_nocompression compress for query;
  63. create table t_archive2 (a varchar2(200)) tablespace tbs_nocompression compress for archive;     
  64. --hr--
  65. select  t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
  66. from user_tables t where t.TABLE_NAME   in ('T_NOCOMPRESSION','T_BASIC','T_OLTP',  'T_BASIC2','T_OLTP2' );
  67.   --hr--
  68. begin
  69.    for i in 1..400
  70.    loop
  71.       insert into t_basic2 values('AAAAAAAAAAAAAAAAAAAA');
  72.    end loop;
  73.    commit;
  74. end;
  75. --hr--
  76. begin
  77.    for i in 1..400
  78.    loop
  79.       insert into t_oltp2 values('AAAAAAAAAAAAAAAAAAAA');
  80.    end loop;
  81.    commit;
  82. end;   

  83. --hr--
  84. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_basic2  group by  substr(rowid, 10, 6 );
  85. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_oltp2  group by  substr(rowid, 10, 6 );


  86. --sys--
  87. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC2',row_id => rowid)
  88.       from hr.T_BASIC2 group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC2',row_id => rowid);
  89. --sys--      
  90. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP2',row_id => rowid)
  91.       from hr.T_OLTP2 group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP2',row_id => rowid);
  92.       
  93.    --hr--
  94. alter table t_nocompression compress for oltp;
  95. select  t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
  96. from user_tables t where t.TABLE_NAME   in ('T_NOCOMPRESSION','T_BASIC','T_OLTP',  'T_BASIC2','T_OLTP2' );
  97. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_nocompression  group by  substr(rowid, 10, 6 );   
  98.   --sys--
  99. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
  100.    from hr.T_NOCOMPRESSION  group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
  101.    
  102. --hr--
  103. begin
  104.    for i in 1..400
  105.    loop
  106.       insert into t_nocompression values('AAAAAAAAAAAAAAAAAAAA');
  107.    end loop;
  108.    commit;
  109. end;
  110. --hr--
  111. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_nocompression  group by  substr(rowid, 10, 6 );  

  112. --sys--
  113. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
  114.       from hr.T_NOCOMPRESSION  group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
  115.    --hr--
  116. alter table t_nocompression move tablespace tbs_nocompression;
  117. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_nocompression  group by  substr(rowid, 10, 6 );      

  118. --sys--
  119. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
  120.       from hr.T_NOCOMPRESSION  group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
  121.       
  122.     --hr--
  123. begin
  124.    for i in 1..400
  125.    loop
  126.       insert into t_nocompression values('AAAAAAAAAAAAAAAAAAAA');
  127.    end loop;
  128.    commit;
  129. end;   
  130.       
  131. --sys--
  132. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
  133.       from hr.T_NOCOMPRESSION  group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
  134.       
  135.       
  136.   --hr--
  137. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_basic  group by  substr(rowid, 10, 6 );  
  138. insert /*+ append */ into t_basic select  * from  t_basic;
  139. commit;
  140. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_basic  group by  substr(rowid, 10, 6 );

  141. --sys--
  142. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
  143.       from hr.T_BASIC group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
  144.       
  145.       
  146.       --hr--
  147. alter table t_basic move tablespace  TBS_NOCOMPRESSION;
  148. select  count(*)  , substr(rowid, 10, 6 ) from hr.t_basic  group by  substr(rowid, 10, 6 );

  149. --sys--
  150. select   count(*)  ,    dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
  151.       from hr.T_BASIC group by     dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
  152.       
  153.       
  154.    
  155.       
  156.       
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-4 16:22 , Processed in 0.038697 second(s), 25 queries .

快速回复 返回顶部 返回列表