您当前的位置:首页 > 电脑百科 > 数据库 > Oracle

分享Oracle数据库8个实用的查看 Shared Pool 相关脚本

时间:2019-08-27 10:49:17  来源:  作者:

概述

分享一些关于Shared Pool 的脚本,仅供参考。


一、 Quick Check

SELECT 'You may need to increase the SHARED_POOL_RESERVED_SIZE' Description,
 'RequestFailures = ' || REQUEST_FAILURES Logic
 FROM v$shared_pool_reserved
 WHERE REQUEST_FAILURES > 0
 AND 0 != (SELECT TO_NUMBER(VALUE) FROM v$parameter
 WHERE NAME = 'shared_pool_reserved_size')
UNION
SELECT 'You maybe able to decrease the SHARED_POOL_RESERVED_SIZE' Description,
 'RequestFailures = ' || REQUEST_FAILURES Logic
 FROM v$shared_pool_reserved
 WHERE REQUEST_FAILURES < 5
 AND 0 != (SELECT TO_NUMBER(VALUE) FROM v$parameter
 WHERE NAME = 'shared_pool_reserved_size')
分享Oracle数据库8个实用的查看 Shared Pool 相关脚本

 


二、Memory Usage

--SHARED POOL MEMORY USAGE NOTES:
--(1) Owner - Owner of the object
--(2) Object - Name/namespace ofthe object
--(3) Sharable Memory - Amount ofsharable memory in the shared pool consumed by the object
SELECT OWNER, NAME || ' - ' || TYPE object, SHARABLE_MEM
 FROM v$db_object_cache
 WHERE SHARABLE_MEM > 10000
 AND TYPE IN ('PACKAGE', 'PACKAGEBODY', 'FUNCTION', 'PROCEDURE')
 ORDER BY SHARABLE_MEM DESC
分享Oracle数据库8个实用的查看 Shared Pool 相关脚本

 


三、 Loads

--LOADS INTO SHARED POOL NOTES:
--(1)Owner - Owner of the object
--(2)Object - Name/namespace of theobject
--(3)Loads - Number of times theobject has been loaded. This count also increases when an object has beeninvalidated.
SELECT OWNER, NAME || ' - ' || TYPE object, LOADS
 FROM v$db_object_cache
 WHERE LOADS > 3
 AND TYPE IN ('PACKAGE', 'PACKAGEBODY', 'FUNCTION', 'PROCEDURE')
 ORDER BY LOADS DESC
分享Oracle数据库8个实用的查看 Shared Pool 相关脚本

 


四、 Executions

--SHARED POOL EXECUTION NOTES:
--(1)Owner - Owner of the object
--(2)Object - Name/namespace of the object
--(3)Executions - Total number of times this object has been executed
SELECT OWNER, NAME || ' - ' || TYPE object, EXECUTIONS
 FROM v$db_object_cache
 WHERE EXECUTIONS > 100
 AND TYPE IN ('PACKAGE', 'PACKAGEBODY', 'FUNCTION', 'PROCEDURE')
 ORDER BY EXECUTIONS DESC
分享Oracle数据库8个实用的查看 Shared Pool 相关脚本

 


五、Details

--SHARED POOL DETAIL NOTES:
--(1)Owner - Owner of the object
--(2)Name - Name of the object
--(3)DB Link - Database link name,if any
--(4)Namespace - Namespace of theobject
--(5)Type - Type of the object
--(6) Sharable Memory - Amount ofsharable memory in the shared pool consumed by the object
--(7)Loads - Number of times theobject has been loaded. This count also increases when an object has beeninvalidated.
--(8)Executions - Total number oftimes this object has been executed
--(9)Locks - Number of userscurrently locking this object
--(10)Pins - Number of userscurrently pinning this object
SELECT OWNER,
 NAME,
 DB_LINK,
 NAMESPACE,
 TYPE,
 SHARABLE_MEM,
 LOADS,
 EXECUTIONS,
 LOCKS,
 PINS
 FROM v$db_object_cache
 ORDER BY OWNER, NAME
分享Oracle数据库8个实用的查看 Shared Pool 相关脚本

 


六、Library Cache Statistics

