Transfer old use logs to monthly use logs

It is possible to transfer old use logs to the monthly logs once, if needed, using a procedure call. It is a job because it may take a long time to complete. The job ensures that it is not already in the job queue and in this way avoids more than one transfer.

Sjp_use_log. job_save_old_use_log(starttime date default sysdate, months in number default 0);
  • Starttime: The start time of the job. By default, the job starts immediately. If you, for example, want the job to start at 18:00, set the starttime to trunc(sysdate) + 18;
  • Months: The number of whole months back in time, starting from current day, which is transferred to monthly logs, thereby up to a month more can be transferred than specified. The default is 0 (zero), which means that the number of logs that are transferred equals the number of months you have set up to keep in the use log. It is most common to call the procedure using this default.

The job logs the transactions in the save_old_use_log table. The table has the following columns:

Log_name Under normal conditions, it always contains SJ$OLD_USE_LOG.
Day The day that is transferred in the form at yyyymmdd (for example, 20150608). It may also have the format yyyymm, and then the result includes all days in a months.
Start_time The time when the transfer was started for that day/month.
End_time The time when the transfer ended for that day/month.
Entries The number of entries for that day/month.
Error_number The value 0, if the transfer went well for that day/month, otherwise it is an error number.
Error_text The explanatory error text. It is null if the transfer went well.

When a month or day is logged with no errors in the save_old_use_log table , then this month or day will not be transferred again if the transfer job is submitted more than once.