欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 --Task recommendation 是一个范围,从简单的建议到复杂的解决方案。当advisortask 执行时,SQL Access Advisor 会仔细分析收集数据和用户定义的参数。 1.3.4 Viewand implement the recommendation

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

--Task recommendation 是一个范围,从简单的建议到复杂的解决方案。当advisortask 执行时,SQL Access Advisor 会仔细分析收集数据和用户定义的参数。

1.3.4 Viewand implement the recommendations

You can view therecommendations from SQL Access Advisor in either of the following ways:

--可以使用如下2种方法来查看recommendation的内容:

(1)Using thecatalog views

(2)Generating ascript using the DBMS_ADVISOR.GET_TASK_SCRIPT procedure

In EnterpriseManager, you may display the recommendations after SQL Access Advisor processhas completed. See "ViewingRecommendations" for a description of using the catalog views toview the recommendations. See "GeneratingSQL Scripts" to see how to create a script.

--在OEM中,在SQL Access Advisor 进程处理完毕后会自动显示recommendation。

You need notaccept all recommendations. You can mark the ones to be included in therecommendation script. However, when base table partitioning is recommended,some recommendations depend on others. For example, you cannot implement alocal index if you do not also implement the partitioning recommendation on theindex base table.

The final stepis then implementing the recommendations and verifying that query performancehas improved.

1.3.5 SQLAccess Advisor Repository

All theinformation needed and generated by SQL Access Advisor resides in the Advisorrepository, which is a part of the database dictionary. The benefits of usingthe repository are that it:

--Advisor 生成的所有信息都存放在Advisor repository中,其是数据字典的一部分,使用repository有如下好处:

(1) Collects a complete workloadfor SQL Access Advisor.

(2) Supports historical data.

(3) Is managed by the server.

1.3.6 使用SQLAccess Advisor需要的权限

You must have the ADVISOR privilege tomanage or use SQL Access Advisor. When processing a workload, SQL AccessAdvisor attempts to validate each statement to identify table and columnreferences. The database achieves validation by processing each statement as ifit were being executed by the statement's original user.

--必须需要有ADVISOR权限

If the user doesnot have SELECT privileges to a particular table, then SQL AccessAdvisor bypasses the statement referencing the table. This behavior can causemany statements to be excluded from analysis. If SQL Access Advisor excludesall statements in a workload, then the workload is invalid. SQL Access Advisorreturns the following message:

QSM-00774, thereare no SQL statements to process for task TASK_NAME

--必须需要有指定表的select 的权限,否则会报QSM-774错误。

To avoid missingcritical workload queries, the current database user must have SELECT privilegeson the tables targeted for materialized view analysis. For these tables, these SELECT privilegescannot be obtained through a role.

Additionally,you must have the ADMINISTER SQL TUNING SET privilege to create andmanage workloads in SQL tuning set objects. To run the Advisor on SQL tuningsets owned by other users, you must have the ADMINISTER ANY SQL TUNING SET privilege.

--还需要 ADMINISTER SQL TUNING SET的权限来创建和管理workload。

二。手工生成SQLAccess Advisor 示例

From:

http://www.oracle-base.com/articles/10g/SQLAccessAdvisor10g.php

2.1 DBMS_ADVISOR

The DBMS_ADVISOR packagecan be used to create and execute any advisor tasks, including SQL AccessAdvisor tasks. The following example shows how it is used to create, executeand display a typical SQL Access Advisor script for the current workload.

--DBMS_ADVISOR 包可以用来创建和执行advisor 任务。

DECLARE

l_taskname VARCHAR2(30) := 'test_sql_access_task';

l_task_desc VARCHAR2(128) := 'Test SQL Access Task';

l_wkld_name VARCHAR2(30) := 'test_work_load';

l_saved_rows NUMBER := 0;

l_failed_rows NUMBER := 0;

l_num_found NUMBER;

BEGIN

-- Create an SQLAccess Advisor task.

DBMS_ADVISOR.create_task (

advisor_name => DBMS_ADVISOR.sqlaccess_advisor,

task_name => l_taskname,

task_desc => l_task_desc);

-- Reset the task.

DBMS_ADVISOR.reset_task(task_name => l_taskname);

-- Create a workload.

SELECT COUNT(*)

INTO l_num_found

FROM user_advisor_sqlw_sum

WHERE workload_name =l_wkld_name;

IFl_num_found = 0 THEN

DBMS_ADVISOR.create_sqlwkld(workload_name => l_wkld_name);

ENDIF;

-- Link the workload to the task.

SELECT count(*)

INTO l_num_found

FROM user_advisor_sqla_wk_map

WHERE task_name = l_taskname

AND workload_name =l_wkld_name;

IFl_num_found = 0 THEN

DBMS_ADVISOR.add_sqlwkld_ref(

task_name => l_taskname,

workload_name => l_wkld_name);

ENDIF;

-- Set workload parameters.

