设为首页 收藏本站
查看: 1173|回复: 0

[经验分享] OCP-1Z0-053-V13.02-221题

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-11-9 09:28:49 | 显示全部楼层 |阅读模式
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



GET_TASK_SCRIPT Function
  
  
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
DBMS_ADVISOR.GET_TASK_SCRIPT (   task_name          IN VARCHAR2   type               IN VARCHAR2 := 'IMPLEMENTATION',   rec_id             IN NUMBER   := NULL,   act_id             IN NUMBER   := NULL,   owner_name         IN VARCHAR2 := NULL,   execution_name     IN VARCHAR2 := NULL,   object_id          IN NUMBER   := NULL)RETURN CLOB;  Parameters
  Table 18-19 GET_TASK_SCRIPT Function Parameters
ParameterDescription  task_name
  The task name that uniquely identifies an existing task.
  type
  Specifies the type of script to generate. The possible values are IMPLEMENTATION and UNDO.
  rec_id
  An optional recommendation identifier number that can be used to extract a subset of the implementation script.
  A zero or the value DBMS_ADVISOR.ADVISOR_ALL indicates all accepted recommendations would be included. The default is to include all accepted recommendations for the task.
  act_id
  Optional action identifier number that can be used to extract a single action as a DDL command.
  A zero or the value DBMS_ADVISOR.ADVISOR_ALL indicates all actions for the recommendation would be included. The default is to include all actions for a recommendation.
  owner_name
  An optional task owner name.
  execution_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.
  object_id
  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
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;/
          版权声明:本文为博主原创文章,未经博主允许不得转载。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-136844-1-1.html 上篇帖子: OCP-1Z0-052-V8.02-26题 下篇帖子: OCP-1Z0-053-V12.02-655题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表