Top Oracle shared pool scripts
2016-03-22 00:06
411 查看
Top Oracle shared pool scripts Oracle Tips by Burleson Consulting |
A shortage ofshared pool RAM may result in high library cache reloads, high row cachereloads, and shared pool latch contention. You may also see the error:"ORA-04031: Out of shared pool memory".
Also see Oracle shared poollatch internals.
Oracle shared poolscripts
Here are somecommon shared pool scripts for monitoring the shared pool. For a completeset of shared pool scripts, see my book "Oracle
Tuning: TheDefinitive Reference", with 950 pages of tuning tips andscripts.
select *
from(
select
name, bytes/(1024*1024) MB
from
v$sgastat
where
pool ='shared pool'
order by
bytes desc
)
where rownum < 20;
We also needscripts to monitor for non-reentrant SQL (SQL without bind variables, which canbe corrected by setting cursor_sharing=force). This shared pool script willidentify SQL where "executions=1", indicating
nonreentrant SQL:
select
count(1) num_sql,
sum(decode(executions, 1, 1, 0)) one_use_sql,
sum(sharable_mem)/1024/1024 meg_used,
sum(decode(
executions, 1,
sharable_mem, 0)
)/1024/1024 mb_per
from
v$sqlarea
where
sharable_mem > 0;
This shared poolscript will display shared pool data from STATSPACK:
set lines80;
set pages 999;
column mydate heading 'Yr. Mo Dy Hr.' format a16
column c1 heading "execs" format 9,999,999
column c2 heading "Cache Misses|While Executing" format 9,999,999
column c3 heading "Library Cache|Miss Ratio" format 999.99999
break on mydate skip 2;
select
to_char(snap_time,'yyyy-mm-dd HH24') mydate,
sum(new.pins-old.pins) c1,
sum(new.reloads-old.reloads) c2,
sum(new.reloads-old.reloads)/
sum(new.pins-old.pins) library_cache_miss_ratio
from
stats$librarycache old,
stats$librarycache new,
stats$snapshot sn
see code depot for full scripts
where
new.snap_id = sn.snap_id
and
old.snap_id = new.snap_id-1
and
old.namespace = new.namespace
group by
to_char(snap_time,'yyyy-mm-dd HH24')
;
This shared poolscript will use the automatic workload repository (AWR) for a time-series lookat the shared pool:
columnenqueue_deadlocks format 999,999,999
select
to_char(sn.end_interval_time,'dd Mon HH24:mi:ss') mydate,
a.value enqueue_deadlocks
from
dba_hist_sysstat a,
dba_hist_snapshot sn
see code depot for full scripts
where
sn.snap_id = (select max(snap_id) from dba_hist_snapshot)
and a.snap_id = sn.snap_id
and a.stat_name = 'enqueue deadlocks'
;
相关文章推荐
- Oracle Concepts - Guidelines for Tuning the Oracle Shared Pool
- Oracle Concepts - General Guidelines for Shared Pool Sizing
- Oracle12c的数据库向11g导进的方法
- Oracle Shared Pool Advisory Utility
- Oracle Concepts - Shared Pool
- oracle中rownum的理解
- Oracle新建数据库和用户及表空间
- oracle学习笔记系列------oracle操作例子的专用表
- ORACLE 11G flashback 相关讨论
- oracle学习笔记系列------oracle 基本操作之基本函数的用法
- c3p0连接oracle数据库单元测试
- Oracle归档日志管理
- Oracle数据库语句大全
- 第十七讲--Oracle存储结构:段区块
- oracle基于odbc建立dblink访问sqlserver
- sql中的text字段如何导入oracle
- oracle的客户,就可以使用pl/sql访问远程oracle 数据库的方法
- oracle 用 imp 导入数据 指定用户,密码,ip , 端口 和表单
- 第十六讲--Oracle存储结构:表空间
- 第十五讲--Oracle存储结构:文件