i trying figure out how can create/schedule dbms_audit_mgmt.create_purge_job execute @ specific time of day, rather @ interval, appears start @ time execute create_purge_job ?
the thing can think of change system time temorarily, run procedure, fix system time ??? (dumb)
begin dbms_audit_mgmt.create_purge_job( audit_trail_type => dbms_audit_mgmt.audit_trail_aud_std, audit_trail_purge_interval => 24 * 30 /* hours */, audit_trail_purge_name => 'daily_audit_purge_job', use_last_arch_timestamp => true ); end; is there way missing ?
it not appear have start_date parameter such dbms_scheduler.create_job can specify time.
the purge job functionality wrapper on dbms_scheduler package, if want schedule task executed @ time, should use dbms_scheduler functionality.
in case after executing code, dba_audit_mgmt_cleanup_jobs has following information:
sql> select job_name,job_status,audit_trail,job_frequency dba_audit_mgmt_cleanup_jobs ; job_name job_stat audit_trail job_frequency ------------------------- -------- ---------------------------- ------------------------------ daily_audit_purge_job enabled standard audit trail freq=hourly;interval=720 and dba_scheduler_jobs has following:
sql> select job_name, next_run_date, state, enabled dba_scheduler_jobs job_name '%audit%' ; job_name next_run_date state enabl ------------------------- ------------------------------------------------------------ --------------- ----- daily_audit_purge_job 15-aug-15 01.11.40.411757 america/argentina/rio_gallegos scheduled true schedule new "manual" job usual:
begin dbms_scheduler.create_job ( job_name => 'manual_audit_purge_job', job_type => 'plsql_block', job_action => 'begin dbms_audit_mgmt.clean_audit_trail(1, true, 1); end;', enabled => true, comments => 'manual audit purge job'); end; / and can verify execution querying dba_scheduler_job_log follows:
select log_date , job_name , status dba_scheduler_job_log order log_date asc; you this:
log_date job_name status --------------------------------------------------------------------------- ------------------------- ------------------------------ 16-jul-15 01.50.03.081815 -03:00 oracle_apex_mail_queue succeeded 16-jul-15 01.52.29.935133 -03:00 manual_audit_purge_job succeeded note: poc performed using 12.1.0.2.0 release.
Comments
Post a Comment