SQL Performance Analyzer Quick Check (SPA Quick Check)和SQL Performance Analyzer可以评估数据库更改对SQL性能的影响。
下面几节描述SPA快速检查和SQL性能分析器:
About SPA Quick Check
About Configuring SPA Quick Check
About Validating the Impact of an Initialization Parameter Change
About Validating the Impact of Implementing a SQL Profile
About SQL Performance Analyzer
Specifying Default Settings for SQL Performance Analyzer
Analyzing the Impact of Database Changes on SQL Performance: Oracle by Example Series
SQL Performance Analyzer快速检查(SPA快速检查)在进行更改之前验证数据库更改对SQL性能的影响。
在EM Express数据库管理页面上可以使用SPA快速检查,对数据库的更改可能会影响性能。
使用SPA快速检查来验证对SQL性能的影响:
更改会话可修改的初始化参数的值
实现SQL资料
您必须在使用SPA之前配置快速检查。
See Also:
"About Configuring SPA Quick Check"
"About Validating the Impact of an Initialization Parameter Change"
"About Validating the Impact of Implementing a SQL Profile"
"About Validating the Impact of Implementing Multiple SQL Profiles"
本节概述SPA快速检查配置。
在使用SPA快速检查来验证数据库更改的影响之前,必须为SPA快速检查指定默认设置。
作为SPA Quick Check默认设置之一,您指定要使用的SPA Quick Check的默认SQL调优集。这个SQL调优集应该包括您希望分析其性能的SQL语句。
参见:
"About SQL Tuning Sets"
"Specifying Default Values for SPA Quick Check"
"Validating the Impact of an Initialization Parameter Change"
"Validating the Impact of Implementing a SQL Profile"
"Validating the Impact of Implementing Multiple SQL Profiles"
11.2.1 关于SQL调优集
SQL调优集(STS)是一个数据库对象,它包含一个或多个SQL语句及其执行统计信息和执行上下文。
您可以使用api创建SQL调优集,将SQL语句加载到SQL调优集,并将SQL调优集传输到另一个系统(例如与您的生产系统非常相似的测试系统)。
在EM Express中使用SQL Performance Analyzer或SQL Performance Analyzer快速检查(SPA快速检查)之前,必须为它们指定默认设置。这些工具需要一个SQL调优集,其中包含要分析其性能的SQL语句或语句。
See Also:
Oracle Database SQL Tuning Guide for information about creating a SQL tuning set
Oracle Database SQL Tuning Guide for information about loading a SQL tuning set
Oracle Database SQL Tuning Guide for information about transporting a SQL tuning set
"About SPA Quick Check"
"About SQL Performance Analyzer"
11.2.2 SPA快速检查指定默认值
在使用SPA之前,您必须指定SPA快速检查的默认设置。
为SPA快速检查指定默认设置:
SQL调优集
执行SQL调优集中的语句时要使用的SPA快速检查的默认值
当SPA Quck检查SQL调优集中语句的性能与数据库的当前设置进行比较时,以及计划对数据库进行更改之后,使用的默认值
在SPA快速检查默认值设置对话框中,为这些字段指定值:
SQL调优集:指定一个SQL调优集,该调优集包含您感兴趣分析其性能的SQL语句。
禁用多个执行:指示SPA Quick Check执行SQL调优集时,SQL调优集中的语句是否应该多次运行。选择Yes时,SQL调优集中的每个SQL只执行一次。当选择No时,将多次执行SQL调优集中的SQL语句,然后对运行时统计数据进行平均。
要获取的行:指示在SQL Performance Analyzer测试执行期间为每个SQL获取的结果行数。允许的值是ALL_ROWS、AVERAGE、AUTO或整数。
Value | Description |
---|---|
ALL_ROWS |
将获取所有结果行。这是默认值。 |
AVERAGE |
结果行数将被计算为SQL调优集中每个SQL处理的总行数和总执行数的比值。 |
AUTO |
结果行数将使用SQL调优集中捕获的优化器环境的optimizer_mode参数的值来确定。如果optimizer_mode的值是ALL_ROWS,那么将获取所有结果行。如果它的值是FIRST_ROWS_n,那么SPA Quick Check将获取n行结果。 |
Integer | 结果行数将等于这个指定的值,如果要获取的行数更少,则会更少。 |
Per-SQL Time Limit (seconds): 显示每个语句的语句超时(秒)当温泉快速检查执行SQL语句的优化设置。最大值是2 ^ 32-1。如果设置为空,则为无限制。
Total Time Limit (seconds): 表明全球超时(秒)当温泉快速执行中的所有语句的SQL调优集。最大值是2 ^ 32-1。如果设置为空,则为无限制。
Comparison Metric: 在SQL调优集中语句的性能与数据库的当前设置进行比较时,以及计划对数据库进行更改之后,选择您希望SPA快速检查使用的度量。
Workload Impact Threshold (%): 指示SQL语句更改的阈值对工作负载的影响。工作负载变化影响低于该阈值绝对值的报表将被认为是不变的(也就是说,这些报表的性能将被认为既没有改进也没有倒退)。
SQL Impact Threshold (%): 更改阈值对SQL语句的影响。SQL更改影响低于该阈值绝对值的语句将被视为未更改(也就是说,这些语句的性能将被视为既没有改进也没有倒退)。
Note:
"About SPA Quick Check"
"About SQL Tuning Sets"
在更改会话可修改的数据库初始化参数的值之前,可以使用SPA Quick Check验证该更改对数据库工作负载的影响。
会话可修改参数是初始化参数,其值可以使用ALTER SESSION语句进行更改。
See Also:
"Validating the Impact of an Initialization Parameter Change"
"About SPA Quick Check"
11.3.1验证初始化参数更改的影响
您可以使用SPA快速检查来验证更改会话可修改的数据库初始化参数的影响。
Option | Description |
---|---|
Parameter Value | 输入新的初始化参数值,您希望验证该参数值对数据库工作负载的影响。 |
Task Name | 接受默认的任务名称,或者输入不同的名称。 |
Description | 该字段显示初始化参数名称、当前值和希望验证其影响的新值。接受默认描述,或者输入不同的描述。 |
Total Time Limit | 接受默认值,或者指定SPA快速检查用于验证新值影响的不同最大时间长度(以秒为单位)。 |
出现SQL Performance Analyzer页面的Quick Check Tasks选项卡,新任务的Statuscolumn显示SPA Quick Check处理任务的进度。当任务执行完成时,Status列中会出现一个复选标记。
Status列显示每个语句的性能是改进了、倒退了还是没有变化。
使用类别筛选器显示所有顶级SQL语句,或仅显示可用类别之一中的SQL语句。
任何推荐新执行计划的SQL语句都在new plan列中包含一个复选标记。
See Also:
直接点击Validate with SPA。在里面修改参数验证即可,不用先该参数
查看结果
在实现SQL调优顾问为SQL语句推荐的SQL概要文件之前,可以使用SPA快速检查来验证为该语句实现SQL概要文件的影响。
使用SQL调优顾问对SQL语句进行调优后,该SQL语句的调优结果页面会在页面底部的Select Recommendation部分列出调优建议。如果优化建议之一是为该语句创建SQL概要文件,Typecolumn将显示该建议的SQL概要文件值,并在Select recommendations部分显示Validate with SPA按钮。
See Also:
"Validating the Impact of Implementing a SQL Profile"
"About Validating the Impact of Implementing Multiple SQL Profiles"
"Validating the Impact of Implementing Multiple SQL Profiles"
"About SPA Quick Check"
11.4.1 验证实现SQL概要文件的影响
您可以使用SPA快速检查来验证SQL调优顾问建议的实现SQL概要文件的影响。
The Validate with SPA dialog box appears.
Option | Description |
---|---|
Task Name | 接受默认的任务名称,或者输入不同的名称。 |
Description | 该字段显示初始化参数名称、当前值和希望验证其影响的新值。接受默认描述,或者输入不同的描述。 |
Total Time Limit | 接受默认值,或者指定SPA快速检查用于验证新值影响的不同最大时间长度(以秒为单位)。 |
出现SQL Performance Analyzer页面的Quick Check Tasks选项卡,新任务的Statuscolumn显示SPA Quick Check处理任务的进度。当任务执行完成时,Status列中会出现一个复选标记。
Status列显示每个语句的性能是改进了、倒退了还是没有变化。
使用类别筛选器显示所有顶级SQL语句,或仅显示可用类别之一中的SQL语句。
任何推荐新执行计划的SQL语句都在new plan列中包含一个复选标记。
See Also:
"About Validating the Impact of Implementing a SQL Profile"
"About Validating the Impact of Implementing Multiple SQL Profiles"
11.4.2 关于验证实现多个SQL概要文件的影响
在实现SQL调优顾问推荐的多个SQL概要文件之前,可以使用SPA快速检查来验证实现这些SQL概要文件对工作负载的影响。
多个SQL配置文件建议可以出现在这些EM Express页面:
如果启用了Automatic SQL Tuning Advisor,那么SQL Tuning Advisor页面上的Automatic选项卡可以包含针对选项卡底部顶部SQL语句部分中列出的语句的多个SQL配置文件建议。
在SQL调优任务的调优任务结果页上。SQL调优任务可以包含多个SQL语句,SQL调优顾问建议为这些语句实现SQL概要文件。SQL调优顾问页面上的Manual选项卡列出了SQL调优任务,您可以选择一个任务并单击View Result查看该任务的所有建议。
如果SQL Performance Analyzer建议在EM Express页面上实现多个SQL概要文件,那么页面的顶部SQL语句部分将包含带有SPA按钮的Validate All profiles。
See Also:
"Validating the Impact of Implementing Multiple SQL Profiles"
"About Validating the Impact of Implementing a SQL Profile"
"Validating the Impact of Implementing a SQL Profile"
11.4.3 验证实现多个SQL概要文件的影响
您可以使用SPA快速检查来验证SQL调优顾问建议的实现多个SQL概要文件的影响。
The Validate with SPA dialog box appears.
Option | Description |
---|---|
Task Name | Accept the default task name, or enter a different name. |
Description | This field shows the initialization parameter name, the current value, and the new value whose impact you want to validate. Accept the default description, or enter a different description. |
Total Time Limit | Accept the default value, or specify a different maximum length of time (in seconds) that SPA Quick Check can take to validate the impact of the new value. |
The Quick Check Tasks tab of the SQL Performance Analyzer page appears, and the Statuscolumn for the new task shows SPA Quick Check's progress processing the task. A check mark appears in the Status column when the task execution is complete.
The SQL Performance Analyzer Task page for the task appears. The SQL Trials section lists the SQL trials that SPA Quick Check performed for the task, and the SQL Trials Comparisons section lists one or more comparisons performed for those trials.
The SQL Performance Analyzer Report page for the task appears. The SQL Trials section lists the SQL trials that SPA Quick Check performed for the task, and the SQL Trials Comparisons section lists one or more comparisons performed for those trials. The Top SQL Statements section shows a comparison of the top SQL statements for the two trials.
The Status column shows whether performance improved, regressed, or was unchanged for each of the statements.
Use the Category filter to show all the top SQL statements, or to show only the SQL statements in one of the available categories.
Any SQL statement for which a new execution plan is recommended includes a check mark in the New Plan column.
The Summary section, and the Statistics, Plans, and Findings tabs in the Execution Details section provide more information about the SQL statement execution for the two trials.
See Also:
"About Validating the Impact of Implementing Multiple SQL Profiles"
"About Validating the Impact of Implementing a SQL Profile"
"Validating the Impact of Implementing a SQL Profile"
SQL Performance Analyzer通过识别每个SQL语句的性能差异,自动评估数据库更改对SQL工作负载的总体影响。
提供了一个报告,该报告显示更改对工作负载性能的净影响。对于退化的SQL语句,SQL Performance Analyzer还提供适当的执行计划细节以及调优建议。因此,您可以在最终用户受到影响之前纠正任何负面结果。此外,您可以验证(以显著的时间和成本节省)系统对生产环境的更改将导致净改进。
在使用SQL Performance Analyzer之前,必须有一个SQL调优集,其中包含您希望分析其性能的SQL语句,并且必须指定SQL Performance Analyzer默认设置。
SQL性能分析器任务是一个容器,它封装了关于完整的SQL性能分析器分析的所有数据。一个SQL性能分析器分析包括至少两个SQL试验和一个比较。SQL试用包封装了特定环境条件下SQL调优集的执行性能。在创建SQL Performance Analyzer任务时,选择SQL调优集作为其输入源,在运行SQL试验时,SQL调优集用作SQL语句的源。
创建SQL Performance Analyzer任务之后,您将创建一个更改前的SQL试用版。然后,对希望评估其SQL性能影响的数据库进行更改。在更改数据库之后,您将创建一个更改后的SQL试用版。最后,比较两个试验。
SQL性能分析器分析显示了两个试验之间环境差异的影响。
See Also:
"About SQL Tuning Sets"
"Specifying Default Settings for SQL Performance Analyzer"
"Creating a SQL Performance Analyzer Task"
"Creating a Pre-Change SQL Trial"
"Creating a Post-Change SQL Trial"
"Comparing Two SQL Trials"
"About SPA Quick Check"
在使用SQL Performance Analyzer之前,您可以选择更改该工具的默认设置。
The SQL Performance Analyzer page appears.
The SPA Default Values Setup dialog box appears.
Disable Multiple Executions: Indicates whether the statements in the SQL tuning set should be run multiple times when SQL Performance Analyzer executes the SQL tuning set. When Yes is selected, each SQL in the SQL tuning set is executed only once. When Nois selected, SQL statements in the SQL tuning set are executed multiple times and runtime statistics are then averaged.
Per-SQL Time Limit (seconds): Indicates the per-statement timeout (in seconds) for each statement when SQL Performance Analyzer executes the statements in a SQL tuning set. The maximum value is 2^32-1. Unlimited if set to empty.
Rows to Fetch: Indicates the number of result rows to be fetched for each SQL during a SQL Performance Analyzer test execution. Permissible values are ALL_ROWS
, AVERAGE
, AUTO
, or an integer.
Value | Description |
---|---|
ALL_ROWS | All result rows will be fetched. This is the default value. |
AVERAGE | The number of result rows will be calculated as the ratio of total rows processed and total executions for each SQL in the SQL tuning set. |
AUTO | The number of result rows will be determined using the value of the optimizer_mode parameter of the optimizer environment captured in the SQL tuning set. If value of optimizer_mode was ALL_ROWS , then all result rows will be fetched. If its value was FIRST_ROWS_n , then n result rows will be fetched by SPA Quick Check. |
Integer | The number of result rows will be equal to this specified value, or less if there were fewer rows to fetch. |
Execute Full DML: Specify Yes to execute DML statement fully, including acquiring row locks and modifying rows. Specify No (default) to execute only the query part of the DML without modifying data. When Yes is specified, SQL Performance Analyzer issues a rollback following DML execution to prevent persistent changes from being made by the DML.
Apply Captured Optimizer Env: Specify Yes for this field if you want the per-SQL optimizer environment captured in the SQL tuning set to be used for SQL Performance Analyzer trials. Otherwise, specify No.
Comparison Metric: Choose the metric you want SQL Performance Analyzer to use when it compares the performance of the statements in the SQL tuning set with the database's current settings and after the planned change to your database.
Workload Impact Threshold (%): Indicates the threshold of a SQL statement change impact on a workload. Statements having workload change impact below the absolute value of this threshold will be considered as unchanged (that is, the performance of those statements will be considered neither improved nor regressed).
SQL Impact Threshold (%): Threshold of a change impact on a SQL statement. Statements having SQL change impact below the absolute value of this threshold will be considered as unchanged (that is, the performance of those statements will be considered neither improved nor regressed).
See Also:
"Creating a SQL Performance Analyzer Task"
"About SQL Performance Analyzer"
11.6.1 创建SQL Performance Analyzer任务
使用SQL调优集作为输入源创建SQL Performance Analyzer任务。
The SQL Performance Analyzer page appears.
The Create SQL Performance Analyzer Task dialog box appears.
Task Name: Accept the default task name, or enter the name you want to use for the task.
Description: Optionally, enter a description for the task.
SQL Tuning Set: Choose the SQL tuning set you want to use to create the task.
The new SQL Performance Analyzer task appears in the list of SQL Performance Analyzer tasks on the Manual Tasks tab.
在创建SQL Performance Analyzer任务之后,您可以创建一个SQL试用版。通常,您创建一个更改前SQL试验,进行数据库更改,然后创建一个更改后SQL试验。
See Also:
"Creating a Pre-Change SQL Trial"
"Creating a Post-Change SQL Trial"
"About SQL Performance Analyzer"
"Specifying Default Settings for SQL Performance Analyzer"
11.6.2 创建一个预先更改的SQL试用版
创建SQL性能分析器任务后,可以使用SQL性能分析器创建预更改SQL试验。
按照以下步骤使用SQL Performance Analyzer创建一个预先更改的SQL试用版:
The SQL Performance Analyzer page appears.
The SQL Performance Analyzer Task page for that task appears.
Trial Name: Accept the default trial name, or enter the name you want to use for the trial.
Description: Optionally, enter a description for the trial.
Execution Type: Choose the type of execution you want to use for the trial:
Test Execute: This method test executes SQL statements through SQL Performance Analyzer on the database running SQL Performance Analyzer.
Explain Plan: This method generates execution plans only for SQL statements through SQL Performance Analyzer on the database running SQL Performance Analyzer. Unlike the EXPLAIN PLAN
statement, SQL trials using the explain plan method take bind values into account and generate the actual execution plan.
Convert SQL Tuning Set: This method converts the execution statistics and plans stored in a SQL tuning set to a trial. You can then compare this trial with other trials. A tuning set does not contain all the data that is collected from a test execute trial, so if you create a comparison of a convert SQL tuning set trial with a test execute trial, there will be fewer comparison metrics available.
如果您想安排试验运行的时间,请单击右箭头按钮转到Schedule选项卡。或者,单击OK立即运行试验。
在执行试验时,它的状态显示在SQL Performance Analyzer任务页面的SQL Trials任务页的SQL Trials部分的status列中。
当试验完成时,在SQL Performance Analyzer任务页面的SQL Trials任务页的SQL Trials部分中,试验的Status列中会出现一个复选标记图标。
在更改前SQL试验完成后,对您想要评估的SQL性能的影响进行数据库更改,然后创建更改后SQL试验。
See Also:
"Creating a SQL Performance Analyzer Task"
"Creating a Post-Change SQL Trial"
11.6.3 创建更改后的SQL试验
在创建预更改SQL试用版和数据库更改后,可以创建更改后SQL试用版。
在对您希望评估其SQL性能影响的数据库进行更改之后,按照以下步骤使用SQL performance Analyzer创建一个更改后的SQL试用版:
The SQL Performance Analyzer page appears.
The SQL Performance Analyzer Task page for that task appears.
Trial Name: Accept the default trial name, or enter the name you want to use for the trial.
Description: Optionally, enter a description for the trial.
Execution Type: Choose the type of execution you want to use for the trial:
Test Execute: This method test executes SQL statements through SQL Performance Analyzer. This can be done on the database running SPA Performance Analyzer or on a remote database.
Explain Plan: This method generates execution plans only for SQL statements through SQL Performance Analyzer. This can be done on the database running SPA Performance or on a remote database. Unlike the EXPLAIN PLAN
statement, SQL trials using the explain plan method take bind values into account and generate the actual execution plan.
Convert SQL Tuning Set: This method converts the execution statistics and plans stored in a SQL tuning set to a trial. You can then compare this trial with other trials. A tuning set does not contain all the data that is collected from a test execute trial, so if you create a comparison of a convert SQL tuning set trial with a test execute trial, there will be fewer comparison metrics available.
如果您想安排试验运行的时间,请单击右箭头按钮转到Schedule选项卡。或者,单击OK立即运行试验。
在执行试验时,它的状态显示在SQL Performance Analyzer任务页面的SQL Trials任务页的SQL Trials部分的status列中。
当试验完成时,在SQL Performance Analyzer任务页面的SQL Trials任务页的SQL Trials部分中,试验的Status列中会出现一个复选标记图标。
更改后的SQL测试完成后,您可以比较更改前的SQL测试和更改后的SQL测试,以评估数据库更改对SQL性能的影响。
See Also:
"Creating a Pre-Change SQL Trial"
"Comparing Two SQL Trials"
11.6.4 比较两个SQL试验
在创建了更改前的SQL试用版和更改后的SQL试用版之后,可以使用SQL Performance Analyzer比较这两个SQL试用版,以评估数据库更改对SQL性能的影响。
按照以下步骤比较两个SQL试验:
The SQL Performance Analyzer page appears.
The SQL Performance Analyzer Task page for that task appears.
Comparison Report Name: Accept the default comparison report name, or enter the name you want to use for the report.
Description: Optionally, enter a description for the comparison.
Trial 1 Name: Select the first trial to use in the comparison. Although you can select any trial, typically you will choose a pre-change SQL trial as the first trial.
Trial 2 Name: Select the second trial to use in the comparison. Although you can select any trial, typically you will choose a post-change SQL trial as the second trial.
Comparison Metric: Select the metric to use for the comparison.
Click the right arrow button to go to the Schedule tab if you want to schedule a time for the comparison to run. Or, click OK to run the comparison immediately.
When the comparison is being performed, its status is displayed in the Status column in the SQL Trial Comparisons section of the SQL Performance Analyzer Task page for the task.
任务的SQL Performance Analyzer报告页面显示了两个试验的比较报告。
顶部SQL语句部分显示了这两个试验的顶部SQL语句的比较。
Status列显示每个语句的性能是改进了、倒退了还是没有变化。
使用类别筛选器显示所有顶级SQL语句,或仅显示可用类别之一中的SQL语句。
See Also:
"Creating a Pre-Change SQL Trial"
"Creating a Post-Change SQL Trial"
Oracle By Example (OBE)有一系列关于Oracle数据库2天DBA指南的文章。此OBE将指导您完成本节中的任务,并包括带注释的屏幕截图。
To view the Analyzing the Impact of Database Changes on SQL Performance OBE, enter the following URL in your web browser:
https://apexapps.oracle.com/pls/apex/f?p=44785:24:::NO:24:P24_CONTENT_ID:16834