Jag skulle föreslå att du sparar din statistik i en tabell (säg my_log_table
), i så fall skulle schemat se ut ungefär så här:
begin
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'keep_stats',
job_type => 'PLSQL_BLOCK',
job_action => 'begin insert into my_log_table (mUser,mCnt) (select osuser, count(osuser) as active_conn_count from v$session group by osuser order by active_conn_count desc);commit;end;',
start_date => timestamp '2016-11-07 19:00:00',
repeat_interval => 'FREQ=MINUTELY;INTERVAL=30;',
enabled => TRUE);
end;