053试题 246 / 255 - OPTIMIZER_USE_SQL_PLAN_BASELINES && SQL Management Base

题目:

246.The OPTIMIZER_USE_PLAN_BASELINES parameter is set to TRUE. The optimizer generates a
plan for a SQL statement but does not find a matching plan in the SQL plan baseline.
Which two operations are performed by the optimizer in this scenario? (Choose two.)
A. The optimizer adds the new plan to the plan history.
B. The optimizer selects the new plan for the execution of the SQL statement.
C. The optimizer adds the new plan to the SQL plan baseline as an accepted plan.
D. The optimizer adds the new plan to the SQL plan baseline but not in the ENABLED state.
E. The optimizer costs each of the accepted plans in the SQL plan baseline and picks the one with the lowest cost.
Answer: AE
解析
optimizer_use_plan_baselines设置为true。优化器为sql语句产生了一个计划,并且没有在sql plan baseline中找到匹配的计划。
优化器会添加该计划到plan history. A 正确。
优化器会选择成本最低的plan。E正确。


参考文档:

https://docs.oracle.com/cd/E11882_01/server.112/e41573/optplanmgmt.htm#PFGRF95115

15.2.2 Selecting SQL Plan Baselines

During the SQL plan baseline selection phase, Oracle Database detects plan changes based on the stored plan history, and selects plans to avoid potential performance regressions for a set of SQL statements.

Each time the database compiles a SQL statement, the optimizer does the following:

  1. Uses a cost-based search method to build a best-cost plan

  2. Tries to find a matching plan in the SQL plan baseline

  3. Does either of the following depending on whether a match is found:

    • If found, then the optimizer proceeds using the matched plan

    • If not found, then the optimizer evaluates the cost of each accepted plan in the SQL plan baseline and selects the plan with the lowest cost

The best-cost plan found by the optimizer that does not match any plans in the plan history for the SQL statement represents a new plan. The database adds this plan as a nonaccepted plan to the plan history. The database does not use the new plan until it is verified to not cause a performance regression. However, if a change in the system (such as a dropped index) causes all accepted plans to become non-reproducible, then the optimizer selects the best-cost plan. Thus, the presence of a SQL plan baseline causes the optimizer to use conservative plan selection strategy for the SQL statement.

To enable the use of SQL plan baselines, set the OPTIMIZER_USE_SQL_PLAN_BASELINES initialization parameter to TRUE (default).

END

-- 2019-08-29 add

题目:

255.Which two statements about the SQL Management Base (SMB) are true? (Choose two.)
A. It contains only SQL profiles generated by SQL Tuning Advisor.
B. It stores plans generated by the optimizer using a stored outline.
C. It is part of the data dictionary and stored in the SYSAUX tablespace.
D. It is part of the data dictionary and stored in the SYSTEM tablespace.
E. It contains the statement log, the plan history, plan baselines, and SQL profiles.
 
参考答案 CE
解析
题目意思问关于SQL Manage base,哪两个说法是正确的?
SMB存储的是statement log,sql plan baselines和plan history,也包括sql profiles。AB  错误。E正确。
SMB是数据字典的一部分,存储在sysaux表空间。C正确D错误。


参考文档:

https://docs.oracle.com/cd/E11882_01/server.112/e41573/optplanmgmt.htm#PFGRF95122

15.6 SQL Management Base

The SQL management base (SMB) is a part of the data dictionary that resides in the SYSAUX tablespace. It stores statement logs, plan histories, SQL plan baselines, and SQL profiles. To allow weekly purging of unused plans and logs, the SMB uses automatic space management.

You can also add plans manually to the SMB for a set of SQL statements. This feature is especially useful when upgrading the database from a version before Oracle Database 11g because it helps to minimize plan regressions resulting from the use of a new optimizer version.

Because the SMB is located entirely within SYSAUX, the database does not use SQL plan management and SQL tuning features when this tablespace is unavailable.

END

你可能感兴趣的:(OCP解析,-,053)