Oracle建立触发器把某个存储过程镶到内存中提高运算效率
创建该存储过程
SQL>@...\dbmspool.sql
查看该包是否创建
SQL>desc dbms_shared_pool
www.2cto.com
创建触发器
SQL>conn hr/hr;
SQL>CREATE OR REPLACE TRIGGER "HR".HR_START_TR AFTER
STARTUP ON DATABASE
begin
sys.DBMS_SHARED_POOL.KEEP('HR.ADD_JOB_HISTORY');
end;
授权给HR
grant execute on dbms_shared_pool to HR;
www.2cto.com
在关闭
数据库之前验证内存中是否有add_job_history
select owner,name,type from v$db_object_cache
where owner='HR' and type='PROCEDURE';
select owner,name,type from v$db_object_cache
where owner='HR' and type='PROCEDURE';