1. 程式人生 > >Oracle 檢視 Shared Pool 資訊的相關指令碼

Oracle 檢視 Shared Pool 資訊的相關指令碼

關於Oracle SGA中Shared Pool的詳細說明,參考我的blog:

            在上篇blog裡,介紹了shared pool 的組成和一些原理, 也有一些指令碼,在這篇blog裡,在補充幾個檢視Shared Pool 的指令碼。

一. Quick Check

/* Formatted on 2011/7/21 10:41:56(QP5 v5.163.1008.3004) */

SELECT 'You mayneed to increase the SHARED_POOL_RESERVED_SIZE'Description,

       'RequestFailures = ' || REQUEST_FAILURES Logic

 FROMv$shared_pool_reserved

 WHEREREQUEST_FAILURES > 0

       AND 0 != (SELECT TO_NUMBER (VALUE)

                   FROMv$parameter

                  WHERE NAME = 'shared_pool_reserved_size')

UNION

SELECT 'You maybe able to decrease the SHARED_POOL_RESERVED_SIZE'

          Description,

       'RequestFailures = ' || REQUEST_FAILURES Logic

 FROMv$shared_pool_reserved

 WHEREREQUEST_FAILURES < 5

       AND 0 != (SELECT TO_NUMBER (VALUE)

                   FROMv$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

/* Formatted on 2011/7/21 10:44:32(QP5 v5.163.1008.3004) */

 SELECT OWNER, NAME || ' - ' || TYPE object,SHARABLE_MEM

   FROMv$db_object_cache

  WHERESHARABLE_MEM > 10000

         AND TYPE IN ('PACKAGE', 'PACKAGEBODY', 'FUNCTION', 'PROCEDURE')

ORDER BYSHARABLE_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.

/* Formatted on 2011/7/21 10:45:24(QP5 v5.163.1008.3004) */

 SELECT OWNER, NAME || ' - ' || TYPE object, LOADS

   FROMv$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 theobject

(3)Executions - Total number oftimes this object has been executed

/* Formatted on 2011/7/21 10:46:15(QP5 v5.163.1008.3004) */

 SELECT OWNER, NAME || ' - ' || TYPE object,EXECUTIONS

   FROMv$db_object_cache

  WHEREEXECUTIONS > 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

/* Formatted on 2011/7/21 10:48:52(QP5 v5.163.1008.3004) */

 SELECT OWNER,

         NAME,

         DB_LINK,

         NAMESPACE,

         TYPE,

         SHARABLE_MEM,

         LOADS,

         EXECUTIONS,

         LOCKS,

         PINS

   FROMv$db_object_cache

ORDER BY OWNER, NAME

六.  LibraryCache 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 thecache. 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

/* Formatted on 2011/7/21 10:58:02(QP5 v5.163.1008.3004) */

SELECTNAMESPACE,

       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 thanSHARED_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.

/* Formatted on 2011/7/21 10:59:50(QP5 v5.163.1008.3004) */

SELECT NAME, VALUE

 FROMv$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

/* Formatted on 2011/7/21 11:00:41(QP5 v5.163.1008.3004) */

SELECT NAME, TYPE, KEPT

 FROMv$db_object_cache

 WHERE KEPT = 'YES'

-------------------------------------------------------------------------------------------------------

QQ:492913789

Email:[email protected]

Linkedin: http://cn.linkedin.com/in/tianlesoftware

DBA1 群:62697716(滿);   DBA2 群:62697977(滿)  DBA3 群:62697850(滿)  

DBA 超級群:63306533(滿);  DBA4 群: 83829929  DBA5群: 142216823   

DBA6 群:158654907  聊天 群:40132017   聊天2群:69087192

--加群需要在備註說明Oracle表空間和資料檔案的關係,否則拒絕申請


相關推薦

Oracle 檢視 Shared Pool 資訊相關指令碼

關於Oracle SGA中Shared Pool的詳細說明,參考我的blog:             在上篇blog裡,介紹了shared pool 的組成和一些原理, 也有一些指令碼,在這篇blog裡,在補充幾個檢視Shared Pool 的指令碼。

ORACLE SGA shared pool組成

硬解析即整個SQL語句的執行需要完完全全的解析,生成執行計劃。生成執行計劃需要耗用CPU資源,以及SGA資源。在此不得不提的是對庫快取中閂的使用。閂是鎖的細化,可以理解為是一種輕量級的序列化裝置。當程序申請到閂後,則這些閂用於保護共享記憶體的數在同一時刻不會被兩個以上的程序修改。在硬解析時,需要申請閂的使用,

oracle優化-shared pool

Oracle優化中的shared pool tunning優化。 在oracle優化中,Shared pool的優化應該放在優先考慮,因為一個cache miss在shared pool中發生比在data buffer中發生導致的成本更高,由於dictionary資

oracle 檢視列統計資訊中 low_value

-- 準備環境 create table t1(id int,name varchar2(10)); begin for i in 1001..100000 loop insert into t1 values(i,'china'||to_ch

oracle效能】檢視阻塞表的相關資訊

oracle檢視阻塞表的相關資訊 select t2.username,t2.sid || ',' ||t2.serial# as "sid_terial#",t2.SQL_ID,do.owner, do.OBJECT_NAME,t2.osuser,t2.machine,t2.logon_t

Oracle記憶體全面分析(3)- Buffer Cache的重要檢視和 共享池(Shared pool

1.1.3.3.            Buffer Cache的重要檢視 關於Buffer Cache,oracle提供一些重要檢視,用於查詢關於Buffer Cache的重要資訊,為調整Buffer Cache、提高效能提供參考。下面一一介紹它們 ·        v$db_cache_advice 上

深入理解Oracle中的shared pool與library cache元件及相關等待事件

傳統的’library cache pin’在10.2.0.2之後預設被取代, 此處PIN被Mutex及其ref count取代。 當程序執行遊標語句時或者需要PIN,或者需要hard parse一個子遊標heap。在版本10.2.0.1中, 使用mutex部分程式碼替代PIN的功能預設是不啟用的,

Oracle Shared Pool 原理

and cal ota 內存不足 attach 內存管理 共享服務器 number 3.4 Oracle Shared Pool 原理 由於shared pool中最重要的是library cache,所以本文主要講解Libr

Oracle數據庫大量library cache: mutex X及latch: shared pool問題排查一例

data library end get post nal try 會話 mod 業務系統數據庫夯住,數據庫內大量的library cache: mutex X及latch: shared pool等待,alert日誌信息如下 Tue Sep 26 22:10:04 20

django views.py檢視 獲取使用者請求相關資訊以及請求頭

    請求的其他資訊 使用者發來請求時候,不僅發來資料,也把請求頭也發過來       在views.py 怎麼找請求資料? request是一個物件,這個物件封裝很多資訊,可以先查這個物件的類   print(type(r

35 Oracle深度學習筆記——關於dbms shared pool MARKHOT

35.Oracle深度學習筆記——關於dbms_shared_pool. MARKHOT  歡迎轉載,轉載請標明出處:http://blog.csdn.net/notbaron/article/details/50859148 BMS_SHARED_POOL包提供儲存過程來將PL/SQ

35 Oracle深度學習筆記——關於dbms shared pool MARKHOT

ali sdn 固定 idc num 共享池 font default edit 35.Oracle深度學習筆記——關於dbms_shared_pool. MARKHOT 歡迎轉載,轉載請標明出處:http://blog.csdn.net/notbaron/articl

oracle檢視歸檔大小,刪除歸檔及自動定時刪歸檔的shell指令碼

一  檢視現在用了多少歸檔日誌空間(按百分比): select * from v$flash_recovery_area_usage;     如果超過90%隨時有宕機的危險 二  通過RMAN刪除歸檔日誌,也可以手動找到歸檔日誌存放位置,直接

oracle檢視當前登陸的使用者資訊

檢視當前登陸的使用者名稱: select user from dual; 或者 select * from user_users; 或者 show user 檢視當前使用者擁有的角色和

Oracle記憶體詳解之三 Shared pool 共享池

一. Shared Pool 概述             在之前的blog對Oracle 的記憶體架構也做了一個概述,參考:             在網上搜到一篇介紹shared pool 非常詳細的pdf資料。 原文連結以找不到,但還是要感謝作者Kamus的辛勤

檢視ORACLE 資料庫及表資訊

-- 檢視某表屬於哪個使用者 [根據資料表名稱查詢其歸屬] Note:這裡的資料表名稱均應為大寫格式!! select owner from dba_tables where table_nam

Oracle資料庫查詢表名和欄位的描述資訊SQL指令碼

--查詢欄位型別與名稱描述 select a.Table_name,a.column_name,a.data_type,a.data_length,a.data_precision,a.nullable,a.column_id,b.comments from user_tab

ORACLE 檢視當前連線數、修改最大連線數相關SQL或命令

SQL: 1. 檢視當前的資料庫連線數  select count(*) fromv$process  select count(*) from v$process where program=‘Oracle.EXE(SHAD)’; 2. 檢視資料庫允許的最大連線數  s

Oracle檢視查詢慢之統計資訊收集

今天發現數據庫中有一個檢視執行非常緩慢,查詢從原來的0.4秒左右變慢到3秒多, 查看了sql語句並沒有被修改過,懷疑可能是統計資訊過舊。 --在當前使用者下執行 select 'analyze tab

oracle 查詢操作用的相關資訊 當前操作人 操作人主機名稱 主機ip 連線oracle 外網ip

select banner from v$version;--查詢oracle 版本資訊 環境資訊 select osuser,          machine,          nvl(program, 'sqlplus'),         sys_c