- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-2-29 16:26:56
referece ORA-4031 Common Analysis/Diagnostic Scripts
http://www.oracledatabase12g.com ... nostic-scripts.html- set pages 1000 lines 120
- col name for a60
- col value for a30
- ttitle off
- set heading on
- set feedback on
- SELECT KSMCHCLS CLASS, COUNT(KSMCHCLS) NUM, SUM(KSMCHSIZ) SIZ,
- To_char( ((SUM(KSMCHSIZ)/COUNT(KSMCHCLS)/1024)),'999,999.00')||'k' "AVG SIZE"
- FROM X$KSMSP GROUP BY KSMCHCLS;
- select '0 (<140)' BUCKET,
- KSMCHCLS,
- KSMCHIDX,
- 10 * trunc(KSMCHSIZ / 10) "From",
- count(*) "Count",
- max(KSMCHSIZ) "Biggest",
- trunc(avg(KSMCHSIZ)) "AvgSize",
- trunc(sum(KSMCHSIZ)) "Total"
- from x$ksmsp
- where KSMCHSIZ < 140
- and KSMCHCLS = 'free'
- group by KSMCHCLS, KSMCHIDX, 10 * trunc(KSMCHSIZ / 10)
- UNION ALL
- select '1 (140-267)' BUCKET,
- KSMCHCLS,
- KSMCHIDX,
- 20 * trunc(KSMCHSIZ / 20),
- count(*),
- max(KSMCHSIZ),
- trunc(avg(KSMCHSIZ)) "AvgSize",
- trunc(sum(KSMCHSIZ)) "Total"
- from x$ksmsp
- where KSMCHSIZ between 140 and 267
- and KSMCHCLS = 'free'
- group by KSMCHCLS, KSMCHIDX, 20 * trunc(KSMCHSIZ / 20)
- UNION ALL
- select '2 (268-523)' BUCKET,
- KSMCHCLS,
- KSMCHIDX,
- 50 * trunc(KSMCHSIZ / 50),
- count(*),
- max(KSMCHSIZ),
- trunc(avg(KSMCHSIZ)) "AvgSize",
- trunc(sum(KSMCHSIZ)) "Total"
- from x$ksmsp
- where KSMCHSIZ between 268 and 523
- and KSMCHCLS = 'free'
- group by KSMCHCLS, KSMCHIDX, 50 * trunc(KSMCHSIZ / 50)
- UNION ALL
- select '3-5 (524-4107)' BUCKET,
- KSMCHCLS,
- KSMCHIDX,
- 500 * trunc(KSMCHSIZ / 500),
- count(*),
- max(KSMCHSIZ),
- trunc(avg(KSMCHSIZ)) "AvgSize",
- trunc(sum(KSMCHSIZ)) "Total"
- from x$ksmsp
- where KSMCHSIZ between 524 and 4107
- and KSMCHCLS = 'free'
- group by KSMCHCLS, KSMCHIDX, 500 * trunc(KSMCHSIZ / 500)
- UNION ALL
- select '6+ (4108+)' BUCKET,
- KSMCHCLS,
- KSMCHIDX,
- 1000 * trunc(KSMCHSIZ / 1000),
- count(*),
- max(KSMCHSIZ),
- trunc(avg(KSMCHSIZ)) "AvgSize",
- trunc(sum(KSMCHSIZ)) "Total"
- from x$ksmsp
- where KSMCHSIZ >= 4108
- and KSMCHCLS = 'free'
- group by KSMCHCLS, KSMCHIDX, 1000 * trunc(KSMCHSIZ / 1000)
- /
- SELECT alloc_type, alloc_size, num_objs_flushed, object_loaded
- FROM (SELECT ksmlrcom alloc_type,
- ksmlrsiz alloc_size,
- ksmlrnum num_objs_flushed,
- ksmlrhon object_loaded,
- RANK() OVER(ORDER BY ksmlrsiz DESC) AS order_ranking
- FROM x$ksmlru
- WHERE inst_id = USERENV('INSTANCE')
- AND ksmlrsiz > 0)
- WHERE order_ranking <= 100
- ORDER BY order_ranking
- /
复制代码 |
|