How To Pin Objects in Your Shared Pool [ID 1012047.6]
HOW TO PIN OBJECTS IN YOUR SHARED POOL:
=======================================
Pinning objects to the shared pool is a key to tuning your shared pool. Having
objects pinned will reduce fragmentation and changes of encountering the
ORA-04031 error.
You must determine which objects to pin. These are particular to your own
database, the application you are running, the size of your database, and the
activity on your database. Here are some general guidelines to keep in mind
when pinning objects:
I. If you have encountered the ORA-04031 already and need to resolve it:
1. Find out which application is causing this error. Zero down on which
package/procedure is loaded and try to keep it in shared pool by pinning
it.
2. Sometimes, the application may not give the errors. In which case, set an
event in init.ora, as follows and generate a trace file.
event = "4031 trace name errorstack level 2"
or with 9i and higher and spfiles you can issue
alter system set events='4031 trace name errorstack level 2';
What to look for in the trace?
The trace contains a dump of state objects, when the error occurs.
Look for 'load=X' a few lines below that 'name='[name of the object].
So, this error occurs at the time loading this object.
Pin that object in the shared pool, thereby keeping it.
II. You can check the x$ksmlru fixed table. This table keeps track of the
objects and the corresponding number of objects flushed out of the shared
pool to allocate space for the load. These objects are stored and flushed
out based on the Least Recently Used (LRU) algorithm.
* Because this is a fixed table, once you query the table, Oracle will
automatically reset the table, thus, you can only query the table once.
Suggestion for workaround: spool the output to a file so you can capture
the output for analysis.
* describe x$ksmlru
Table or View x$ksmlru
Name Null? Type
------------------------------- -------- --------------
ADDR RAW(4)
INDX NUMBER
KSMLRCOM VARCHAR2(20)
KSMLRSIZ NUMBER
KSMLRNUM NUMBER
KSMLRNUM stores the number of objects that were flushed to load the
large object.
KSMLRISZ stores the size of the object that was loaded (contiguous
memory allocated)
We do not need the other columns.
* Here is an example of a query you issue to find all the objects that are
larger than size 5k which you may want to pin:
select * from x$ksmlru where ksmlrsiz > 5000;
* In general, pinning SYS.STANDARD ,SYS.DBMS_STANDARD & SYS.DIUTIL
which are large packages used by Oracle, should help.
* SYS.DIUTIL is used only during generations of SQL*forms so it may not be
necessary to pin this package in your production database.
III. You can also pin large packages frequently used by the users. Suggestion:
pin the objects immediately after starting up your database.
IV. How to pin a package?
1. Oracle automatically loads SYS.STANDARD, SYS.DBMS_STANDARD and
SYS.DIUTIL. Here is an example:
pk1 is a package with a variable called dummy. Assigning dummy to a
value and then executing the package will load it into the shared
pool:
Eg:-
begin
pk1.dummy := 0 ; /* THIS ASSIGNMENT TO THE DUMMY VARIABLE IS BY */
end; /* EXECUTING THE PACKAGE. */
2.Then you must pin the package. Here is an example:
execute dbms_shared_pool.keep(owner.pk1);
V. How to pin a stored procedure/functions ?
1.You can pin procedures and triggers with the dbms_shared_pool procedure.
Either procedures or packages can be pinned with the 'P' flag, which is
the default value (so you can leave it out). Triggers are pinned with
'R' and anonymous plsql blocks need any letter other than [p,P,r,R] as a
flag. Refer to dbmspool.sql for more documentation. Here is an example:
execute dbms_shared_pool.keep(owner.trigger, 'R')
Search Words:
=============
ORA-4031
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9907339/viewspace-1051801/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Shared pool的library cache lock/pin及硬解析
- 使用dbms_shared_pool包將物件pin到記憶體中物件記憶體
- 共享池之六:shared pool latch/ library cache latch /lock pin 簡介
- 【Shared Pool】使用DBMS_SHARED_POOL包將PL/SQL大物件儲存到Shared PoolSQL物件
- how to use oidpasswd to admin your AS/OID account
- How to Resolve Invalid Objects in a Database [ID 158185.1]ObjectDatabase
- Oracle shared poolOracle
- _shared_pool_reserved_pct or shared_pool_reserved_size with ASMMASM
- 【AD報錯】GND contains Output Pin and Power Pin objectsAIObject
- zt_Oracle shared pool internals_共享池_shared_poolOracle
- SHARED POOL總結
- SHARED_POOL解析
- 理解Oracle Shared PoolOracle
- How Good Are Your Opinion 2Go
- 深入理解shared pool共享池之library cache的library cache pin系列三
- Oracle Shared Pool Memory ManagementOracle
- ORACLE SGA之shared poolOracle
- 使用DBMS_SHARED_POOL包將PL/SQL大物件儲存到Shared PoolSQL物件
- dbms_shared_pool keep物件到share pool中物件
- 【SQLSERVER】How to check current pool sizeSQLServer
- SHARED POOL 基礎知識
- 簡單分析shared pool(一)
- 簡單分析shared pool(二)
- 簡單分析shared pool(三)
- shared_pool_spare_free.sqlSQL
- ORACLE記憶體管理 之五 SGA variable pool,shared_pool,large_pool,java_poolOracle記憶體Java
- shared pool記憶體結構記憶體
- latch:shared pool的一點理解
- Shared Pool 的基本原理
- Shared Pool 的轉儲與分析
- 安裝DBMS_SHARED_POOL包
- oracle優化--shared_pool (3)Oracle優化
- oracle優化--shared_pool (2)Oracle優化
- oracle優化--shared_pool (1)Oracle優化
- PL/SQL Program Units and the Shared Pool (89)SQL
- How to build your custom release bazel version?UI
- How to prevent blocking in your SQL Server databaseBloCSQLServerDatabase
- 基於引數shared_pool_reserved_size進一步理解共享池shared pool原理