SUMSEN

Oracle&Sql爱好者,用友NC管理员

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

参考:http://www.cnblogs.com/zlja/archive/2011/06/24/2449313.html

1,包dbms_shared_pool的数据字典,通过它来执行过程锁定内存

2,v$db_object_cache 来查询那个过程锁定

SYS@sen>select owner,name,type from  v$db_object_cache where  SHARABLE_MEM>10000  AND (TYPE='PACKAGE'
 OR TYPE='PACKAGE BODY' OR TYPE='FUNCTION' OR TYPE='PROCEDURE')   AND kept='NO';

3,在scott用户下新建一个procedure

create or replace procedure p1 as begin null; end;

 

DBA_objects查看,注意这里scott需要大写

SYS@sen>select owner, object_type,OBJECT_NAME from DBA_objects where object_type='PROCEDURE' and owner='SCOTT';

 查看scott下面的所有存储过程

4,将这个过程锁在内存

SYS@sen>exec dbms_shared_pool.keep('SCOTT.p1','P')

 

查看

SYS@sen>select owner,name,type from  v$db_object_cache where owner='SCOTT' AND kept='YES';

 

解锁

SYS@sen>exec dbms_shared_pool.unkeep('SCOTT.p1','P')

试验中的系统触发器需要grant

grant  execute on dbms_shared_pool to HR;

下面是将scott下面的emp表的select等权限给用户HR

 SCOTT@DB112>grant select,insert,update,delete on emp to hr;

  

posted on 2012-12-26 12:04  sumsen  阅读(435)  评论(0编辑  收藏  举报