The DBMS_RESULT_CACHE
package provides an interface to allow the DBA to administer that part of the shared pool that is used by the SQL result cache and the PL/SQL function result cache. Both these caches use the same infrastructure. Therefore, for example, DBMS_RESULT_CACHE
.BYPASS
determines whether both caches are bypassed or both caches are used, and DBMS_RESULT_CACHE
.FLUSH
flushes both all the cached results for SQL queries and all the cached results for PL/SQL functions.
See Also:
Oracle Database PL/SQL Language Reference for more information about "Using the Cross-Session PL/SQL Function Result Cache"
Oracle Database Performance Tuning Guide for more information about "Result Cache Concepts"
This chapter contains the following topics:
Security Model
Constants
Table 133-2 DBMS_RESULT_CACHE Package Subprograms
Subprogram | Description |
---|---|
Sets the bypass mode for the Result Cache |
|
Attempts to remove all the objects from the Result Cache, and depending on the arguments retains or releases the memory and retains or clears the statistics |
|
Invalidates all the result-set objects that dependent upon the specified dependency object |
|
Invalidates the specified result-set object(s) |
|
Produces the memory usage report for the Result Cache |
|
Checks the status of the Result Cache |
This procedure sets the bypass mode for the Result Cache:
When bypass mode is turned on, it implies that cached results are no longer used and that no new results are saved in the cache.
When bypass mode is turned off, the cache resumes normal operation.
This operation can be used when there is a need to hot patch PL/SQL code in a running system. If a code-patch is applied to a PL/SQL module on which a result cached function directly or transitively depends, then the cached results associated with the result cache function are not automatically flushed (if the instance is not restarted/bounced). This must be manually achieved.
To ensure correctness during the patching process follow these steps:
Place the result cache in bypass mode, and flush existing result.
BEGIN DBMS_RESULT_CACHE.BYPASS(TRUE); DBMS_RESULT_CACHE.FLUSH; END; /
This step must be performed on each instance if in a Oracle Real Application Clusters environment.
Apply the PL/SQL code patches.
Resume use of the result cache, by turning off the cache bypass mode.
BEGIN DBMS_RESULT_CACHE.BYPASS(FALSE); END; /
This step must be performed on each instance if in a Oracle Real Application Clusters environment.
This function and procedure attempts to remove all the objects from the Result Cache, and depending on the arguments retains or releases the memory and retains or clears the statistics.
DBMS_RESULT_CACHE.FLUSH ( retainMem IN BOOLEAN DEFAULT FALSE, retainSta IN BOOLEAN DEFAULT FALSE) RETURN BOOLEAN;
DBMS_RESULT_CACHE.FLUSH ( retainMem IN BOOLEAN DEFAULT FALSE, retainSta IN BOOLEAN DEFAULT FALSE);
This function and procedure invalidates all the result-set objects that dependent upon the specified dependency object.
DBMS_RESULT_CACHE.INVALIDATE ( owner IN VARCHAR2, name IN VARCHAR2) RETURN NUMBER;
DBMS_RESULT_CACHE.INVALIDATE ( owner IN VARCHAR2, name IN VARCHAR2);
DBMS_RESULT_CACHE.INVALIDATE ( object_id IN BINARY_INTEGER) RETURN NUMBER;
DBMS_RESULT_CACHE.INVALIDATE ( object_id IN BINARY_INTEGER);
This function and procedure invalidates the specified result-set object(s).
DBMS_RESULT_CACHE.INVALIDATE_OBJECT ( id IN BINARY_INTEGER) RETURN NUMBER;
DBMS_RESULT_CACHE.INVALIDATE_OBJECT ( id IN BINARY_INTEGER);
DBMS_RESULT_CACHE.INVALIDATE_OBJECT ( cache_id IN VARCHAR2) RETURN NUMBER;
DBMS_RESULT_CACHE.INVALIDATE_OBJECT ( cache_id IN VARCHAR2);