To create a stored outline, you must have the CREATE ANY OUTLINE system privilege. Outlines are created in one of two ways, with the CREATE OUTLINE SQL statement, or with the CREATE_STORED_OUTLINES initialization parameter. Below is an example of creating a stored outline:
CREATE OR REPLACE OUTLINE emp_outline
FOR CATEGORY employee_application
ON
SELECT * FROM emp WHERE empno = 1001;
Here, the CREATE OUTLINE command is used to create the outline named EMP_OUTLINE in the category EMPLOYEE_APPLICATION. The outline was created for the SQL statement previously defined. When this outline is created, whatever execution plan was used to process the given SQL statement will be stored as an outline. To change the execution plan for this particular SQL statement, play around with initialization parameters until the query runs as you want it. When a user activates this category of outlines and issues the above query, it will run with the execution plan stored in the outline.
Another way to create the same outline is with the CREATE_STORED_OUTLINES initialization parameter. For example:
ALTER SESSION SET create_stored_outlines=employee_application;
SELECT * FROM emp WHERE empno = 1001;
ALTER SESSION SET create_stored_outlines=FALSE;
When the session is modified, all the statements executed will have their execution plans stored as outlines for the category specified in the initialization parameter's value. Setting the parameter to FALSE stops collection of outlines for SQL statements in that session.
0 comments:
Post a Comment