清除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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 獲取oracle sql語句詳細些執行計劃OracleSQL
- spark sql語句效能最佳化及執行計劃SparkSQL
- sql語句如何執行的SQL
- mysql的sql語句執行流程MySql
- SQL 語句的執行順序SQL
- SQL語句執行順序SQL
- Laravel 獲取執行的sql語句LaravelSQL
- sql語句執行緩慢分析SQL
- 後臺執行SQL語句(oracle)SQLOracle
- mysql執行sql語句過程MySql
- Mybatis 動態執行SQL語句MyBatisSQL
- 查詢Oracle正在執行的sql語句及執行該語句的使用者OracleSQL
- SQL Server 查詢歷史執行的SQL語句SQLServer
- SQL語句各子句的執行順序SQL
- Laravel 框架查詢執行的 SQL 語句Laravel框架SQL
- 一條sql語句的執行過程SQL
- Oracle sql執行計劃OracleSQL
- MySQL cron定時執行SQL語句MySql
- java連線oracle執行sql語句JavaOracleSQL
- SQL 查詢語句的執行順序解析SQL
- 一條update SQL語句是如何執行的SQL
- python關於pymysql 執行sql語句in的用法PythonMySql
- 一條SQL更新語句是如何執行的SQL
- Hive SQL語句的正確執行順序HiveSQL
- 一條SQL更新語句是如何執行的?SQL
- 一條更新的SQL語句是如何執行的?SQL
- 如何檢視SQL的執行計劃SQL
- [20181119]sql語句執行緩慢分析.txtSQL
- mysql sql語句執行超時設定MySql
- Mybatis原始碼解析之執行SQL語句MyBatis原始碼SQL
- 分析執行計劃優化SQLSQL語句處理的過程(轉)優化SQL
- 一條SQL語句在MySQL中如何執行的MySql
- 一條 SQL 查詢語句是如何執行的?SQL
- Oracle執行語句跟蹤 使用sql trace實現語句追蹤OracleSQL
- 輸入的查詢 SQL 語句,是如何執行的?SQL
- Oracle SQL Profile固定執行計劃的方法OracleSQL
- Oracle資料庫SQL語句執行過程Oracle資料庫SQL
- GaussDB SQL查詢語句執行過程解析SQL
- 一條sql語句在mysql中是如何執行的MySql