题目:
201.Examine the following PL/SQL block:
SET SERVEROUTPUT ON SET LONG 10000 ECLARE report clob;
BEGIN report := DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE();
DBMS_OUTPUT.PUT_LINE(report);
END;
Which statement describes the effect of the execution of the above PL/SQL block?
A. The plan baselines are verified with the SQL profiles.
B. All fixed plan baselines are converted into nonfixed plan baselines.
C. All the nonaccepted SQL profiles are accepted into the plan baseline.
D. The nonaccepted plans in the SQL Management Base are verified with the existing plan baselines.
参考答案 D
解析
题目中的语句执行的结果是演进sql plan baseline。结果是SQL Management base中的noaccept的plan会被verified接收。选择D。
参考文档:
https://docs.oracle.com/cd/E11882_01/server.112/e41573/optplanmgmt.htm#PFGRF95119
15.2.3.2 Evolving Plans with DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE
The PL/SQL function DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE
tries to evolve new plans that have been added by the optimizer to the plan history of existing plan baselines. If the function can verify that the new plan performs better than a plan chosen from the corresponding SQL plan baseline, then the database adds the new plan as an accepted plan.
The following example of the DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE
function evolves a new plan for a SQL statement identified by its SQL handle, which is its unique SQL identifier in string form. You can find the SQL handle by querying DBA_SQL_PLAN_BASELINES.SQL_HANDLE
.
SET SERVEROUTPUT ON SET LONG 10000 DECLARE report clob; BEGIN report := DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE( sql_handle => 'SYS_SQL_593bc74fca8e6738'); DBMS_OUTPUT.PUT_LINE(report); END; /
The following output shows that Oracle Database successfully evolved a plan:
REPORT -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- Evolve SQL Plan Baseline Report -------------------------------------------------------------------------------- Inputs: ------- SQL_HANDLE = SYS_SQL_593bc74fca8e6738 PLAN_NAME = TIME_LIMIT = DBMS_SPM.AUTO_LIMIT VERIFY = YES COMMIT = YES Plan: SYS_SQL_PLAN_ca8e6738a57b5fc2 ----------------------------------- Plan was verified: Time used .07 seconds. Passed performance criterion: Compound improvement ratio >= 7.32. Plan was changed to an accepted plan. Baseline Plan Test Plan Improv. Ratio ------------- --------- ------------- Execution Status: COMPLETE COMPLETE Rows Processed: 40 40 Elapsed Time(ms): 23 8 2.88 CPU Time(ms): 23 8 2.88 Buffer Gets: 450 61 7.38 Disk Reads: 0 0 Direct Writes: 0 0 Fetches: 0 0 Executions: 1 1 ------------------------------------------------------------------------------- Report Summary ------------------------------------------------------------------------------- Number of SQL plan baselines verified: 1. Number of SQL plan baselines evolved: 1.
Alternatively, you can use the DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE
function to specify:
The name of a particular plan to evolve
A list of plans to evolve
No value
By specifying no value, you enable Oracle Database to evolve all nonaccepted plans currently in the SMB.
See Also:
Oracle Database PL/SQL Packages and Types Reference for information about using the DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE
function
https://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_spm.htm#ARPLS68166
This function evolves SQL plan baselines associated with one or more SQL statements. A SQL plan baseline is evolved when one or more of its non-accepted plans is changed to an accepted plan or plans. If interrogated by the user (parameter verify
= 'YES
'), the execution performance of each non-accepted plan is compared against the performance of a plan chosen from the associated SQL plan baseline. If the non-accepted plan performance is found to be better than SQL plan baseline performance, the non-accepted plan is changed to an accepted plan provided such action is permitted by the user (parameter commit
= 'YES').
The second form of the function employs a plan list format.
Syntax
DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE ( sql_handle IN VARCHAR2 := NULL, plan_name IN VARCHAR2 := NULL, time_limit IN INTEGER := DBMS_SPM.AUTO_LIMIT, verify IN VARCHAR2 := 'YES', commit IN VARCHAR2 := 'YES') RETURN CLOB; DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE ( plan_list IN DBMS_SPM.NAME_LIST, time_limit IN INTEGER := DBMS_SPM.AUTO_LIMIT, verify IN VARCHAR2 := 'YES', commit IN VARCHAR2 := 'YES') RETURN CLOB;
END