Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

Criando trabalho DBMS_SCHEDULER para oracle


Estou em 12.1.0.1.0. Você pode criar o trabalho em um bloco anônimo simples:
SQL> BEGIN
  2    DBMS_SCHEDULER.DROP_JOB (JOB_NAME => 'test_full_job_definition');
  3  END;
  4  /

PL/SQL procedure successfully completed.

SQL>
SQL> BEGIN
  2    DBMS_SCHEDULER.create_job (
  3      job_name        => 'test_full_job_definition',
  4      job_type        => 'PLSQL_BLOCK',
  5      job_action      => 'BEGIN my_job_procedure; END;',
  6      start_date      => SYSTIMESTAMP,
  7      repeat_interval => 'freq=hourly; byminute=0; bysecond=0;',
  8      end_date        => NULL,
  9      enabled         => TRUE,
 10      comments        => 'Job defined entirely by the CREATE JOB procedure.');
 11  END;
 12  /

PL/SQL procedure successfully completed.

SQL>
SQL> SELECT JOB_NAME, ENABLED FROM DBA_SCHEDULER_JOBS where job_name ='TEST_FULL_JOB_DEFINITION'
  2  /

JOB_NAME                                 ENABL
---------------------------------------- -----
TEST_FULL_JOB_DEFINITION                 TRUE

SQL>

Mais exemplos aqui