清除SQL語句的執行計劃
1 對對應的表執行ddl操作,comment on、grant 等等,最常用的是grant,但是這種操作影響比較大,尤其是業務高峰期間對一個很忙的表進行此類操作,需要非常慎重,可能導致系統hang。
2 如果對於多個表聯合查詢的,可以對其中關聯的某個不忙的表進行grant,而不是我們一直關注的某個核心表。這個簡單快捷又安全,我們就處理過類似的事情:兩個表聯合查詢,但是其中的一個核心表由於統計資訊錯誤導致執行計劃錯誤,收集統計資訊後沒敢直接讓它生效。但是這個表很多語句都用到了,也非常的忙;但是另外一個表就是一個不忙的表,如是對另外一個表做grant。這個需要一點點發散思維。
3 DBMS_SHARED_POOL.PURGE ,但是有些版本的資料庫不能正常工作:
詳細請檢視oracle metalink:
How To Flush an Object Out The Library Cache [SGA] Using The DBMS_SHARED_POOL Package [ID 457309.1]
The syntax for the DBMS_SHARED_POOL.PURGE package is:
procedure purge (name varchar2, flag char DEFAULT 'P', heaps number DEFAULT 1);
procedure purge (name varchar2, flag char DEFAULT 'P', heaps number DEFAULT 1);
Explanation: Purge the named object or particular heap(s) of the object.
Input arguments:
name: The name of the object to purge.
There are two kinds of objects:
PL/SQL objects, triggers, sequences, types and Java objects which are specified by name,
SQL cursor objects which are specified by a twopart number. The value for this identifier
is the concatenation of the 'address' and 'hash_value' columns from the v$sqlarea view.
Input arguments:
name: The name of the object to purge.
There are two kinds of objects:
PL/SQL objects, triggers, sequences, types and Java objects which are specified by name,
SQL cursor objects which are specified by a twopart number. The value for this identifier
is the concatenation of the 'address' and 'hash_value' columns from the v$sqlarea view.
flag: This is an optional parameter. If the parameter is not specified,
the package assumes that the first parameter is the name of a
package/procedure/function and will resolve the name. Otherwise,
the parameter is a character string indicating what kind of object
to purge the name identifies. The string is case insensitive.
The possible values and the kinds of objects they indicate are
given in the following table:
the package assumes that the first parameter is the name of a
package/procedure/function and will resolve the name. Otherwise,
the parameter is a character string indicating what kind of object
to purge the name identifies. The string is case insensitive.
The possible values and the kinds of objects they indicate are
given in the following table:
Value Kind of Object to keep
----- ----------------------
P package/procedure/function
Q sequence
R trigger
T type
JS java source
JC java class
JR java resource
JD java shared data
C cursor
----- ----------------------
P package/procedure/function
Q sequence
R trigger
T type
JS java source
JC java class
JR java resource
JD java shared data
C cursor
heaps: heaps to purge. e.g if heap 0 and heap 6 are to be purged.
1<<0 | 1<<6 => hex 0x41 => decimal 65. so specify heaps=>65.
Default is 1 i.e heap 0 which means the whole object will be purged.
1<<0 | 1<<6 => hex 0x41 => decimal 65. so specify heaps=>65.
Default is 1 i.e heap 0 which means the whole object will be purged.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/758322/viewspace-708254/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 通過分析SQL語句的執行計劃優化SQL語句SQL優化
- 根據SQL Id獲得SQL語句的執行計劃SQL
- 一條SQL語句的執行計劃變化探究SQL
- 獲得目標SQL語句執行計劃的方法SQL
- 通過分析SQL語句的執行計劃優化SQL 二SQL優化
- 通過分析SQL語句的執行計劃優化SQL(總結)SQL優化
- 獲取oracle sql語句詳細些執行計劃OracleSQL
- spark sql語句效能最佳化及執行計劃SparkSQL
- 透過分析SQL語句的執行計劃最佳化SQL(總結)SQL
- 獲取oracle正在處於等待狀態的sql語句的執行計劃的語句OracleSQL
- 清除shared pool中某條sql的執行計劃SQL
- [轉]透過分析SQL語句的執行計劃最佳化SQL(總結)SQL
- 使用dbms_xplan包來獲得sql語句的執行計劃SQL
- 使用 EXPLAIN PLAN 獲取SQL語句執行計劃 (R0.1)AISQL
- sql語句如何執行的SQL
- 執行大的sql語句SQL
- ORACLE 11G 使用SPM來調整SQL語句的執行計劃OracleSQL
- sql語句批量執行SQL
- 【檢視】使用V$SQL_PLAN檢視獲取曾經執行過的SQL語句執行計劃SQL
- SQL的執行計劃SQL
- 如何清除某條SQL在庫快取中的執行計劃SQL快取
- 如何在oracle10g上檢視sql的執行計劃(不實際執行語句)OracleSQL
- mysql的sql語句執行流程MySql
- SQL 語句的執行順序SQL
- 報錯的語句也可以產生執行計劃
- oracle查詢語句執行計劃中的表消除Oracle
- 指令碼:獲得現有語句的執行計劃指令碼
- sql 執行計劃SQL
- 查詢正在執行的sql語句及該語句執行的時間SQL
- SQL語句執行順序SQL
- toad執行sql語句SQL
- 【AWR】通過AWR報告中記錄的 SQL Id獲得SQL語句的執行計劃SQL
- SQL Server SQL語句執行順序SQLServer
- Laravel 獲取執行的sql語句LaravelSQL
- 查詢執行慢的SQL語句SQL
- CoreData執行過程的sql語句SQL
- 識別低效執行的SQL語句SQL
- 剖析SQL語句的執行過程SQL