select sql_text
from v$sqltext
where address in
(select sql_address from v$session where terminal=userenv('TERMINAL'))
order by hash_value,piece
2>对查询出来的语句利用PL/SQL进行分析。查看该语句用到的索引情况。
例:Select * from gy_yhxx where zgid = ‘123’
说明:用到了索引名为PK_ZGID 的索引。
Select * from gy_yhxx where zgid = ‘123’
说明:没有用到任务索引,全表检索。对于这种情况就要查原因,是不是表索引没有建好,或者是因为其他原因产生的。
3>分析造成索引利用不上原因
1.确定是否对表的索引是否创建。
2.查看最近是否对表进行了分析造成该表的执行计划改变。
select * from dba_tables where last_analyzed is not null and owner = 'ZJHIS' and TABLE_NAME = '表名'
order by last_analyzed desc;
删除表统计信息。
analyze table tname delete statistics;
收集统计信息
analyze table tname compute statistics ;
analyze table tname estimate statistics sample 20 percent;
初始化文件配置一直不合理
.db_cache
oracle805/8i
show parameter db_block_buffers;
show parameter db_block_size;
db_cache = db_block_buffers * db_block_size / 1024/1024 单位M
oracle9i
show parameter db_cache_size; 单位 bytes
oracle10g
show parameter sga_target; 单位 bytes
or
show parameter db_cache_size;
4.2.2.shared_pool_size
show parameter shared_pool_size;
shared_pool_size = shared_pool_size/1024/1024 单位 M
db_block_size是不允许修改的,它一般为2048 。可以通过修改db_block_buffer 来改变SGA的大小,SGA的大小一般在200M左右,当然要看考虑服务器的承受能力,一般SGA的大小占服务器内存的0.2~0.3倍之间。
Db_block_buffer *db_block_size /1024/1024 = 服务器内存* 0.2 ~ 0.3
shared_pool_size 开销通常在300M以内,除非系统使用了大量的存储过程、函数、包。可能会达到更高500M。大概1G的内存shared_pool_size = 100M,2G的内存shared_pool_size = 150M,下载本文