Oracle RDBMS : Flushing a Single SQL Statement out of the Object Library Cache
It is well known that the entire shared pool can be flushed with a simple ALTER SYSTEM statement.
SQL> ALTER SYSTEM FLUSH SHARED_POOL; System altered.
What if the execution plan of a single SQL statement has to be invalidated or flushed out of the shared pool so the subsequent query execution forces a hard parse on that SQL statement. Oracle 11g introduced a new procedure called PURGE in the DBMS_SHARED_POOL package to flush a specific object such as a cursor, package, sequence, trigger, .. out of the object library cache.
The syntax for the PURGE procedure is shown below.
procedure PURGE ( name VARCHAR2, flag CHAR DEFAULT 'P', heaps NUMBER DEFAULT 1)
Explanation for each of the arguments is documented in detail in $ORACLE_HOME/rdbms/admin/dbmspool.sql file.
If a single SQL statement has to be flushed out of the object library cache, the first step is to find the address of the handle and the hash value of the cursor that has to go away. Name of the object [to be purged] is the concatenation of the ADDRESS and HASH_VALUE columns from the V$SQLAREA view. Here is an example:
SQL> select ADDRESS, HASH_VALUE from V$SQLAREA where SQL_ID like '7yc%'; ADDRESS HASH_VALUE ---------------- ---------- 000000085FD77CF0 808321886
SQL> exec DBMS_SHARED_POOL.PURGE ('000000085FD77CF0, 808321886', 'C'); PL/SQL procedure successfully completed. SQL> select ADDRESS, HASH_VALUE from V$SQLAREA where SQL_ID like '7yc%'; no rows selected
The enhanced DBMS_SHARED_POOL package with the PURGE procedure is included in the 10.2.0.4 patchset release.
10.2.0.2 and 10.2.0.3 customers can download and install RDBMS patch 5614566 to get access to these enhancements in DBMS_SHARED_POOL package.
- Oracle Support Document ID 457309.1 "How To Flush an Object out the Library Cache [SGA]"
- Oracle Support Document ID 751876.1 "DBMS_SHARED_POOL.PURGE Is Not Working On 10.2.0.4"
- DBMS_SHARED_POOL.PURGE() procedure documentation
附:清除遊標快取的幾種方法
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/195110/viewspace-732109/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Flush an Object Out The Library Cache [SGA] Using The DBMS_SHARED_POOLObject
- Oracle Library cacheOracle
- Memory Notification: Library Cache Object loaded into SGAObject
- oracle library cache之library cache lock_library cache pin wait event釋義OracleAI
- Memory Notification: Library Cache Object loaded into SGA 告警Object
- shared pool之三:library cache結構/library cache object的結構-dump LibraryHandleObject
- Memory Notification: Library Cache Object loaded into SGA問題Object
- library cache內容系列一之library hash bucket--library object handle--heapObject
- oracle異常:library cache lockOracle
- 【ASK_ORACLE】Library Cache概念篇(二)之Library Cache Pin的定義Oracle
- 【問題處理】Memory Notification: Library Cache Object loaded into SGAObject
- Oracle Library cache mutex x tipsOracleMutex
- oracle library cache之trace小記Oracle
- Library Cache Pin 及 Library Cache Lock分析
- library cache lock和library cache pin理解
- sql version count引發cursor:pin s wait x及library cache latch library cache lockSQLAI
- Memory Notification: Library Cache Object Loaded Into Sga [ID 330239.1]Object
- library cache pin和library cache lock的診斷分析
- library cache lock和library cache pin區別總結
- 【TUNE_ORACLE】等待事件之“library cache lock”Oracle事件
- Oracle Library cache內部機制詳解Oracle
- oracle 10049 event之library cache lockOracle
- oracle11g之v$libcache_locks處理library cache lock及library cache pinOracle
- prepare statement cache size influence databaseDatabase
- SQL*Net more data from dblink引起library cache pinSQL
- 定位Library Cache pin,Library Cache lock等待的解決方法
- 【TUNE_ORACLE】等待事件之“library cache pins”Oracle事件
- [Oracle]--Library cache lock 故障解決一例Oracle
- oracle library cache相關的等待事件及latchOracle事件
- zt_如何平面解決library cache lock和library cache pin
- 【ASM_ORACLE】Library Cache最佳化篇(二)Library cache load lock的概念和解決辦法ASMOracle
- Statement Tracer For Oracle 與 SQL Monitor 的比較OracleSQL
- zt_Oracle Library cache 內部機制 說明Oracle
- 【等待事件】library cache pin事件
- 等待事件--library cache pin事件
- library cache pin等待分析
- LIBRARY CACHE LOCK 等待事件事件
- library cache pin 等待事件事件