PROMPT Requires 'GRANT EXECUTE ON perfstat.statspack TO <tascha_schema>;'

CONN &&tascha_schema/&&tascha_password

SET SERVEROUTPUT ON

DECLARE
	L_task_id	NUMBER;
	L_sched_id	NUMBER;
BEGIN
	tascha_pkg.create_task(	I_procedure_name => 'perfstat.statspack.snap'
			,	I_title		=> 'Statspack Snapshot'
			,	I_category	=> 'DBA'
			,	O_task_id	=> L_task_id);

	dbms_output.put_line('task:'||L_task_id);

	/* Request snapshot with OLTP in mind */

	tascha_pkg.schedule_task(I_task_id 	=> L_task_id
			,	I_hour 		=> '9,11,13,15,17'
			,	I_min 		=> '00,15'
			,	I_dow 		=> 'MON-FRI'
			,	O_sched_id 	=> L_sched_id);

	dbms_output.put_line('sched:'||L_sched_id);

	/* Set snap level as appropriate - or omit for default */

	tascha_pkg.add_task_prm(L_sched_id,	'i_snap_level',	'5');

	COMMIT;
END;
/
