标签:
》共享sql:
1、统一书写风格
2、使用绑定变量
》》找出没有共享的SQL语句:
在v$sql查找执行次数较小的SQL语句,观察这些SQL语句是否是经常执行的。
select SQL_FULLTEXT from v$sql where EXECUTIONS=1 and sql_text like ‘%from t%‘;
select SQL_FULLTEXT from v$sql where EXECUTIONS=1 order by sql_text; --将执行次数只有一次的语句列出,同时排序
》解析命中率:
select sum(pinhits)/sum(pins)*100 from v$librarycache; --软解析
select sum(gets),sum(getmisses),100*sum(gets-getmisses)/sum(gets) from v$rowcache where gets>0;
》解决4031错误方法
1、alter system flush shared_pool; --临时手段
2、共享sql
alter system set cursor_sharing=‘force‘;
3、select * from v$db_object_cache where sharable_mem > 10000
and (type = ‘PACKAGE‘ or type=‘PACKAGE BODY‘ or type=‘FUNCTION‘ or type=‘PROCEDURE‘)
and kept = ‘NO‘;
执行dbms_shared_pool.keep(‘上一条语句出来的对象名‘);
DBMS_SHARED_POOL
@?/rdbms/admin/dbmspool.sql
4、保留区
select REQUEST_MISSES from v$shared_pool_reserved;
show parameter shared;
5、增加shared pool空间
select COMPONENT,CURRENT_SIZE from V$SGA_DYNAMIC_COMPONENTS;
show parameter sga_target
show parameter sga_max_size
alter system set shared_pool_size=150M scope=both;--Oracle 默认会有159M,只能修改比159M大
标签:
原文地址:http://www.cnblogs.com/wystan/p/5100480.html