--SHARED POOL V$LIBRARYCACHE STATISTIC NOTES:
--(1) Namespace - Library cache namespace (SQL AREA, TABLE/PROCEDURE,BODY, TRIGGER, INDEX, CLUSTER, OBJECT, PIPE)
--(2) Gets - Number of times the system requests handles to libraryobjects belonging to this namespace
--(3) GetHits - Number of times the handles are already allocated in the cache. If the handle is not already allocated, 
-- it is a miss. The handle is thenallocated and inserted into the cache.
--(4) GetHit Ratio - Number of GETHITS divided by GETS. Values close to 1indicate that most of the handles the system has
-- tried to get are cached.
--(5) Pins - Number of times the system issues pin requests for objectsin the cache in order to access them.
--(6) PinHits - Number of times that objects the system is pinning andaccessing are already allocated and initialized in the 
-- cache. Otherwise, it isa miss, and the system has to allocate it in the cache and initialize it withdata queried from 
-- the database or generate the data.
--(7) PinHit Ratio - Number of PINHITS divided by number of PINS. Valuesclose to 1 indicate that most of the objects the 
-- system has tried to pin andaccess have been cached.
--(8) Reloads -Number of times that library objects have to be reinitialized and reloaded withdata because they have been
-- aged out or invalidated.
--(9) Invalidations - Number of times that non-persistent library objects(like shared SQL areas) have been invalidated.
--(10) GetHit Ratio and PinHit Ratio should be > 70
SELECT NAMESPACE,
 GETS,
 GETHITS,
 ROUND(GETHITRATIO * 100, 2) gethit_ratio,
 PINS,
 PINHITS,
 ROUND(PINHITRATIO * 100, 2) pinhit_ratio,
 RELOADS,
 INVALIDATIONS
 FROM v$librarycache
分享Oracle数据库8个实用的查看 Shared Pool 相关脚本

 


七、Reserve Pool Settings

--SHARED POOL RESERVED SIZE NOTES:
--(1)Parameter - Name of theparameter
--(2)Value - Current value for theparameter
--(3)shared_pool_reserved_size -Controls the amount of SHARED_POOL_SIZE reserved for large allocations. 
-- Thefixed view V$SHARED_POOL_RESERVED helps you tune these parameters. Begin thistuning only 
-- after performing all other shared pool tuning on the system.
--(4)shared_pool_reserved_min_alloc - Controls allocation for the reserved memory. To create areserved list, 
--SHARED_POOL_RESERVED_SIZE must be greater thanSHARED_POOL_RESERVED_MIN_ALLOC. Only allocations larger 
--than SHARED_POOL_RESERVED_POOL_MIN_ALLOC can allocate space from the reserved listif a chunk of memory of sufficient 
--size is not found on the shared pool's freelists. The default value of SHARED_POOL_RESERVED_MIN_ALLOC 
-- should be adequatefor most systems.
SELECT NAME, VALUE FROM v$parameter WHERE NAME LIKE '%reser%'
分享Oracle数据库8个实用的查看 Shared Pool 相关脚本

 


八、 Pinned Objects

--PINNED OBJECT NOTES:
--(1)Object Name - Name of theobject
--(2)Object Type - Type of theobject (INDEX, TABLE, CLUSTER, VIEW, SET, SYNONYM, SEQUENCE, PROCEDURE,FUNCTION, PACKAGE, 
-- PACKAGE BODY, TRIGGER, CLASS, OBJECT, USER, DBLINK)
--(3)Kept Status - YES or NO,depending on whether this object has been "kept" (permanently pinnedin memory) 
-- with the PL/SQL procedure DBMS_SHARED_POOL.KEEP
SELECT NAME, TYPE, KEPT FROM v$db_object_cache WHERE KEPT = 'YES'
分享Oracle数据库8个实用的查看 Shared Pool 相关脚本


