DBMS_SQLTUNE详解(2)---sql_profile
来源:互联网 发布:广联达预算软件试用版 编辑:程序博客网 时间:2024/06/06 09:11
DBMS_SQLTUNE详解(2)---sql_profile
---转载http://blog.sina.com.cn/s/blog_61cd89f60102edlp.html
DBMS_SQLTUNE是10g引入的一个新特性,它可以通过自动优化性能较差SQL,并给出合理的优化建议,可以通过OEM进行管理,其中优化建议中的sql_profile文件它是一个存储在数据字典中的信息集合,在SQL执行过程中自动发现并修改较差的估值,进而影响优化器选择最优的执行计划,因此sql_profile文件可以达到不修改应用程序的情况下修改执行计划。
一、执行DBMS_SQLTUNE所需要的权限
二、sql_profile文件的作用
三、sql_profile文件相关设置
四、sql_profile文件的管理
Using Enterprise Manager
- On the Performance page, click Top Activity.
The Top Activity page appears. - Under Top SQL, click the SQL ID link of the SQL statement that is using a SQL profile.
The SQL Details page appears. - Click the Plan Control tab.
A list of SQL profiles is displayed under SQL Profiles and Outlines. - Select the SQL profile you want to manage.
Do one of the following:- To enable a SQL profile that is disabled, click Disable/Enable.
- To disable a SQL profile that is enabled, click Disable/Enable.
- To remove a SQL profile, click Delete.
- A confirmation page appears.
Click Yes to continue, or No to cancel the action
Using DBMS_SQLTUNE package.
To use the SQL Profiles APIs, you need the CREATE ANY SQL_PROFILE, DROP ANY SQL_PROFILE, and ALTER ANY SQL_PROFILE system privileges.
Accepting a SQL Profile
Use the DBMS_SQLTUNE.ACCEPT_SQL_PROFILE procedure to accept a SQL Profile recommended by the SQL Tuning Advisor. This creates and stores a SQL Profile in the database.
my_sqlprofile_name VARCHAR2(30);
BEGIN
my_sqlprofile_name := DBMS_SQLTUNE.ACCEPT_SQL_PROFILE (
task_name => 'my_sql_tuning_task',
name => 'my_sql_profile');
END;
my_sql_tuning_task is the name of the SQL tuning task.
You can view information about a SQL Profile in the DBA_SQL_PROFILES view.
Altering a SQL Profile
Alter the STATUS, NAME, DESCRIPTION, and CATEGORY attributes of
DBMS_SQLTUNE.ALTER_SQL_PROFILE(
name => 'my_sql_profile',
attribute_name => 'STATUS',
value => 'DISABLED');
END;
/
In this example, my_sql_profile is the name of the SQL Profile that you want to alter.
The status attribute is changed to disabled which means the SQL Profile will not be used during SQL compilation.
Dropping a SQL Profile
A SQL Profile can be dropped using the DROP_SQL_PROFILE procedure.
DBMS_SQLTUNE.DROP_SQL_PROFILE(name => 'my_sql_profile');
end;
/
需要注意的是,sql_profile文件可以使SQL中的hint失效,因此当我们在管理数据库中研究执行计划时,如果发现hint没有启作用,有可能是sql_profile文件影响的结果!
四、查看所有优化任务集
SELECT 'SELECT d.id , d.owner , d.description , d.created , d.last_modified , d.statement_count, ss.*
FROM TABLE(DBMS_SQLTUNE.select_sqlset ('''||name||''')) ss, dba_sqlset d WHERE d.name='''||name||''';'
FROM dba_sqlset d
ORDER BY d.last_modified DESC
五、更多相关信息详见:
NOTE:457531.1 - How to Move SQL Profiles from One Database to Another (Including to Higher Versions)
NOTE:1253696.1 - How To Use SQL Profiles for Queries Using Different Literals
- DBMS_SQLTUNE详解(2)---sql_profile
- SQL优化----dbms_sqltune详解
- SQL优化----dbms_sqltune详解(1)
- ORACLE dbms_sqltune
- sql_profile固定执行计划
- 手动创建SQL_PROFILE
- dbms_sqltune包的使用
- 使用DBMS_SQLTUNE优化SQL
- 手动生成sql_profile的方法
- sql profiles和dbms_sqltune(sta)
- dbms_sqltune.extract_bind查询绑定变量的值
- Oracle10g新特性:使用DBMS_SQLTUNE优化SQL
- Oracle10g新特性:使用DBMS_SQLTUNE优化SQL
- HINT /*+ monitor */和 dbms_sqltune.report_sql_monitor连用
- Real-Time SQL Monitoring using DBMS_SQLTUNE
- dbms_sqltune.accept_sql_profile 中force_match的作用
- SQL调优工具包DBMS_SQLTUNE的使用方法
- ORACLE的DBMS_SQLTUNE调优某个SQL
- 分布式系统与一致性协议
- what's the function of pid file?
- ACM GVIM配置 在windows/linux 快捷键
- SHOPNC所有分类代码简化版
- 关于NSNotification和NSTimer的观点
- DBMS_SQLTUNE详解(2)---sql_profile
- ubuntu SecureCRT 下载并破解
- 史上最易懂的Android jni开发资料--NDK环境搭建
- BZOJ1415【概率DP】
- CSAPP深入理解操作系统 课程实验 bomb 反向编译 汇编(3)
- Create Image with useful softwares
- 【树链剖分】【点权】
- linux系统下将一个文件拷贝到另一个文件下的命令行操作
- Android 目录