Is there a way to recover deleted jil?
I understand that you can delete jobs, and they are flagged for deletion, but not actually deleted from the database until DBMaint runs.
Release : 12.1
When you issue the delete_job via jil the job is not immediately deleted from the db.
The product toggles a flag, marking it available for deletion.
Your DBMaint settings determine when it is ultimately removed from the db.
All events and runs associated with the job must be gone first before the definition is removed.
If the job definition is still in the database you can manually recover by adjusting the is_active value for the job.
See the example below:
Example:
=======================
$
$ jil
jil>>1> insert_job: scott
jil>>2> command: sleep 999
jil>>3> machine: localhost
jil>>4> exit
______________________________________________________________________________
CAUAJM_I_50323 Inserting/Updating job: scott
CAUAJM_I_50205 Database Change WAS Successful!
______________________________________________________________________________
CAUAJM_I_52301 Exit Code = 0
______________________________________________________________________________
$ autorep -q -J scott
/* ----------------- scott ----------------- */
insert_job: scott job_type: CMD
command: sleep 999
machine: localhost
owner: autosys@localhost
permission:
date_conditions: 0
alarm_if_fail: 1
alarm_if_terminated: 1
$ jil
jil>>1> delete_job: scott
jil>>2> exit
______________________________________________________________________________
CAUAJM_I_50200 Attempting to Delete Job: scott
CAUAJM_I_50202 Delete was successful!
______________________________________________________________________________
CAUAJM_I_52301 Exit Code = 0
______________________________________________________________________________
$ autorep -q -J scott
CAUAJM_E_50027 Invalid Job Name: scott
$
sqlplus aedbadmin@....
SQL> select is_active, is_currver, joid, job_name from ujo_job where is_active=0 order by job_name;
IS_ACTIVE IS_CURRVER JOID
---------- ---------- ----------
JOB_NAME
----------------------------------------------------------------
0 1 992
scott
SQL> update ujo_job set is_active=1 where is_active=0 and joid=992 and is_currver=1;
1 row updated.
SQL> commit;
Commit complete.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
$ autorep -q -J scott
/* ----------------- scott ----------------- */
insert_job: scott job_type: CMD
command: sleep 999
machine: localhost
owner: autosys@localhost
permission:
date_conditions: 0
alarm_if_fail: 1
alarm_if_terminated: 1
NOTE - If the job has/had multiple versions (jil updates) there may be more than 1 entry in the ujo_job table for the job.
Identify the most recent one (the one with the highest job_ver value) and adjust that entires is_active value to 1.
There can be only 1 entry per job that has both is_active=1 and is_currver=1.
If you adjust more than 1 row that would cause the product to be unable to determine what the real current version of the job is and it would not be functional.