1. 程式人生 > >11.2.0.2的SPM的一個bug

11.2.0.2的SPM的一個bug

將該引數optimizer_capture_sql_plan_baselines 設定為true後,出現大量的等待事件:enq: HW - contention

 

select * from VW_SESSION_WAIT_LHR;

 

 

SELECT a.SID,

a.serial#,

a.WAIT_CLASS,

a.EVENT,

a.BLOCKING_SESSION,

a.SQL_TEXT

FROM VW_SESSION_LHR a

WHERE a.EVENT = 'enq: HW - contention';

 

 

 

Sql語句:

 

MERGE INTO sqlobj$data

USING dual

ON (:1 IS NULL)

WHEN MATCHED THEN

UPDATE

SET comp_data = :2

WHERE signature = :3

AND category = :4

AND obj_type = :5

AND plan_id = :6

WHEN NOT MATCHED THEN

INSERT

(signature,

category,

obj_type,

plan_id,

comp_data,

spare1,

spare2)

VALUES

(:7,

:8,

:9,

:10,

:11,

NULL,

NULL);

 

 

資料庫版本:

 

 

解決:

總體來說是Oracle的一個bug

第一步:先把該屬性禁用 alter system  Set optimizer_capture_sql_plan_baselines=false;

第二步:採用如下的存過把已經捕捉到的執行計劃全部刪掉,不然系統需要等待很久才能恢復正常,因為當前的很多sql都是正在更新系統表 sqlobj$data (或者使用sys使用者直接把相關表清空也可以,同一個道理,主要是減少表的資料量)

 

 

---使用擁有dba角色的使用者多次執行如下存過,要多次執行喲,直到 DBA_SQL_PLAN_BASELINES 中查詢不出來資料為止

 

DECLARE

BINARY_INTEGER;

BEGIN

 

FOR cur IN (SELECT * FROM DBA_SQL_PLAN_BASELINES a) LOOP

BEGIN

:= DBMS_SPM.drop_sql_plan_baseline(sql_handle => cur.SQL_HANDLE);

EXCEPTION

WHEN OTHERS THEN

NULL;

END;

 

END LOOP;

 

EXCEPTION

WHEN OTHERS THEN

dbms_output.put_line('error:' || SQLCODE || ',' || SQLERRM);

END;

 

 

 

 

 

Description

This defect has many apparent unrelated symptoms :

1) An unexpected growth is observed in sysaux tablespace with

optimizer_capture_sql_plan_baselines set to true.

2) Excessive redo generation

3) Additional recursive calls, increasing parsing and execution time.

   

The issue is caused by SQL Plan Management that keeps collecting baselines

in every execution instead of just on hard parsing.

   

Rediscovery Notes:

 Query on v$sysaux_occupants shows SQL_MANAGEMENT_BASE as one of the highest.

   

The following query is observed in SQL traces:

   

MERGE INTO sqlobj$data    

USING dual ON (:1 IS NULL)

WHEN MATCHED THEN         

UPDATE SET comp_data = :2 

  WHERE signature = :3    

    AND category = :4     

      AND obj_type = :5   

        AND plan_id = :6  

  WHEN NOT MATCHED THEN   

      INSERT (signature, category, obj_type, plan_id, comp_data,

              spare1, spare2)

      VALUES (:7, :8, :9, :10, :11, null, null);

   

Workaround

 Set optimizer_capture_sql_plan_baselines=false

   

HOOKS CBO:SPM parameter:optimizer_capture_sql_plan_baselines LIKELYAFFECTS XAFFECTS_11.1.0.6 XAFFECTS_V11010006 AFFECTS=11.1.0.6 XAFFECTS_11.1.0.7 XAFFECTS_V11010007 AFFECTS=11.1.0.7 XAFFECTS_11.2.0.1 XAFFECTS_V11020001 AFFECTS=11.2.0.1 XAFFECTS_11.2.0.2 XAFFECTS_V11020002 AFFECTS=11.2.0.2 XPRODID_5 PRODUCT_ID=5 PRODID-5 RDBMS XCOMP_RDBMS COMPONENT=RDBMS TAG_CBO TAG_PERF TAG_SPACEUSE TAG_SPM TAG_SYSAUX CBO PERF SPACEUSE SPM SYSAUX FIXED_11.2.0.3 FIXED_12.1.0.1 FIXED_WIN:B107P41 FIXED_WIN:B202P04

Further details on this issue can be found in Note:1304775.1

Please note: The above is a summary description only. Actual symptoms can vary. Matching to any symptoms here does not confirm that you are encountering this problem. For questions about this bug please consult Oracle Support.

References

Bug:9910484 (This link will only work for PUBLISHED bugs)Note:245840.1 Information on the sections in this article