Subject: Why creation of sql profiles take forever




I am on Oracle 10.2.0.4 on HP UNIX 11i. I am creating sql profiles using following logic. Sometimes sql profile is generated in 1-2 minutes. Many times , even after an hour, no sql profile is created and I get timeout errors . I increased time limit from 3600 (1 hr) to 7200 (2 hrs), still timeout error, why?

-- Tuning task created for specific a statement from the AWR.
DECLARE
l_sql_tune_task_id VARCHAR2(100);
BEGIN

l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task ( sql_id => '$SQLSTMTID', scope =
DBMS_SQLTUNE.scope_comprehensive, time_limit => 3600, task_name => '${SQLSTMTID}_AWR_tuning_tas
k', description => 'Tuning task for statement ${SQLSTMTID} in AWR.');
--DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
END;
/
EXEC DBMS_SQLTUNE.execute_tuning_task(task_name => '${SQLSTMTID}_AWR_tuning_task');

.