生产上有一套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:
1
2
3
4
5
6
7
|
COLUMN
parameter_value FORMAT A30
SELECT
parameter_name, parameter_value
FROM
dba_advisor_parameters
WHERE
task_name =
'SYS_AUTO_SQL_TUNING_TASK'
AND
parameter_name
IN
(
'TIME_LIMIT'
,
'DEFAULT_EXECUTION_TYPE'
,
'LOCAL_TIME_LIMIT'
);
|
Then, increase the time:
Using:
1
2
3
4
|
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。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
--查询当前任务状态
SYS@db2>
select
client_name,status
from
DBA_AUTOTASK_CLIENT;
CLIENT_NAME STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection ENABLED
auto
space
advisor ENABLED
sql tuning advisor ENABLED
--禁用sql tuning advisor
SYS@db2>
BEGIN
2 dbms_auto_task_admin.disable(
3 client_name =>
'sql tuning advisor'
,
4 operation =>
NULL
,
5 window_name =>
NULL
);
6
END
;
7 /
PL/SQL
procedure
successfully completed.
--再次查询状态
SYS@db2>
select
client_name,status
from
DBA_AUTOTASK_CLIENT;
CLIENT_NAME STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection ENABLED
auto
space
advisor ENABLED
sql tuning advisor DISABLED
--启用sql tuning advisor
BEGIN
dbms_auto_task_admin.enable(
client_name =>
'sql tuning advisor'
,
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
本文转自hbxztc 51CTO博客,原文链接:http://blog.51cto.com/hbxztc/1870577,如需转载请自行联系原作者