您的位置:首页 > 数据库 > Oracle

Oracle 查看 Shared Pool 信息的相关脚本

2011-07-21 11:11 549 查看
关于OracleSGA中SharedPool的详细说明,参考我的blog:

OracleSharedpool详解

/article/1448961.html

在上篇blog里,介绍了sharedpool的组成和一些原理,也有一些脚本,在这篇blog里,在补充几个查看SharedPool的脚本。

From:http://vsbabu.org/oracle/sect13.html

一.QuickCheck

/*Formattedon2011/7/2110:41:56(QP5v5.163.1008.3004)*/

SELECT'YoumayneedtoincreasetheSHARED_POOL_RESERVED_SIZE'Description,

'RequestFailures='||REQUEST_FAILURESLogic

FROMv$shared_pool_reserved

WHEREREQUEST_FAILURES>0

AND0!=(SELECTTO_NUMBER(VALUE)

FROMv$parameter

WHERENAME='shared_pool_reserved_size')

UNION

SELECT'YoumaybeabletodecreasetheSHARED_POOL_RESERVED_SIZE'

Description,

'RequestFailures='||REQUEST_FAILURESLogic

FROMv$shared_pool_reserved

WHEREREQUEST_FAILURES<5

AND0!=(SELECTTO_NUMBER(VALUE)

FROMv$parameter

WHERENAME='shared_pool_reserved_size')

二.MemoryUsage

SHAREDPOOLMEMORYUSAGENOTES:

(1)Owner-Owneroftheobject

(2)Object-Name/namespaceoftheobject

(3)SharableMemory-Amountofsharablememoryinthesharedpoolconsumedbytheobject

/*Formattedon2011/7/2110:44:32(QP5v5.163.1008.3004)*/

SELECTOWNER,NAME||'-'||TYPEobject,SHARABLE_MEM

FROMv$db_object_cache

WHERESHARABLE_MEM>10000

ANDTYPEIN('PACKAGE','PACKAGEBODY','FUNCTION','PROCEDURE')

ORDERBYSHARABLE_MEMDESC

三.Loads

LOADSINTOSHAREDPOOLNOTES:

(1)Owner-Owneroftheobject

(2)Object-Name/namespaceoftheobject

(3)Loads-Numberoftimestheobjecthasbeenloaded.Thiscountalsoincreaseswhenanobjecthasbeeninvalidated.

/*Formattedon2011/7/2110:45:24(QP5v5.163.1008.3004)*/

SELECTOWNER,NAME||'-'||TYPEobject,LOADS

FROMv$db_object_cache

WHERELOADS>3

ANDTYPEIN('PACKAGE','PACKAGEBODY','FUNCTION','PROCEDURE')

ORDERBYLOADSDESC

四.Executions

SHAREDPOOLEXECUTIONNOTES:

(1)Owner-Owneroftheobject

(2)Object-Name/namespaceoftheobject

(3)Executions-Totalnumberoftimesthisobjecthasbeenexecuted

/*Formattedon2011/7/2110:46:15(QP5v5.163.1008.3004)*/

SELECTOWNER,NAME||'-'||TYPEobject,EXECUTIONS

FROMv$db_object_cache

WHEREEXECUTIONS>100

ANDTYPEIN('PACKAGE','PACKAGEBODY','FUNCTION','PROCEDURE')

ORDERBYEXECUTIONSDESC

五.Details

SHAREDPOOLDETAILNOTES:

(1)Owner-Owneroftheobject

(2)Name-Nameoftheobject

(3)DBLink-Databaselinkname,ifany

(4)Namespace-Namespaceoftheobject

(5)Type-Typeoftheobject

(6)SharableMemory-Amountofsharablememoryinthesharedpoolconsumedbytheobject

(7)Loads-Numberoftimestheobjecthasbeenloaded.Thiscountalsoincreaseswhenanobjecthasbeeninvalidated.

(8)Executions-Totalnumberoftimesthisobjecthasbeenexecuted

(9)Locks-Numberofuserscurrentlylockingthisobject

(10)Pins-Numberofuserscurrentlypinningthisobject

/*Formattedon2011/7/2110:48:52(QP5v5.163.1008.3004)*/

SELECTOWNER,

NAME,

DB_LINK,

NAMESPACE,

TYPE,

SHARABLE_MEM,

LOADS,

EXECUTIONS,

LOCKS,

PINS

FROMv$db_object_cache

ORDERBYOWNER,NAME

