oracle优化------缓存对象与数据(6)
-- Q sequence
-- R trigger
-- T type
-- JS java source
-- JC java class
-- JR java resource
-- JD java shared data
-- C cursor
如果这个flag是空,那么他的默认值是P
保留package
sql> exec dbms_shared_pool.keep(package_name,P);
保留squence(避免sequence跳号)
sql> exec dbms_shared_pool.keep(sequence_name,Q);
保留匿名块
SQL> select address,hash_value
2 from v$sqlarea sq
3 where sq.COMMAND_TYPE = 47
4 and length(sq.SQL_TEXT) > 500
5 and sq.SHARABLE_MEM>20000
6 ;
ADDRESS HASH_VALUE
---------------- ----------
00000000A78655E8 1599878706
sql> exec dbms_shared_pool.keep(address,hash_value,C);
注意:查看47是什么命令
SQL> select * from audit_actions where action=47;
ACTION NAME
---------- ----------------------------
47 PL/SQL EXECUTE
eg:
查看需要keep的匿名块
SQL> select address,hash_value
2 from v$sqlarea sq
3 where sq.COMMAND_TYPE = 47
4 and length(sq.SQL_TEXT) > 500
5 and sq.SHARABLE_MEM>20000
6 ;
ADDRESS HASH_VALUE
---------------- ----------
000000008E8532A8 97348712
1 rows selected
确认当前匿名块是否被keep
SQL> select oc.KEPT,sq.ADDRESS,sq.HASH_VALUE
2 from v$db_object_cache oc,
3 v$sqlarea sq
4 where sq.SQL_TEXT=oc.NAME
5 and sq.HASH_VALUE=97348712
6 ;
KEPT ADDRESS HASH_VALUE
---- ---------------- ----------
NO 000000008E8532A8 97348712
SQL>
keep住匿名块
相关新闻>>
- 发表评论
-
- 最新评论 更多>>