Skip Headers
Oracle® Database Real Application Testing User's Guide
11g Release 2 (11.2)

Part Number E12254-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

9 Creating a Pre-Change SQL Trial

After creating a SQL Performance Analyzer task and selecting a SQL tuning set as the input source, you need to establish the initial environment on the test system. Establishing the database environment on the test system involves manually making any necessary environmental changes that affect SQL optimization and performance. These changes may include changing initialization parameters, gathering or setting optimizer statistics, and creating indexes. It is recommended that you build a test system that is as similar to the production system as possible. The dedicated workflows in Enterprise Manager simplifies this process by creating both SQL trials automatically and performing the change restricted to the testing session. For information about setting up the database environment, see "Setting Up the Test System".

Once the environment on the test system is properly configured, you can build the pre-change version of performance data before performing the system change. You can build SQL trials using SQL Performance Analyzer by using one of the following methods:

For more information, see "Measuring the Pre-Change SQL Performance"

This chapter described how to create the pre-change SQL trial and contains the following topics:

Note:

The primary interface for creating a pre-change SQL trial is Oracle Enterprise Manager. If for some reason Oracle Enterprise Manager is unavailable, you can create a pre-change SQL trial using the DBMS_SQLPA PL/SQL package.

Tip:

Before creating a pre-change SQL trial, you need to create a SQL Performance Analyzer task, as described in Chapter 8, "Creating an Analysis Task".

9.1 Creating a Pre-Change SQL Trial Using Enterprise Manager

This section describes how to collect the pre-change SQL performance data using Oracle Enterprise Manager.

To create a pre-change SQL trial using Enterprise Manager:

  1. On the Guided Workflow page, click the Execute icon for the Create SQL Trial in Initial Environment step.

    The Create SQL Trial page appears. A summary of the selected SQL tuning set containing the SQL workload is displayed.

    Description of spa_create_trial.gif follows
    Description of the illustration spa_create_trial.gif

  2. In the SQL Trial Name field, enter the name of the SQL trial.

  3. In the SQL Trial Description field, enter a description of the SQL trial.

  4. In the Creation Method list, determine how the SQL trial is created and what contents are generated by performing one of the following actions:

    • Select Execute SQLs Locally.

      The SQL trial generates both execution plans and statistics for each SQL statement in the SQL tuning set by actually running the SQL statements locally on the test system.

    • Select Execute SQLs Remotely.

      The SQL trial generates both execution plans and statistics for each SQL statement in the SQL tuning set by actually running the SQL statements remotely on another test system over a public database link.

    • Select Generate Plans Locally.

      The SQL trial invokes the optimizer to create execution plans locally on the test system, after taking bind values and optimizer configuration into account, without actually running the SQL statements.

    • Select Generate Plans Remotely.

      The SQL trial invokes the optimizer to create execution plans remotely on another test system, after taking bind values and optimizer configuration into account, over a public database link without actually running the SQL statements.

    • Select Build From SQL Tuning Set.

      The SQL trial copies the execution plans and statistics from the SQL tuning set directly into the trial.

    For more information about the different methods, see "Measuring the Pre-Change SQL Performance".

  5. In the Per-SQL Time Limit list, determine the time limit for SQL execution during the trial by performing one of the following actions:

    • Select 5 minutes.

      The execution will run each SQL statement in the SQL tuning set up to 5 minutes and gather performance data.

    • Select Unlimited.

      The execution will run each SQL statement in the SQL tuning set to completion and gather performance data. Collecting execution statistics provides greater accuracy in the performance analysis but takes a longer time. Using this setting is not recommended because the task may be stalled by one SQL statement for a prolonged period.

    • Select Customize and enter the specified number of seconds, minutes, or hours.

  6. Ensure that the database environment on the test system matches the production environment as closely as possible, and select Trial environment established.

  7. In the Schedule section:

    1. In the Time Zone list, select your time zone code.

    2. Select Immediately to start the task now, or Later to schedule the task to start at a time specified using the Date and Time fields.

  8. Click Submit.

    The Guided Workflow page appears when the execution begins.

    The status icon of this step changes to a clock while the execution is in progress. To refresh the status icon, click Refresh. Depending on the options selected and the size of the SQL workload, the execution may take a long time to complete. After the execution is completed, the Status icon will change to a check mark and the Execute icon for the next step is enabled.

  9. Once the pre-change performance data is built, you can make the system change and build the post-change performance data by re-executing the SQL statements in the SQL tuning set on the post-change test system, as described in Chapter 10, "Creating a Post-Change SQL Trial".

9.2 Creating a Pre-Change SQL Trial Using APIs

This section describes how to build the pre-change performance data by using the DBMS_SQLPA.EXECUTE_ANALYSIS_TASK procedure.

Call the EXECUTE_ANALYSIS_TASK procedure using the following parameters:

The following example illustrates a function call made before a system change:

EXEC DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(task_name => 'my_spa_task', -
       execution_type => 'TEST EXECUTE', - 
       execution_name => 'my_exec_BEFORE_change');

Once the pre-change performance data is built, you can make the system change and build the post-change performance data by re-executing the SQL statements in the SQL tuning set on the post-change test system, as described in Chapter 10, "Creating a Post-Change SQL Trial".

See Also: