Search code examples
oracle-databaseoracle11gdatabase-administration

How to copy a JOB, PROGRAM, SCHEDULE definition to run it in another Oracle 11g DB?


I need to copy some Jobs, Schedules and Programs from an Oracle 11g DB to another one, but when I try to look for the SQL of the Job/Schedule/Program on SQL Developer 4.1.3, the SQL tab shows nothing on Edit mode.

When I open a table and I click on the SQL tab, the SQL for create the table is showed up. I was expecting a similar behavior for a Job/Schedule/Program.

How can I copy a JOB/PROGRAM/SCHEDULE definition to run it in another Oracle 11g DB?


Solution

  • The easiest way for Jobs is to use DBMS_METADATA:

    select dbms_metadata.get_ddl('PROCOBJ', job_name) 
    from user_scheduler_jobs;
    

    I'm not 100% sure about schedules / programs, though.