ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 将对象注入内存——3,将程序常驻内存

将对象注入内存——3,将程序常驻内存

原创 Linux操作系统 作者:oracleclub 时间:2011-12-03 00:08:41 0 删除 编辑
SQL> select NAME,NAMESPACE,SHARABLE_MEM,EXECUTIONS,KEPT
  2  from  v$db_object_cache
  3  where wner='SCOTT';

NAME                  NAMESPACE        SHARABLE_MEM EXECUTIONS KEP
--------------------- ---------------- ------------ ---------- ---
DUAL                  TABLE/PROCEDURE             0          0 NO
DBMS_APPLICATION_INFO TABLE/PROCEDURE             0          0 NO
P2                    TABLE/PROCEDURE         16728          0 NO
DBMS_OUTPUT           TABLE/PROCEDURE             0          0 NO
SCOTT                 PUB_SUB                   407          0 NO
DEPT                  TABLE/PROCEDURE         16730          0 NO

6 rows selected.


SQL> EXECUTE dbms_shared_pool.keep('SCOTT.P2');
BEGIN dbms_shared_pool.keep('SCOTT.P2'); END;

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_SHARED_POOL.KEEP' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


SQL> @/u01/app/oracle/product/10.2/db_1/rdbms/admin/dbmspool.sql

Package created.


Grant succeeded.


View created.


Package body created.



SQL> EXECUTE dbms_shared_pool.keep('SCOTT.P2');

PL/SQL procedure successfully completed.


SQL> select NAME,NAMESPACE,SHARABLE_MEM,EXECUTIONS,KEPT
  2  from  v$db_object_cache
  3  where wner='SCOTT';

NAME                  NAMESPACE        SHARABLE_MEM EXECUTIONS KEP
--------------------- ---------------- ------------ ---------- ---
DUAL                  TABLE/PROCEDURE             0          0 NO
DBMS_APPLICATION_INFO TABLE/PROCEDURE             0          0 NO
P2                    TABLE/PROCEDURE         16728          0 YES
DBMS_OUTPUT           TABLE/PROCEDURE             0          0 NO
SCOTT                 PUB_SUB                   407          0 NO
DEPT                  TABLE/PROCEDURE         16730          0 NO

SQL> alter system flush shared_pool;

System altered.

SQL> select NAME,NAMESPACE,SHARABLE_MEM,EXECUTIONS,KEPT
  2  from  v$db_object_cache
  3  where wner='SCOTT';

NAME                  NAMESPACE        SHARABLE_MEM EXECUTIONS KEP
--------------------- ---------------- ------------ ---------- ---
P2                    TABLE/PROCEDURE         16728          0 YES
SCOTT                 PUB_SUB                     0          0 NO
DEPT                  TABLE/PROCEDURE             0          0 NO

P2还健在,证明了P2不能被清除出shared_pool

SQL> EXECUTE dbms_shared_pool.unkeep('SCOTT.P2');

PL/SQL procedure successfully completed.

SQL> select NAME,NAMESPACE,SHARABLE_MEM,EXECUTIONS,KEPT
  2  from  v$db_object_cache
  3  where wner='SCOTT';

NAME                  NAMESPACE        SHARABLE_MEM EXECUTIONS KEP
--------------------- ---------------- ------------ ---------- ---
P2                    TABLE/PROCEDURE         16728          0 NO
SCOTT                 PUB_SUB                     0          0 NO
DEPT                  TABLE/PROCEDURE             0          0 NO

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26465805/viewspace-712655/,如需转载,请注明出处,否则将追究法律责任。

下一篇: CBO的详解
请登录后发表评论 登录
全部评论

注册时间:2011-11-22

  • 博文量
    61
  • 访问量
    82167