Doporučuji uchovávat statistiky v tabulce (řekněme my_log_table
), v takovém případě by plán vypadal asi takto:
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;