Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

96

积分

0

好友

4

主题
1#
发表于 2012-4-26 10:29:08 | 查看: 6312| 回复: 3
想知道查看oracle sga各个pool的使用情况的sql,越全越好。谢谢啦
2#
发表于 2012-4-26 10:36:59
http://www.oracledatabase12g.com ... -sga-asmm-diag.html


需要脚本请去 oracledatabase12g.com 搜索, 关键词可以使 TERM+ Script  ,例如  SGA  Script

  1. spool auto_sga_diag.log

  2. set line 190 pagesize 1400

  3. SELECT a.SGA_MEM + b.PGA_MEM "TOTAL_MEMORY"
  4.     FROM (SELECT SUM(current_size) / 1024 / 1024 "SGA_MEM"
  5.             FROM v$sga_dynamic_components,
  6.                  (SELECT SUM(pga_alloc_mem) / 1024 / 1024 "PGA_MEM"
  7.                     FROM v$process) a
  8.            WHERE component IN ('shared pool',
  9.                                'large pool',
  10.                                'java pool',
  11.                                'streams pool',
  12.                                'DEFAULT buffer cache')) a,
  13.          (SELECT SUM(pga_alloc_mem) / 1024 / 1024 "PGA_MEM" FROM v$process) b;

  14. select component,
  15.        current_size / 1024 / 1024 "CURRENT_SIZE",
  16.        min_size / 1024 / 1024 "MIN_SIZE",
  17.        user_specified_size / 1024 / 1024 "USER_SPECIFIED_SIZE",
  18.        last_oper_type "TYPE"
  19.   from v$sga_dynamic_components;

  20. select component, granule_size / 1024 / 1024 "GRANULE_SIZE(Mb)"
  21.   from v$sga_dynamic_components;

  22. col component for a25
  23. col status format a10 head "Status"
  24. col initial_size for 999,999,999,999 head "Initial"
  25. col parameter for a25 heading "Parameter"
  26. col final_size for 999,999,999,999 head "Final"
  27. col changed head "Changed At"
  28. col low format 999,999,999,999 head "Lowest"
  29. col high format 999,999,999,999 head "Highest"
  30. col lowMB format 999,999 head "MBytes"
  31. col highMB format 999,999 head "MBytes"

  32. SELECT component,
  33.        parameter,
  34.        initial_size,
  35.        final_size,
  36.        status,
  37.        to_char(end_time, 'mm/dd/yyyy hh24:mi:ss') changed
  38.   FROM v$sga_resize_ops
  39. ORDER BY component;

  40. SELECT component,
  41.        min(final_size) low,
  42.        (min(final_size / 1024 / 1024)) lowMB,
  43.        max(final_size) high,
  44.        (max(final_size / 1024 / 1024)) highMB
  45.   FROM v$sga_resize_ops
  46. GROUP BY component
  47. ORDER BY component;

  48. SELECT name, bytes FROM v$sgainfo;

  49. select * from v$sgastat order by bytes asc;

  50. select name, trunc(bytes / 1024 / 1024, 2) "size(MB)"
  51.   from v$sgastat
  52. where pool is null
  53. union
  54. select pool, trunc(sum(bytes) / 1024 / 1024, 2) "size(MB)"
  55.   from v$sgastat
  56. where pool is not null
  57. group by pool;

  58. select * from V$SGA_CURRENT_RESIZE_OPS;

  59. select * from v$sga_target_advice;

  60. show parameter size
  61. show parameter statistics        

  62. spool off;
复制代码

回复 只看该作者 道具 举报

3#
发表于 2012-4-26 10:40:30

回复 1# 的帖子

好的 非常谢谢 liu

回复 只看该作者 道具 举报

4#
发表于 2012-4-26 11:09:49

回复 2# 的帖子

这个sql有java pool,streams pool,shared pool,large pool的使用情况,但是没有db cache的使用情况,能不能把这个SQL扩得强大一点,加db cache,keep pool的一些使用信息?嘿嘿


select a.pool pool_name,name,trunc(a.pool_size,2)
"sum_pool_size(M)",trunc(b.Free_size,2)
"Free_size(M)",round(b.Free_size/pool_size,2) "free_rent%"
from (select pool,sum(bytes)/1024/1024 pool_size from
sys.v_$sgastat group by pool) a,
(select pool,name,sum(bytes)/1024/1024 Free_size from
sys.v_$sgastat t where t.NAME='free memory' group by pool,name) b
where a.pool=b.pool;

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-25 01:00 , Processed in 0.049400 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569