PROMPT Task that reports top segment statistics over a given time period. PROMPT Two tasks are used - one for initial snapshot and another to produce report. CONN &&tascha_schema/&&tascha_password SET SERVEROUTPUT ON DECLARE L_task_id NUMBER; L_sched_id NUMBER; L_schema VARCHAR2 (100) := UPPER('&&schema_to_monitor'); BEGIN /* ** To snapshot extra schemas just call schedule_task ** for new schema, no need to create new tasks. */ tascha_pkg.create_task( I_procedure_name => 'segstats' , I_title => 'Segment Statistics Report' , I_category => 'DBA' , O_task_id => L_task_id); dbms_output.put_line('task1:'||L_task_id); /* Request initial snapshot task */ tascha_pkg.schedule_task(I_task_id => L_task_id , I_title => 'Schema Snapshot '||L_schema , I_hour => '10,14' , I_min => '00' , I_dow => 'MON-FRI' , O_sched_id => L_sched_id); dbms_output.put_line('sched1:'||L_sched_id); tascha_pkg.add_task_prm(L_sched_id, 'I_own', L_schema); tascha_pkg.add_task_prm(L_sched_id, 'I_obj', NULL); tascha_pkg.add_task_prm(L_sched_id, 'I_which', 1); /* Request second snapshot which also reports (15 mins after first) */ tascha_pkg.create_task( I_procedure_name => 'segstats' , I_title => 'Segment Statistics Report' , I_success_email => '&&email_output_to' , I_category => 'DBA' , O_task_id => L_task_id); dbms_output.put_line('task2:'||L_task_id); tascha_pkg.schedule_task(I_task_id => L_task_id , I_title => 'Schema Report '||L_schema , I_hour => '10,14' , I_min => '10' , I_dow => 'MON-FRI' , O_sched_id => L_sched_id); dbms_output.put_line('sched2:'||L_sched_id); tascha_pkg.add_task_prm(L_sched_id, 'I_own', L_schema); tascha_pkg.add_task_prm(L_sched_id, 'I_obj', NULL); tascha_pkg.add_task_prm(L_sched_id, 'I_which', 2); COMMIT; END; /