--Sometimes you need to submit a job script that someone else wrote, you can use the following storage to output all the job code in the command window mode;
SetServeroutput onSize1000000;Create or Replace procedureProc_generate_job_create_sql is beginDbms_output. ENABLE (Buffer_size= NULL);--indicates that the output buffer is unrestrictedSys.dbms_output.put_line ('Declare'); Sys.dbms_output.put_line ('v_job number;'); Sys.dbms_output.put_line ('begin'); forJinch(SelectWhat, Interval fromuser_jobs) Loop Sys.dbms_output.put_line ('sys.dbms_job.submit (Job = V_job,'); Sys.dbms_output.put_line ('What =" " ||J.what|| " ",'); Sys.dbms_output.put_line ('next_date =' ||J.interval|| ','); Sys.dbms_output.put_line ('interval =" " ||J.interval|| " ");'); EndLoop; Sys.dbms_output.put_line ('commit;'); Sys.dbms_output.put_line ('end;');End;
--use schedule_job to better manage your job, and you can customize the name of your job.
beginDbms_scheduler.create_schedule (Schedule_name= 'Schedule_ Custom Name', Repeat_interval= 'freq=daily; interval=1; byhour=0; byminute=10', Comments= 'Schedule Daily 0:10'); Dbms_scheduler.create_program (program_name= 'PROGRAM_ Custom Name', Program_type= 'Plsql_block', Program_action= 'BEGIN Business code (typically a stored procedure); END;', Number_of_arguments= 0, Enabled=TRUE, Comments= 'Description'); Dbms_scheduler.create_job (Job_name= 'job_ Custom Name', Program_name= 'PROGRAM_ Custom Name', Schedule_name= 'Schedule_ Custom Name', Job_class= 'Default_job_class', Enabled=True,auto_drop=true,comments= 'Description');--Start RunningDbms_scheduler.run_job (job_name= 'job_ Custom Name', use_current_session=false);End;
Creation of scripts and schedules jobs in existing rdbms_jobs in the exported system in Oracle