ORACLE 11G 禁用 SQL TUNING ADVISOR

前端之家收集整理的这篇文章主要介绍了ORACLE 11G 禁用 SQL TUNING ADVISOR前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

生产上有一套11g数据库alert.log报错ORA-16957: sql Analyze time limit interrupt。

查询MOS相关文档Troubleshooting: ORA-16957: "sql Analyze time limit interrupt" Errors (文档 ID 1275248.1)

The ORA-16957 error is an internal error code used to indicate that sql Tuning Task has reached the time limit for tuning a specific sql.

The default time limit is 3600 seconds.

1. Check the current timing:

COLUMNparameter_valueFORMATA30
SELECTparameter_name,parameter_value
FROMdba_advisor_parameters
WHEREtask_name='SYS_AUTO_sql_TUNING_TASK'
ANDparameter_nameIN('TIME_LIMIT','DEFAULT_EXECUTION_TYPE','LOCAL_TIME_LIMIT');


Then,increase the time:

Using:

BEGIN
DBMS_sqlTUNE.SET_TUNING_TASK_PARAMETER(task_name=>'SYS_AUTO_sql_TUNING_TASK',parameter=>'TIME_LIMIT',value=>7200);
END;
/

意思是后台自动分析sql耗时超过了默认的时间限制3600s,需要使用DBMS_sqlTUNE.SET_TUNING_TASK_PARAMETER包增长时间限制。

一般在生产上不默认是不开启sql TUNING ADVISOR。可以使用下面代码关闭自动sql TUNING ADVISOR。

--查询当前任务状态
SYS@db2>selectclient_name,statusfromDBA_AUTOTASK_CLIENT;

CLIENT_NAMESTATUS
------------------------------------------------------------------------
autooptimizerstatscollectionENABLED
autospaceadvisorENABLED
sqltuningadvisorENABLED
--禁用sqltuningadvisor
SYS@db2>BEGIN
2dbms_auto_task_admin.disable(
3client_name=>'sqltuningadvisor',4operation=>NULL,5window_name=>NULL);
6END;
7/

PL/sqlproceduresuccessfullycompleted.
--再次查询状态
SYS@db2>selectclient_name,statusfromDBA_AUTOTASK_CLIENT;

CLIENT_NAMESTATUS
------------------------------------------------------------------------
autooptimizerstatscollectionENABLED
autospaceadvisorENABLED
sqltuningadvisorDISABLED
--启用sqltuningadvisor
BEGIN
dbms_auto_task_admin.enable(
client_name=>'sqltuningadvisor',operation=>NULL,window_name=>NULL);
END;

参考文档:http://blog.chinaunix.net/uid-25528717-id-3172008.html

参考文档:http://www.cnblogs.com/suredandan/p/3200157.html

参考文档:http://blog.itpub.net/235507/viewspace-1137629/

官方文档:http://docs.oracle.com/cd/E11882_01/server.112/e25494/tasks.htm#ADMIN12332

原文链接:https://www.f2er.com/oracle/211900.html

猜你在找的Oracle相关文章