I recently received requests for suggestions on how to edit EM12c jobs in bulk. The two examples that were presented to me were:
- Change the start time of 70+ jobs
- Change the oracle home path in 80+ RMAN script jobs
So how do we do this?
Option 1: Log into EM12c, navigate to each and every job, click edit and make the desired changes. This of course gets boring after the 4th job, not to mention the potential for developing carpel tunnel syndrome.
Option 2: The other choice is to scan the EM repository tables and try to update the correct columns. Unfortunately, the EM schema is not that simple to follow and your changes to the repository may not take effect as they haven’t updated all relevant references or have not been called from the correct set of APIs. BTW, this also violates our recommendation to never make changes to the EM schema without specific instructions from Oracle support or development, and has the potential of messing up your repository.
Option 3: This makes use of the job system emcli verbs, and is the only viable solution to the problem. The process would be as follows:
- Use emcli verb “describe_job” to dump all required jobs into separate properties files (I am assuming you have list of job names that needs to be edited)
- Mass-edit the property files to change the start date or any other parameters you like
- Create new jobs using these property files with slightly different names using the emcli verb ”create_job”
- Once satisfied with newly created jobs, remove older jobs using “delete_job” emcli verb
Documentation for these verbs can be found here.
Now you could argue that option 3 is not perfect either, and i would give you credit for making that argument. Hence an ER has been filed to provide a formal ‘edit_jobs’ verb which will allow you to edit jobs via emcli either in bulk or in a loop. Until then, hopefully this serves as a good work around.