Tags:Shared Pool   点击:()  评论:()
声明:本站部分内容及图片来自互联网,转载是出于传递更多信息之目的,内容观点仅代表作者本人,如有任何标注错误或版权侵犯请与我们联系(Email:2595517585@qq.com),我们将及时更正、删除,谢谢。
▌相关推荐
概述分享一些关于Shared Pool 的脚本,仅供参考。一、 Quick CheckSELECT &#39;You may need to increase the SHARED_POOL_RESERVED_SIZE&#39; Description, &#39;RequestFai...【详细内容】
2019-08-27  Tags: Shared Pool  点击:(291)  评论:(0)  加入收藏
▌简易百科推荐
安装环境Linux服务器:Centos 6 64位Oracle服务器:Oracle11gR2 64位 系统要求说明:内存必须高于1G的物理内存;交换空间,一般为内存的2倍(1G的内存可以设置swap 分区为3G大小);硬...【详细内容】
2021-12-27  守护梦想2022    Tags:Oracle   点击:(2)  评论:(0)  加入收藏
1、 登陆CentOS 2、 查看备份脚本,脚本放在\usr\local目录下 3、 编写数据库备份脚本,内容如下 前提是需要在Oracle创建directory文件,如果没有,可以create创建并授权给相应的用...【详细内容】
2021-12-10  JasonTang    Tags:Oracle   点击:(14)  评论:(0)  加入收藏
之前写了个Oracle12c在Redhat6.8下的静默安装,操作系统版本太老了而且没配插图,今天重新写个centos 7 下静默安装。 准备环境:centos 7 虚拟机一台,Oracle12c安装包。1、检查防...【详细内容】
2021-10-12  it运维小土豆  今日头条  Tags:Oracle   点击:(29)  评论:(0)  加入收藏
JDK 17 正式发布+免费牛逼啊,JDK 16 刚发布半年(2021/03/16),JDK 17 又如期而至(2021/09/14),这个时间点牛逼啊,蹭苹果发布会的热度?记得当年 JDK 15 的发布也是同天,巧了。。虽然 iPho...【详细内容】
2021-09-16  Java技术栈  掘金  Tags:Oracle   点击:(88)  评论:(0)  加入收藏
Oracle日志文件是Oracle数据库存储信息的重要文件,主要用来存储数据库变化的操作信息。Oracle日志文件可以分为两种:重做日志文件(redo log file)、归档日志文件,其中重做日志文...【详细内容】
2021-08-19  free教程    Tags:Oracle日志   点击:(101)  评论:(0)  加入收藏
本例子在真实环境应用过,获得了很好的体验,特将其分享出来供各位朋友使用。后续我会持续把相关的知识一点一点的更新,请各位多多关注,多多支持。测试速度:导出速度大概800M/s,如...【详细内容】
2021-08-17  大树唛包    Tags:oracle   点击:(88)  评论:(0)  加入收藏
天冒险重启下Oracle rac,分三个步骤,停实例---停集群---重启服务器。 1、关闭实例检查状态su - gridcrsctl status res -t 注意:只在一个节点执行就行,或者为了保险期间,使用shut...【详细内容】
2021-07-16  死磕IT    Tags:Oracle rac   点击:(128)  评论:(0)  加入收藏
两个字符串相似度的比较:SYS.UTL_MATCH.edit_distance_similarity用法:select SYS.UTL_MATCH.edit_distance_similarity(&#39;河北沧州东塑股份有限公司&#39;,&#39;河北沧州东...【详细内容】
2021-07-07  Onceagain75783189    Tags:比较函数   点击:(112)  评论:(0)  加入收藏
现在有一个用户A,想把这个用户A下面的所有的表查询权限都赋予用户X,该怎么做?同样的问题,如果有4个用户A、B、C、D,需要把这4个用户下面所有的表的只读权限赋予用户X、Y、Z三个用...【详细内容】
2021-06-23  程序猿集锦    Tags:Oracle   点击:(103)  评论:(0)  加入收藏
oarcle数据库真正存放数据的是数据文件(data files),Oarcle表空间(tablespaces)实际上是一个逻辑的概念,他在物理上是并不存在的,那么把一组data files 捻在一起就成为一个表空间。...【详细内容】
2021-04-27  SQL小帅哥  今日头条  Tags:Oracle   点击:(200)  评论:(0)  加入收藏
相关文章
    无相关信息
最新更新
栏目热门
栏目头条