六.LibraryCacheStatistics

SHAREDPOOLV$LIBRARYCACHESTATISTICNOTES:

(1)Namespace-Librarycachenamespace(SQLAREA,TABLE/PROCEDURE,BODY,TRIGGER,INDEX,CLUSTER,OBJECT,PIPE)

(2)Gets-Numberoftimesthesystemrequestshandlestolibraryobjectsbelongingtothisnamespace

(3)GetHits-Numberoftimesthehandlesarealreadyallocatedinthecache.Ifthehandleisnotalreadyallocated,itisamiss.Thehandleisthenallocatedandinsertedintothecache.

(4)GetHitRatio-NumberofGETHITSdividedbyGETS.Valuescloseto1indicatethatmostofthehandlesthesystemhastriedtogetarecached.

(5)Pins-Numberoftimesthesystemissuespinrequestsforobjectsinthecacheinordertoaccessthem.

(6)PinHits-Numberoftimesthatobjectsthesystemispinningandaccessingarealreadyallocatedandinitializedinthecache.Otherwise,itisamiss,andthesystemhastoallocateitinthecacheandinitializeitwithdataqueriedfromthedatabaseorgeneratethedata.

(7)PinHitRatio-NumberofPINHITSdividedbynumberofPINS.Valuescloseto1indicatethatmostoftheobjectsthesystemhastriedtopinandaccesshavebeencached.

(8)Reloads-Numberoftimesthatlibraryobjectshavetobereinitializedandreloadedwithdatabecausetheyhavebeenagedoutorinvalidated.

(9)Invalidations-Numberoftimesthatnon-persistentlibraryobjects(likesharedSQLareas)havebeeninvalidated.

(10)GetHitRatioandPinHitRatioshouldbe>70

/*Formattedon2011/7/2110:58:02(QP5v5.163.1008.3004)*/

SELECTNAMESPACE,

GETS,

GETHITS,

ROUND(GETHITRATIO*100,2)gethit_ratio,

PINS,

PINHITS,

ROUND(PINHITRATIO*100,2)pinhit_ratio,

RELOADS,

INVALIDATIONS

FROMv$librarycache

七.ReservePoolSettings

SHAREDPOOLRESERVEDSIZENOTES:

(1)Parameter-Nameoftheparameter

(2)Value-Currentvaluefortheparameter

(3)shared_pool_reserved_size-ControlstheamountofSHARED_POOL_SIZEreservedforlargeallocations.ThefixedviewV$SHARED_POOL_RESERVEDhelpsyoutunetheseparameters.Beginthistuningonlyafterperformingallothersharedpooltuningonthesystem.

(4)shared_pool_reserved_min_alloc-Controlsallocationforthereservedmemory.Tocreateareservedlist,SHARED_POOL_RESERVED_SIZEmustbegreaterthanSHARED_POOL_RESERVED_MIN_ALLOC.OnlyallocationslargerthanSHARED_POOL_RESERVED_POOL_MIN_ALLOCcanallocatespacefromthereservedlistifachunkofmemoryofsufficientsizeisnotfoundonthesharedpool'sfreelists.ThedefaultvalueofSHARED_POOL_RESERVED_MIN_ALLOCshouldbeadequateformostsystems.

/*Formattedon2011/7/2110:59:50(QP5v5.163.1008.3004)*/

SELECTNAME,VALUE

FROMv$parameter

WHERENAMELIKE'%reser%'

八.PinnedObjects

PINNEDOBJECTNOTES:

(1)ObjectName-Nameoftheobject

(2)ObjectType-Typeoftheobject(INDEX,TABLE,CLUSTER,VIEW,SET,SYNONYM,SEQUENCE,PROCEDURE,FUNCTION,PACKAGE,PACKAGEBODY,TRIGGER,CLASS,OBJECT,USER,DBLINK)

(3)KeptStatus-YESorNO,dependingonwhetherthisobjecthasbeen"kept"(permanentlypinnedinmemory)withthePL/SQLprocedureDBMS_SHARED_POOL.KEEP

/*Formattedon2011/7/2111:00:41(QP5v5.163.1008.3004)*/

SELECTNAME,TYPE,KEPT

FROMv$db_object_cache

WHEREKEPT='YES'

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

Blog:http://blog.csdn.net/tianlesoftware
Email:dvd.dba@gmail.com

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

DBA超级群:63306533(满);DBA4群:83829929DBA5群:142216823

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

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: