Oracle 查看 Shared Pool 信息的相关脚本
2011-09-26 17:27
477 查看
关于OracleSGA中SharedPool的详细说明,参考我的blog:
Oracle
Sharedpool详解
/article/1673130.html
在上篇blog里,介绍了sharedpool的组成和一些原理,也有一些脚本,在这篇blog里,在补充几个查看SharedPool的脚本。
From:http://vsbabu.org/oracle/sect13.html
/*
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
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
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')
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')
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
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,andthesystemhastoallocateitinthecacheandinitializeitwithdataqueriedfromthedatabaseor
generatethedata.
(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
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_ALLOCcanallocate
spacefromthereservedlistifachunkofmemoryofsufficientsizeisnotfoundonthesharedpool'sfreelists.ThedefaultvalueofSHARED_POOL_RESERVED_MIN_ALLOCshouldbeadequateformostsystems.
/*
Formattedon2011/7/2110:59:50(QP5v5.163.1008.3004)*/
SELECTNAME,VALUE
FROMv$parameter
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'
-------------------------------------------------------------------------------------------------------
Oracle
Sharedpool详解
在上篇blog里,介绍了sharedpool的组成和一些原理,也有一些脚本,在这篇blog里,在补充几个查看SharedPool的脚本。
From:
一.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,andthesystemhastoallocateitinthecacheandinitializeitwithdataqueriedfromthedatabaseor
generatethedata.
(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_ALLOCcanallocate
spacefromthereservedlistifachunkofmemoryofsufficientsizeisnotfoundonthesharedpool'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'
-------------------------------------------------------------------------------------------------------
相关文章推荐
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- 查看Oracle基础配置信息和性能相关信息的脚本
- MySQL 查看数据库相关信息的SQL脚本
- Oracle 查看 session 当前统计信息 脚本 说明
- Oracle查看表中每个字段的统计信息脚本
- ORACLE 查看分区表的相关信息语句
- oracle 数据库相关信息查看
- Oracle 查看当前会话所执行的语句以及会话相关信息
- oracle 查看表的相关信息
- Oracle技术之查看并行相关信息
- 查看oracle锁表相关脚本
- (ORACLE)查看分区表的相关信息
- Oracle下查看用户相关信息