Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

GET__DDL of scheduler job to include owner

oraLaroJul 14 2023

version 19:16

We have a number of jobs we want to change the job creator but keep the owner. Got bit pretty badly when a creator had left, their username got dropped and jobs stopped working so having a once off cleanup. Heres an example.

JOB_CREATOR= DBA_USER1

JOB_OWNER= APP_USER1

JOB= JOB1

So we want to

1. get the DDL of this job,

2. Drop existing job

3. Then Run create as a generic DBA user = DBA_JOB_OWNER (which will never be dropped)but keep JOB_OWNER = APP_USER1

We get the DDL of a job by

select dbms_metadata.get_ddl('PROCOBJ','JOB1','APP_USER1') from dual;

But this does NOT include the job owner in the DDL, just the job_name.

BEGIN
dbms_scheduler.create_job('"JOB1"',
..

END;

Is there a way to add the owner during get_ddl? I guess Im playing with replace strings otherwise

Comments
Post Details
Added on Jul 14 2023
1 comment
1,202 views