我想创建一个包含alter table的存储过程,并且每晚都会启动。 提前谢谢
答案 0 :(得分:1)
那么创建作业并通过DBMS_SCHEDULER
安排作业有什么问题?
SQL> BEGIN
2 DBMS_SCHEDULER.create_job (
3 job_name => 'my_job_definition',
4 job_type => 'PLSQL_BLOCK',
5 job_action => 'BEGIN my_job_procedure; END;',
6 start_date => SYSTIMESTAMP,
7 repeat_interval => 'freq=daily',
8 end_date => NULL,
9 enabled => TRUE,
10 comments => 'Daily job to alter table');
11 END;
12 /
PL/SQL procedure successfully completed.
SQL>
SQL> SELECT JOB_NAME, ENABLED FROM DBA_SCHEDULER_JOBS where job_name ='MY_JOB_DEFINITION'
2 /
JOB_NAME ENABL
---------------------------------------- -----
MY_JOB_DEFINITION TRUE