Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1209572
  • 博文数量: 398
  • 博客积分: 10110
  • 博客等级: 上将
  • 技术积分: 4055
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-23 20:01
个人简介

新博客http://www.cnblogs.com/zhjh256 欢迎访问

文章分类

全部博文(398)

文章存档

2012年(1)

2011年(41)

2010年(16)

2009年(98)

2008年(142)

2007年(100)

我的朋友

分类: Oracle

2007-12-25 13:48:12

STEVEN原创
-- Script: ideal_cache_size.sql
-- Purpose: to suggest an ideal number of buffers for each buffer pool
-- Description: This script assumes that the ideal number of buffers in each
--  pool is the current number, plus the number of buffers due to
--  be heated, less free buffers and hot buffers due to be cooled.
--
--  Of course, the ideal will fluctuate from moment to moment.
--  So the script should be run several times under distinct
--  workload peaks before drawing any firm conclusions.

select /*+ ordered use_hash(b) */
  n.bp_name  buffer_pool,
  count(*)  current_buffers,
  count(*) +
  count(decode(lru_flag, 0, decode(tch, 0, null, 1, null, 1))) -
  count(decode(state, 0, 1, decode(lru_flag, 8, decode(tch, 0, 1, 1, 1))))
    ideal_buffers
from
  (
    select /*+ ordered */
      p.bp_name,
      s.addr
    from
      sys.x$kcbwbpd  p,
      sys.x$kcbwds  s
    where
      s.inst_id = userenv('Instance') and
      p.inst_id = userenv('Instance') and
      s.set_id >= p.bp_lo_sid and
      s.set_id <= p.bp_hi_sid and
      p.bp_size != 0
  )  n,
  sys.x$bh b
where
  b.inst_id = userenv('Instance') and
  b.set_ds = n.addr
group by
  n.bp_name
/
@restore_sqlplus_settings
-------------------------------------------------------------------------------
--
-- To do: If KEEP or RECYCLE have no hot region, suggest that instead.
--
-------------------------------------------------------------------------------
阅读(564) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~