计算shared-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 3502852
  • 博文数量: 718
  • 博客积分: 1860
  • 博客等级: 上尉
  • 技术积分: 7790
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-07 08:51
个人简介

偶尔有空上来看看

文章分类

全部博文(718)

文章存档

2024年(4)

2023年(74)

2022年(134)

2021年(238)

2020年(115)

2019年(11)

2018年(9)

2017年(9)

2016年(17)

2015年(7)

2014年(4)

2013年(1)

2012年(11)

2011年(27)

2010年(35)

2009年(11)

2008年(11)

最近访客
相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: oracle

2022-03-29 21:05:37

貌似没啥用,先记录下来

  1. set echo off
  2. spool pool_est
  3. /*
  4. *********************************************************
  5. * *
  6. * title : shared pool estimation *
  7. * category : information, utility *
  8. * subject area : shared pool *
  9. * description : estimates shared pool utilization *
  10. * based on current database usage. this should be *
  11. * run during peak operation, after all stored *
  12. * objects i.e. packages, views have been loaded. *
  13. * note: modified to work with later versions 4/11/06 *
  14. * *
  15. ********************************************************/
  16. rem if running mts uncomment the mts calculation and output
  17. rem commands.
  18.  
  19. set serveroutput on;
  20.  
  21. declare
  22.         object_mem number;
  23.         shared_sql number;
  24.         cursor_ovh number;
  25.         cursor_mem number;
  26.         mts_mem number;
  27.         used_pool_size number;
  28.         free_mem number;
  29.         pool_size varchar2(512); -- same as v$parameter.value
  30. begin
  31.  
  32. -- stored objects (packages, views)
  33. select sum(sharable_mem) into object_mem from v$db_object_cache
  34. where type <> 'cursor';
  35.  
  36. -- shared sql -- need to have additional memory if dynamic sql used
  37. select sum(sharable_mem) into shared_sql from v$sqlarea;
  38.  
  39. -- user cursor usage -- run this during peak usage.
  40. -- assumes 250 bytes per open cursor, for each concurrent user.
  41. select sum(250*users_opening) into cursor_ovh from v$sqlarea;

  42. select sum(sharable_mem) into cursor_mem from v$db_object_cache
  43. where type='cursor';
  44.  
  45. -- for a test system -- get usage for one user, multiply by # users
  46. -- select (250 * value) bytes_per_user
  47. -- from v$sesstat s, v$statname n
  48. -- where s.statistic# = n.statistic#
  49. -- and n.name = 'opened cursors current'
  50. -- and s.sid = 25; -- where 25 is the sid of the process
  51.  
  52. -- mts memory needed to hold session information for shared server users
  53. -- this query computes a total for all currently logged on users (run
  54. -- during peak period). alternatively calculate for a single user and
  55. -- multiply by # users.
  56. select sum(value) into mts_mem from v$sesstat s, v$statname n
  57.        where s.statistic#=n.statistic#
  58.        and n.name='session uga memory max';
  59.  
  60. -- free (unused) memory in the sga: gives an indication of how much memory
  61. -- is being wasted out of the total allocated.
  62. -- for pre-9i issue
  63. -- select bytes into free_mem from v$sgastat
  64. -- where name = 'free memory';

  65. -- with 9i and newer releases issue
  66. select bytes into free_mem from v$sgastat
  67.         where name = 'free memory'
  68.         and pool = 'shared pool';

  69.  
  70. -- for non-mts add up object, shared sql, cursors and 20% overhead.
  71. -- not including cursor_mem because this is included in shared_sql
  72. used_pool_size := round(1.2*(object_memshared_sql));
  73.  
  74. -- for mts mts contribution needs to be included (comment out previous line)
  75. -- used_pool_size := round(1.2*(object_mem shared_sql mts_mem));

  76. -- pre-9i or if using manual sga management, issue
  77. -- select value into pool_size from v$parameter where name='shared_pool_size';

  78. -- with 9i and 10g and and automatic sga management, issue
  79. select c.ksppstvl into pool_size from x$ksppi a, x$ksppcv b, x$ksppsv c
  80.      where a.indx = b.indx and a.indx = c.indx
  81.        and a.ksppinm = '__shared_pool_size';
  82.  
  83. -- display results
  84. dbms_output.put_line ('obj mem: '||to_char (object_mem) || ' bytes ' || '('
  85. || to_char(round(object_mem/1024/1024,2)) || 'mb)');
  86. dbms_output.put_line ('shared sql: '||to_char (shared_sql) || ' bytes ' || '('
  87. || to_char(round(shared_sql/1024/1024,2)) || 'mb)');
  88. dbms_output.put_line ('cursors: '||to_char (cursor_memcursor_ovh) || ' bytes '
  89. || '('|| to_char(round((cursor_memcursor_ovh)/1024/1024,2)) || 'mb)');
  90. -- dbms_output.put_line ('mts session: '||to_char (mts_mem) || ' bytes');
  91. dbms_output.put_line ('free memory: '||to_char (free_mem) || ' bytes ' || '('
  92. || to_char(round(free_mem/1024/1024,2)) || 'mb)');
  93. dbms_output.put_line ('shared pool utilization (total): '||
  94. to_char(used_pool_size) || ' bytes ' || '(' ||
  95. to_char(round(used_pool_size/1024/1024,2)) || 'mb)');
  96. dbms_output.put_line ('shared pool allocation (actual): '|| pool_size ||
  97. 'bytes ' || '(' || to_char(round(pool_size/1024/1024,2)) || 'mb)');
  98. dbms_output.put_line ('percentage utilized: '||to_char
  99. (round(((pool_size-free_mem) / pool_size)*100)) || '%');
  100. end;
  101. /
  102.  
  103. spool off

  1. select shared_pool_size_for_estimate "size of shared pool in mb",
  2.               shared_pool_size_factor "size factor",
  3.               estd_lc_time_saved "time saved in sec"
  4.          from v$shared_pool_advice;


阅读(694) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图