DBMS_ADVISOR.set_sqlwkld_parameter(l_wkld_name, 'ACTION_LIST',DBMS_ADVISOR.ADVISOR_UNUSED);

DBMS_ADVISOR.set_sqlwkld_parameter(l_wkld_name,'MODULE_LIST', DBMS_ADVISOR.ADVISOR_UNUSED);

DBMS_ADVISOR.set_sqlwkld_parameter(l_wkld_name, 'SQL_LIMIT',DBMS_ADVISOR.ADVISOR_UNLIMITED);

DBMS_ADVISOR.set_sqlwkld_parameter(l_wkld_name, 'ORDER_LIST', 'PRIORITY,OPTIMIZER_COST');

DBMS_ADVISOR.set_sqlwkld_parameter(l_wkld_name, 'USERNAME_LIST',DBMS_ADVISOR.ADVISOR_UNUSED);

DBMS_ADVISOR.set_sqlwkld_parameter(l_wkld_name, 'VALID_TABLE_LIST',DBMS_ADVISOR.ADVISOR_UNUSED);

DBMS_ADVISOR.import_sqlwkld_sqlcache(l_wkld_name, 'REPLACE', 2,l_saved_rows, l_failed_rows);

-- Set task parameters.

DBMS_ADVISOR.set_task_parameter(l_taskname, '_MARK_IMPLEMENTATION','FALSE');

DBMS_ADVISOR.set_task_parameter(l_taskname, 'EXECUTION_TYPE','INDEX_ONLY');

DBMS_ADVISOR.set_task_parameter(l_taskname, 'MODE', 'COMPREHENSIVE');

DBMS_ADVISOR.set_task_parameter(l_taskname, 'STORAGE_CHANGE',DBMS_ADVISOR.ADVISOR_UNLIMITED);

DBMS_ADVISOR.set_task_parameter(l_taskname, 'DML_VOLATILITY', 'TRUE');

DBMS_ADVISOR.set_task_parameter(l_taskname, 'ORDER_LIST','PRIORITY,OPTIMIZER_COST');

DBMS_ADVISOR.set_task_parameter(l_taskname, 'WORKLOAD_SCOPE','PARTIAL');

DBMS_ADVISOR.set_task_parameter(l_taskname, 'DEF_INDEX_TABLESPACE',DBMS_ADVISOR.ADVISOR_UNUSED);

DBMS_ADVISOR.set_task_parameter(l_taskname, 'DEF_INDEX_OWNER',DBMS_ADVISOR.ADVISOR_UNUSED);

DBMS_ADVISOR.set_task_parameter(l_taskname, 'DEF_MVIEW_TABLESPACE',DBMS_ADVISOR.ADVISOR_UNUSED);

DBMS_ADVISOR.set_task_parameter(l_taskname, 'DEF_MVIEW_OWNER', DBMS_ADVISOR.ADVISOR_UNUSED);

-- Execute the task.

DBMS_ADVISOR.execute_task(task_name => l_taskname);

END;

/

-- Display the resultingscript.

SET LONG 100000

SET PAGESIZE 50000

SELECT DBMS_ADVISOR.get_task_script('test_sql_access_task') AS script FROM dual;

SET PAGESIZE 24

The value for the SET LONG commandshould be adjusted to allow the whole script to be displayed.

在我测试环境上的输入结果如下:

PL/SQL procedure successfully completed.

SCRIPT

--------------------------------------------------------------------------------

Rem SQL AccessAdvisor: Version 10.2.0.4.0 - Production

Rem

Rem Username: SYS

Rem Task: test_sql_access_task

Rem Executiondate: 31/01/2012 21:50

Rem

CREATE BITMAP INDEX "QSOA"."DATA_OA_MESSAGE_IDX$$_167F0001"

ON"QSOA"."DATA_OA_MESSAGE"

("MESS_TYPE")

COMPUTESTATISTICS;

CREATE INDEX"ZHAOKA"."CFG_GAME_AREA_S_IDX$$_167F0004"

ON "ZHAOKA"."CFG_GAME_AREA_SERVER"

("AREA_ID","AREA_NAME","SERVER_ID","SERVER_NAME")

COMPUTESTATISTICS;

2.2 Quick Tune

If you just wantto tune an individual statement you can use the QUICK_TUNE procedureas follows.

--如果仅仅是调整一个独立的语句,可以使用QUICK_TUNE过程:

BEGIN

DBMS_ADVISOR.quick_tune(

advisor_name => DBMS_ADVISOR.SQLACCESS_ADVISOR,

task_name =>'emp_quick_tune',

attr1 => 'SELECT e.*FROM emp e WHERE UPPER(e.ename) = ''SMITH''');

END;

/

Any recommendations can then be displayed using the previous query with the correcttask name specified.

查询输出结果和之前的一样,使用:

Select DBMS_ADVISOR.get_task_script(‘emp_quick_tune’) fromdual;

2.3 Related Views

The followingviews can be used to display the SQL Access Advisor output without usingEnterprise Manager or the get_task_script function:

