详解Oracle数据库查看 Shared Pool 信息的相关脚本
sinye56 2024-10-08 16:29 4 浏览 0 评论
概述
分享一些关于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')
二、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
三、 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
四、 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
五、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
六、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
七、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%'
八、 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'
后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~
相关推荐
- Linux基础知识之修改root用户密码
-
现象:Linux修改密码出现:Authenticationtokenmanipulationerror。故障解决办法:进入单用户,执行pwconv,再执行passwdroot。...
- Linux如何修改远程访问端口
-
对于Linux服务器而言,其默认的远程访问端口为22。但是,出于安全方面的考虑,一般都会修改该端口。下面我来简答介绍一下如何修改Linux服务器默认的远程访问端口。对于默认端口而言,其相关的配置位于/...
- 如何批量更改文件的权限
-
如果你发觉一个目录结构下的大量文件权限(读、写、可执行)很乱时,可以执行以下两个命令批量修正:批量修改文件夹的权限chmod755-Rdir_name批量修改文件的权限finddir_nam...
- CentOS「linux」学习笔记10:修改文件和目录权限
-
?linux基础操作:主要介绍了修改文件和目录的权限及chown和chgrp高级用法6.chmod修改权限1:字母方式[修改文件或目录的权限]u代表所属者,g代表所属组,o代表其他组的用户,a代表所有...
- Linux下更改串口的权限
-
问题描述我在Ubuntu中使用ArduinoIDE,并且遇到串口问题。它过去一直有效,但由于可能不必要的原因,我觉得有必要将一些文件的所有权从root所有权更改为我的用户所有权。...
- Linux chown命令:修改文件和目录的所有者和所属组
-
chown命令,可以认为是"changeowner"的缩写,主要用于修改文件(或目录)的所有者,除此之外,这个命令也可以修改文件(或目录)的所属组。当只需要修改所有者时,可使用...
- chmod修改文件夹及子目录权限的方法
-
chmod修改文件夹及子目录权限的方法打开终端进入你需要修改的目录然后执行下面这条命令chmod777*-R全部子目录及文件权限改为777查看linux文件的权限:ls-l文件名称查看li...
- Android 修改隐藏设置项权限
-
在Android系统中,修改某些隐藏设置项或权限通常涉及到系统级别的操作,尤其是针对非标准的、未在常规用户界面显示的高级选项。这些隐藏设置往往与隐私保护、安全相关的特殊功能有关,或者涉及开发者选项、权...
- 完蛋了!我不小心把Linux所有的文件权限修改了!在线等修复!
-
最近一个客户在群里说他一不小心把某台业务服务器的根目录权限给改了,本来想修改当前目录,结果执行成了根目录。...
- linux改变安全性设置-改变所属关系
-
CentOS7.3学习笔记总结(五十八)-改变安全性设置-改变所属关系在以前的文章里,我介绍过linux文件权限,感兴趣的朋友可以关注我,阅读一下这篇文章。这里我们不在做过的介绍,注重介绍改变文件或者...
- Python基础到实战一飞冲天(一)--linux基础(七)修改权限chmod
-
#07_Python基础到实战一飞冲天(一)--linux基础(七)--修改权限chmod-root-groupadd-groupdel-chgrp-username-passwd...
- linux更改用户权限为root权限方法大全
-
背景在使用linux系统时,经常会遇到需要修改用户权限为root权限。通过修改用户所属群组groupid为root,此操作只能使普通用户实现享有部分root权限,普通用户仍不能像root用户一样享有超...
- 怎么用ip命令在linux中添加路由表项?
-
在Linux中添加路由表项,可以使用ip命令的route子命令。添加路由表项的基本语法如下:sudoiprouteadd<network>via<gateway>这...
- Linux配置网络
-
1、网卡名配置相关文件回到顶部网卡名命名规则文件:/etc/udev/rules.d/70-persistent-net.rules#PCIdevice0x8086:0x100f(e1000)...
- Linux系列---网络配置文件
-
1.网卡配置文件在/etc/sysconfig/network-scripts/下:[root@oldboynetwork-scripts]#ls/etc/sysconfig/network-s...
你 发表评论:
欢迎- 一周热门
- 最近发表
- 标签列表
-
- oracle忘记用户名密码 (59)
- oracle11gr2安装教程 (55)
- mybatis调用oracle存储过程 (67)
- oracle spool的用法 (57)
- oracle asm 磁盘管理 (67)
- 前端 设计模式 (64)
- 前端面试vue (56)
- linux格式化 (55)
- linux图形界面 (62)
- linux文件压缩 (75)
- Linux设置权限 (53)
- linux服务器配置 (62)
- mysql安装linux (71)
- linux启动命令 (59)
- 查看linux磁盘 (72)
- linux用户组 (74)
- linux多线程 (70)
- linux设备驱动 (53)
- linux自启动 (59)
- linux网络命令 (55)
- linux传文件 (60)
- linux打包文件 (58)
- linux查看数据库 (61)
- linux获取ip (64)
- linux进程通信 (63)