Using Plan Control mode in Optimize SQL consists of two steps. In the first step, SQL Optimizer generates execution plan alternatives for your SQL statement without changing the source code. You can then execute the alternatives to retrieve run time statistics and identify the best alternative for your database environment. In the second step, you can use Plan Control mode to deploy the execution plan to the Manage Plans module as an Oracle plan baseline.
Note: This topic focuses on information that may be unfamiliar to you. It does not include all step and field descriptions.
Select Plan Control from the Optimize SQL start page.
Note: If the start page does not display, click the arrow beside and select New Plan Control Session.
Enter a SQL statement in the Original SQL pane.
Tip: Select the This SQL is contained inside a PL/SQL block checkbox if your SQL statement originated from a PL/SQL block. Selecting this checkbox ensures that the SQL text for the baseline you create matches the SQL text in your database.
Click to generate alternative execution plans for your SQL statement. The Select Connection and Schema window displays.
Click to execute all alternative execution plans to retrieve run time statistics.
Review the run time statistics in the Plans pane to identify the best alternative.
Click .
Review the following for additional information:
Deploy | Description |
---|---|
Select a plan to deploy |
Click and select an execution plan alternative to deploy as a baseline plan. |
Performance comparison |
Use this to review the performance of selected plans against the original. |
Mark the plan as |
Review the following for additional information:
|
Plan name |
Enter a name for the plan. |
Description |
Enter a description for this plan. |
To batch optimize SQL
Select the Batch Optimize SQL tab in the main window.
Click Add Code to Optimize in the Batch Job List pane and select All Types. The Add Batch Optimize SQL Jobs window displays.
Review the following for additional information:
Connection Page | Description |
Connection |
Click to select a previously created database connection. Tips:
|
Database Objects Page | Description |
Database objects |
Select a schema, database object type, or individual database object, and then click to add the object. Tip:
|
Execute using schema |
Click and select an alternative schema for executing the SQL statement alternatives. |
Source Code Page | Description |
Source code type |
Select Text/Binary files, Oracle SQL *Plus Script, or COBOL programming source code to indicate the source code type for the file or directory you want to scan. |
Add by file |
Click and browse to the files you want to add. |
Add by directory |
Click and browse to the directories you want to add. Note: Select the Include Sub-directory checkbox to scan sub-directories. |
Scan using schema |
Click and select a schema to scan. |
Execute using schema |
Click and select an alternative schema for executing the SQL statement alternatives. |
SQL Text Page | Description |
SQL text |
Enter SQL statement text. |
Scan using schema |
Click and select a schema to scan. |
Execute using schema |
Click and select an alternative schema for executing the SQL statement alternatives. |
Scan SQL Page | Description |
Group |
Select the Scanner group that contains the SQL statements you want to scan. |
Scan using schema |
Click and select a schema to scan. |
Execute using schema |
Click and select an alternative schema for executing the SQL statement alternatives. |
Inspect SGA Page | Description |
Group |
Select the Inspector group that contains the SQL statements you want to scan. |
Scan using schema |
Click and select a schema to scan. |
Execute using schema |
Click and select an alternative schema for executing the SQL statement alternatives. |
Note: Batch Optimize helps you manage jobs by organizing them into batches. Use the Batch Info page to create a new batch or to add the current job to an existing batch. |
Click Finish to start batch optimization.
Batch Optimize SQL scans the job you created, classifies and optimizes the statements, and executes the SQL statement alternatives it generates.
Notes:
Scanning starts automatically if you select the Automatically start extracting SQL when job is added checkbox in the Batch Optimize SQL options page. Batch Optimize SQL selects this checkbox by default.
Batch Optimize SQL selects the SQL statement to optimize based on the classification types selected in the Batch Optimize SQL options page. Batch Optimize SQL selects Problematic and Complex SQL classification types by default.
Batch Optimize SQL executes SQL alternatives it generates based on the statement types selected in the Batch Optimize SQL options page. Batch Optimize SQL selects SELECT statements by default.
Select Batch List in the Batch Job List pane to view information about the jobs you created.
The Batch List pane sorts information about your jobs by batches. Additional information displays in the Jobs Improved pane.
Select a batch from the batch list node to see details for the batch in the Job List pane.
The Job List pane displays the type of job, job status, and time of improvement for each job in the batch. Additional information displays in the SQL Classification and Cost and Elapsed Time Comparison panes for a selected job.
Tip: Select a job in the Job List pane and click to generate a replacement script with the optimized SQL statement.
Select a job from the batch node to see details of the job.
The SQL List pane displays SQL classification information for the SQL statements in the job you select. The Original SQL Text and Best Alternative SQL Text panes allow you to compare your original SQL statement with the best alternative Batch Optimize SQL generated.
Tip: Select a SQL statement in the SQL List pane and click to send the statement to Optimize SQL and view all SQL alternatives.
Scan SQL helps you identify problematic SQL statements in your database environment by automatically extracting statements embedded in database objects, stored in application source code and binary files, or captured from Oracle's System Global Area. Scan SQL retrieves and analyzes execution plans for the extracted statements and classifies them according to complexity. You can then send statements that Scan SQL classifies as problematic or complex to Optimize SQL.
Note: This topic focuses on information that may be unfamiliar to you. It does not include all step and field descriptions.
To scan SQL
Select the Scan SQL tab in the main window.
Click to select a previously created group or click to create a new group for your scan job.
Note: Scan SQL helps you manage scan jobs by organizing them into groups.
Click . The Add Scanner Jobs window displays.
Review the following for additional information:
Page | Description |
---|---|
Database Objects Page | |
Database objects |
Select a schema, database object type, or individual database object, and then click to add the object. Tip: Click to browse for database objects. |
Source Code Page | |
Source code type |
Select Text/Binary files, Oracle SQL *Plus Script, or COBOL programming source code to indicate the source code type for the file or directory you want to scan. |
Add by file |
Click and browse to the files you want to add. |
Add by directory |
Click and browse to the directories you want to add. Note: Select the Include Sub-directory checkbox to scan sub-directories. |
Scan using schema |
Click and select a schema to scan. |
Inspect SGA Page | |
Group |
Select the Inspector group that contains the SQL statements you want to scan. |
Scan using schema |
Click and select a schema to scan. |
Click Finish to start scanning.
Select a scan job from the Job List pane to view additional information.
Details displayed in the Job List pane include the number of SQL statements found and the classification for each statement.
Tip: Click and select a different group to display scan jobs from a different group.
Select a SQL statement in the SQL List pane to view additional information for the selected statement in the SQL Text and Execution Plan panes.
Tip: Click in the SQL Text pane to send the selected statement to Optimize SQL.
Inspect SGA retrieves executed SQL statements from Oracle's System Global Area or currently running SQL statements from Oracle's open cursor. Once you retrieve the statements, Inspect SGA displays the statements and their run time statistics so you can identify resource intensive statements in your database environment.
Note: This topic focuses on information that may be unfamiliar to you. It does not include all step and field descriptions.
To retrieve a previously executed SQL statement
Select the Inspect SGA tab in the main window.
Note: To retrieve previously executed SQL statements, you must have privileges to view SYS.V_$SQLAREA and either SYS.V_$SQLTEXT_WITH_NEWLINES or SYS.V_$SQLTEXT.
Click to select a group or click to create a new group in the Group list.
Click . The Add Inspect SGA Job wizard displays.
Complete the following fields in the wizard:
General Information Page | Description |
Job type |
Select the Executed SQL from SQL Area option. |
Collecting Criteria Page | Description |
Collecting Criteria |
Select the Top n records option and enter the number of records to display. |
First by |
Click and select the statistic to use to extract SQL statements if you are not displaying all records. Note: A large SGA increases processing time. |
Collection Time Page | Description |
Collection Time |
Select the Start collecting when you click the Inspect button option. |
Click to retrieve the SQL statements and run time statistics.
Select a statement that requires optimization in the SQL Statistics pane and click to send to Batch Optimize SQL or click the arrow beside and select an option.
Tip: You can add an Inspect SGA job in Batch Optimize SQL to optimize all the SQL statements in the collection.
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center