Oracle 11G OCP 1Z0-053 221

(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.

答案:(B)

解析:

DECLARE

  task_id       NUMBER;

  task_name     VARCHAR2(30);

  workload_name VARCHAR2(30);

  buf CLOB;

BEGIN

  task_name := 'My Task';

  workload_name := 'My Workload';

  DBMS_ADVISOR.CREATE_TASK(DBMS_ADVISOR.SQLACCESS_ADVISOR, task_id, task_name);

  DBMS_ADVISOR.CREATE_SQLWKLD(workload_name, 'My Workload');

  DBMS_ADVISOR.ADD_SQLWKLD_REF(task_name,workload_name);

  DBMS_ADVISOR.ADD_SQLWKLD_STATEMENT(workload_name,'MONTHLY','ROLLUP',100,400,5041,103,640445,680000,2,

                                     1,SYSDATE,1,'SH','SELECT AVG(amount_sold) FROM sh.sales');

  DBMS_ADVISOR.EXECUTE_TASK(task_name);

  buf := DBMS_ADVISOR.GET_TASK_SCRIPT(task_name);

END;

请使用浏览器的分享功能分享到微信等