--可以使用以下视图来查看advisor的输出:

(1) DBA_ADVISOR_TASKS:Basic information about existingtasks.

(2) DBA_ADVISOR_LOG :Status information about existingtasks.

(3) DBA_ADVISOR_FINDINGS : Findings identified for anexisting task.

(4) DBA_ADVISOR_RECOMMENDATIONS : Recommendations for the problemsidentified by an existing task.

[1] [2]

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

oracle sqladvisor,Oracle SQL Access Advisor 说明相关推荐

  1. oracle access advisor,使用Oracle SQL Access Advisor改善数据库索引与物化视图

    当针对表集增加物化视图(materialized view)和索引时,理论上这些表的查询性能会得到改善.但事实上并不一定能达到理想的状态,因此Oracle推出了SQL Access Advisor工具 ...

  2. oracle access advisor,oracle11g新特性-SQL Access Advisor

    SQL Access Advisor 获得有关基于实际频率和使用类型(而非数据类型)进行分区.索引和创建物化视图以改进模式设计的建议. g 提供了大量帮助程序(或"顾问程序"),可 ...

  3. Oracle SQL Access Advisor 说明

    一.说明 1.1 相关内容 在如下官方文档中提到了一些优化工具的说明: Monitoring and Tuning the Database http://docs.oracle.com/cd/E11 ...

  4. oracle advisor权限,Oracle调整顾问(SQL Tuning Advisor 与 SQL Access Advisor )

    在Oracle数据库出现性能问题时,使用Oracle本身的工具包,给出合理的调优建议是比较省力的做法.将一条或多条SQL语句做为输入内容 在Oracle数据库出现性能问题时,使用Oracle本身的工具 ...

  5. oracle access advisor,SQL Access Advisor的使用

    环境: OS:Red Hat Linux As 5 DB:10.2.0.4 SQL Access Advisor是伴随着10G出现的一个优化工具,提供对表分区,物化视图,索引,物化视图日志优化建议.下 ...

  6. 使用dbms_advisor来执行sql access advisor

    使用dbms_advisor来执行sql access advisor主要有以下几个步骤: 1.创建任务 2.定义工作量 3.生成建议 4.查看与实现建议 步骤1 创建任务 在任务建议被生成之前,必须 ...

  7. oracle sqladvisor,Oracle 11 sql tuning advisor sql access advisor关闭以及job查看与停止

    Oracle11g自动维护任务 参考博客:http://blog.itpub.net/12798004/viewspace-1247636/ # 自动收集优化器统计信息 收集数据库所有schema没有 ...

  8. Oracle SQL Tuning Advisor 测试

    如果面对一个需要优化的SQL语句,没有很好的想法,可以先试试Oracle的SQL Tuning Advisor. SQL> select * from v$version;BANNER ---- ...

  9. ORACLE SQL Tuning Advisor

    前言:一直以来SQL调优都是DBA比较费力的技术活,而且很多DBA如果没有从事过开发的工作,那么调优更是一项头疼的工作,即使是SQL调优很厉害的高手,在SQL调优的过程中也要不停的分析执行计划.加HI ...

最新文章

  1. 多个微服务控制台的多窗口展示
  2. mysql附件卸载_彻底卸载mysql
  3. Docker之几种storage-driver比较
  4. 用存储过程还原数据库
  5. Linux下PortSentry的配置
  6. tex文件用什么软件打开_pdf怎么打开?用什么软件打开pdf?
  7. linux里gpl_GPL实施,ONOS与Linux Foundation合作以及更多新闻
  8. Android自定义控件学习(五)-------自定义绘图
  9. 如何借助大数据进行宏观经济分析
  10. 用python实现自动回复QQ消息——不到60行
  11. 电子邮件收发的原理和相关协议
  12. vue实现一键回到顶部
  13. 怎么彻底删除users下的文件夹_users中的那些文件可以删除。。。。。。。有哪些文件是不能删除呢?...
  14. XGBoost股票预测
  15. python学习笔记之自定义函数
  16. 碳云智能CEO王俊:大数据基础上人人都将活到120岁 | 2017 IT领袖峰会
  17. SELECT连表查询重复字段
  18. CPU缓存L1,L2和L3是什么?如何工作?
  19. 美国国防部表示区块链可用于灾难救援
  20. 当销售离当老总还有多远(转)

热门文章

  1. 功能性农业国稻种芯(辽宁)现代农业产业园盘锦模式变革
  2. 声控 计算机,声控计算机制作与应用入门
  3. Microsoft.Practices.EnterpriseLibrary.Data 数据库操作
  4. 复制地址时出现LRE标识符是怎么回事?
  5. <2021SC@SDUSC>【Overload游戏引擎】OvUI源码模块分析(六)——Widgets
  6. android连连看课程设计报告,Android连连看课程设计专业文件.doc
  7. 三款主流云笔记软件比较
  8. 转WEB前端开发经验总结(2)
  9. 云易卡社区系统V4.7源码
  10. sans-serif,serif,monospace