待续
平台:windows 2000 sp3
DB :Oracle 9.0.1.1.1
用statspack对数据库进行性能监测发现Top 1等待事件是db file sequential read,在增大数据库表、索引的freelists后,性能改变不大。由于该数据库的标准块大小为4k,使用的数据库版本是bug多多的901,所以保持业务表数据不变,规划使用16k的表空间来存放大表的索引(就算出错,重建索引即可)。
-- 首先配置初始化参数并创建表空间
sql>conn / as sysdba
sql>alter system set db_16k_cache_size=100m scope=both;
sql>create tablespace global_gryszm_index_16k datafile ‘%ORADATA%global_gryszm_index_16k_ 01.dbf’ size 1000m blocksize 16k;
我们来看看块大小变化前索引的统计信息
column index_name format a30
select
index_name ,
num_rows ,
avg_leaf_blocks_per_key l_blocks,
avg_data_blocks_per_key d_blocks,
clustering_factor cl_fac,
blevel
from user_indexes
where table_name = ‘JF_YLYSZM’
/
INDEX_NAME NUM_ROWS L_BLOCKS D_BLOCKS CL_FAC BLEVEL
IDX_JF_YLYSZM_DWID00_JZNYUE 24902405 7 24 1266585 3
IDX_JF_YLYSZM_GMSFHM 24812266 1 101 20646456 3
IDX_JF_YLYSZM_GRBH00_NYUE00 24812266 1 1 22685500 3
PRIMARYKEY_YLYSZM 24443477 1 1 24443474 3
UNIQUE_YLYSZM 24474797 1 1 22338997 3
通过在线rebuild索引把索引move到新的表空间上:
sql>alter index IDX_JF_YLYSZM_DWID00_JZNYUE reduild online tablespace global_gryszm_index_16k;
sql>alter index IDX_JF_YLYSZM_GMSFHM reduild online tablespace global_gryszm_index_16k;
sql>alter index IDX_JF_YLYSZM_GRBH00_NYUE00 reduild online tablespace global_gryszm_index_16k;
sql>alter index PRIMARYKEY_YLYSZM reduild online tablespace global_gryszm_index_16k;
sql>alter index UNIQUE_YLYSZM reduild online tablespace global_gryszm_index_16k;
块大小变化后索引的统计信息:
column index_name format a30
select
index_name ,
num_rows ,
avg_leaf_blocks_per_key l_blocks,
avg_data_blocks_per_key d_blocks,
clustering_factor cl_fac,
blevel
from user_indexes
where table_name = ‘JF_YLYSZM’
/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/6906/viewspace-21556/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/6906/viewspace-21556/