221.To generate recommendations to improve the performance of a set of SQL queries in an application,
you execute the following blocks of code:
BEGIN dbms_advisor.create_task(dbms_advisor.sqlaccess_advisor,'TASK1'); END;/
BEGIN dbms_advisor.set_task_parameter('TASK1','ANALYSIS_SCOPE','ALL');
dbms_advisor.set_task_parameter('TASK1','MODE','COMPREHENSIVE');
END;
/
BEGIN
dbms_advisor.execute_task('TASK1');
dbms_output.put_line(dbms_advisor.get_task_script('TASK1'));
END;
/
The blocks of code execute successfully; however, you do not get the required outcome.
What could be the reason?
A. A template needs to be associated with the task.
B. A workload needs to be associated with the task.
C. The partial or complete workload scope needs to be associated with the task.
D. The type of structures (indexes, materialized views, or partitions) to be recommended need to be
specified for the task.
Answer: B
答案解析:
参考:http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_advis.htm#ARPLS65121
GET_TASK_SCRIPT Function |
Creates and returns an executable SQL script of the Advisor task's recommendations in a buffer |
SQL Access Advisor |
This function creates a SQL*Plus-compatible SQL script and sends the output to file. The script will contain all of the accepted recommendations from the specified task.
Syntax
Parameters
Table 18-19 GET_TASK_SCRIPT Function Parameters
Parameter | Description |
---|---|
|
The task name that uniquely identifies an existing task. |
|
Specifies the type of script to generate. The possible values are |
|
An optional recommendation identifier number that can be used to extract a subset of the implementation script. A zero or the value |
|
Optional action identifier number that can be used to extract a single action as a DDL command. A zero or the value |
|
An optional task owner name. |
|
An identifier of a specific execution of the task. It is needed only for advisors that allow their tasks to be executed multiple times. |
|
An identifier of an advisor object that can be targeted by the script. |
Return Values
Returns the script as a CLOB
buffer.
Usage Notes
Though the script is ready to execute, Oracle recommends that the user review the script for acceptable locations for new materialized views and indexes.
For a recommendation to appear in a generated script, it must be marked as accepted.
Examples