![]() |
|
SQL ScriptPin All Packages |
|
Pin all packages that exist in the database above a minimum size. This script should be run on database startup so that all large or frequently accessed packages are pinned.
obj_size - Minumum size of objects to pin in bytes. exec - Minumum number of executions.
REM Copyright (C) Think Forward.com 1998- 2005. All rights reserved.
spool pinpkgs.lst set serveroutput on size 1000000 PROMPT PROMPT Ensure you have run the following as SYS PROMPT $ORACLE_HOME/rdbms/admin/dbmspool.sql PROMPT $ORACLE_HOME/rdbms/admin/prvtpool.plb PROMPT PROMPT PROMPT Listing all objects in shared_pool over 100k PROMPT REM execute dbms_shared_pool.sizes(150); REM REM list objects not pinned, consider pinning large packages or frequently REM used packages @cache ACCEPT obj_size prompt 'Enter size of objects to pin (in bytes) : ' ACCEPT exec prompt 'Enter No Executions Limit to pin : ' DECLARE CURSOR get_pkgs IS SELECT owner, name, sharable_mem , executions FROM v$db_object_cache WHERE (sharable_mem > NVL('&obj_size',10000000) OR executions > NVL('&exec',10000000) ) AND type IN ('PACKAGE', 'FUNCTION', 'PROCEDURE') AND kept = 'NO'; BEGIN FOR pkgs_rec IN get_pkgs LOOP dbms_shared_pool.keep(pkgs_rec.owner || '.' || pkgs_rec.name, 'P'); dbms_output.put_line ('Pinned Package ' ||pkgs_rec.owner || '.' || pkgs_rec.name || ' of size ' || pkgs_rec.sharable_mem ||' bytes.' || ' executions ' || pkgs_rec.executions ); END LOOP; END; / spool off
Return to Index of SQL Scripts
General Information :
Home | Company Profile
| Contact Us | Legal
Database Support :
Proactive Support
|
Pay Per Incident Support
Expert Services :
High Availability
|
Creative Solutions
|
Training
Build Services :
Oracle Installations
|
Revive your Oracle Setup
|
Low Cost Development
Free Oracle Resources:
DBA Scripts
|
Oracle Links