First find the sql_id for the session, based on something like the following
select SID, SERIAL#, INST_ID, USERNAME, STATUS, PROGRAM, SQL_ID, event
from gv$session
where username = 'REPORTS'
and status = 'ACTIVE' ;
Now we need to create the the tuning task based on the sql_id
DECLARE v_tune_taskid VARCHAR2(100); BEGIN v_tune_taskid := dbms_sqltune.create_tuning_task ( sql_id => '74ztaz3u3wzab', scope => dbms_sqltune.scope_comprehensive, time_limit => 30, task_name => 'sqltune_74ztaz3u3wzab', description => 'Tuning task sql_id 74ztaz3u3wzab'); dbms_output.put_line('taskid = ' || v_tune_taskid); END; /
Now we can execute the task
exec dbms_sqltune.execute_tuning_task(task_name => 'sqltune_74ztaz3u3wzab');
check the status of the job
select task_name, status from dba_advisor_log where owner = 'OWNER_YOU_RAN_TASK_AS';
Once completed we then need to show the ouput
set long 10000; set pagesize 1000 set linesize 220 set pagesize 24 select dbms_sqltune.report_tuning_task('74ztaz3u3wzab_tune_report') as output from dual;
******************************************
keywords: sql_id advisor
******************************************
rdbms version: 11g
******************************************
3 comments:
Howdy just wanted to give you a quick heads up. The text
in your article seem to be running off the screen in Chrome.
I'm not sure if this iss a format issuye or something to do with browser compatibility but I figured I'd post to let you
know. The design and style loo great though! Hoope you
get the problem fixed soon. Thanks
Fabulous, what a website it is! This website provides
helpful information to us, keep it up.
fantastic put up, very informative. I'm wondering why the opposite specialists of this sector
don't understand this. You must proceed your writing.
I am confident, you have a huge readers' base already!
Post a Comment