quartz.sql 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. --
  2. -- A hint submitted by a user: Oracle DB MUST be created as "shared" and the
  3. -- job_queue_processes parameter must be greater than 2
  4. -- However, these settings are pretty much standard after any
  5. -- Oracle install, so most users need not worry about this.
  6. --
  7. -- Many other users (including the primary author of Quartz) have had success
  8. -- running in dedicated mode, so only consider the above as a hint ;-)
  9. --
  10. drop table if exists qrtz_calendars;
  11. drop table if exists qrtz_fired_triggers;
  12. drop table if exists qrtz_blob_triggers;
  13. drop table if exists qrtz_cron_triggers;
  14. drop table if exists qrtz_simple_triggers;
  15. drop table if exists qrtz_simprop_triggers;
  16. drop table if exists qrtz_triggers;
  17. drop table if exists qrtz_job_details;
  18. drop table if exists qrtz_paused_trigger_grps;
  19. drop table if exists qrtz_locks;
  20. drop table if exists qrtz_scheduler_state;
  21. CREATE TABLE qrtz_job_details
  22. (
  23. SCHED_NAME VARCHAR2(120) NOT NULL,
  24. JOB_NAME VARCHAR2(200) NOT NULL,
  25. JOB_GROUP VARCHAR2(200) NOT NULL,
  26. DESCRIPTION VARCHAR2(250) NULL,
  27. JOB_CLASS_NAME VARCHAR2(250) NOT NULL,
  28. IS_DURABLE VARCHAR2(1) NOT NULL,
  29. IS_NONCONCURRENT VARCHAR2(1) NOT NULL,
  30. IS_UPDATE_DATA VARCHAR2(1) NOT NULL,
  31. REQUESTS_RECOVERY VARCHAR2(1) NOT NULL,
  32. JOB_DATA BLOB NULL,
  33. CONSTRAINT QRTZ_JOB_DETAILS_PK PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
  34. );
  35. CREATE TABLE qrtz_triggers
  36. (
  37. SCHED_NAME VARCHAR2(120) NOT NULL,
  38. TRIGGER_NAME VARCHAR2(200) NOT NULL,
  39. TRIGGER_GROUP VARCHAR2(200) NOT NULL,
  40. JOB_NAME VARCHAR2(200) NOT NULL,
  41. JOB_GROUP VARCHAR2(200) NOT NULL,
  42. DESCRIPTION VARCHAR2(250) NULL,
  43. NEXT_FIRE_TIME NUMBER(19) NULL,
  44. PREV_FIRE_TIME NUMBER(19) NULL,
  45. PRIORITY NUMBER(13) NULL,
  46. TRIGGER_STATE VARCHAR2(16) NOT NULL,
  47. TRIGGER_TYPE VARCHAR2(8) NOT NULL,
  48. START_TIME NUMBER(19) NOT NULL,
  49. END_TIME NUMBER(19) NULL,
  50. CALENDAR_NAME VARCHAR2(200) NULL,
  51. MISFIRE_INSTR NUMBER(2) NULL,
  52. JOB_DATA BLOB NULL,
  53. CONSTRAINT QRTZ_TRIGGERS_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
  54. CONSTRAINT QRTZ_TRIGGER_TO_JOBS_FK FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
  55. REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
  56. );
  57. CREATE TABLE qrtz_simple_triggers
  58. (
  59. SCHED_NAME VARCHAR2(120) NOT NULL,
  60. TRIGGER_NAME VARCHAR2(200) NOT NULL,
  61. TRIGGER_GROUP VARCHAR2(200) NOT NULL,
  62. REPEAT_COUNT NUMBER(7) NOT NULL,
  63. REPEAT_INTERVAL NUMBER(12) NOT NULL,
  64. TIMES_TRIGGERED NUMBER(10) NOT NULL,
  65. CONSTRAINT QRTZ_SIMPLE_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
  66. CONSTRAINT QRTZ_SIMPLE_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
  67. REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
  68. );
  69. CREATE TABLE qrtz_cron_triggers
  70. (
  71. SCHED_NAME VARCHAR2(120) NOT NULL,
  72. TRIGGER_NAME VARCHAR2(200) NOT NULL,
  73. TRIGGER_GROUP VARCHAR2(200) NOT NULL,
  74. CRON_EXPRESSION VARCHAR2(120) NOT NULL,
  75. TIME_ZONE_ID VARCHAR2(80),
  76. CONSTRAINT QRTZ_CRON_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
  77. CONSTRAINT QRTZ_CRON_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
  78. REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
  79. );
  80. CREATE TABLE qrtz_simprop_triggers
  81. (
  82. SCHED_NAME VARCHAR2(120) NOT NULL,
  83. TRIGGER_NAME VARCHAR2(200) NOT NULL,
  84. TRIGGER_GROUP VARCHAR2(200) NOT NULL,
  85. STR_PROP_1 VARCHAR2(512) NULL,
  86. STR_PROP_2 VARCHAR2(512) NULL,
  87. STR_PROP_3 VARCHAR2(512) NULL,
  88. INT_PROP_1 NUMBER(10) NULL,
  89. INT_PROP_2 NUMBER(10) NULL,
  90. LONG_PROP_1 NUMBER(19) NULL,
  91. LONG_PROP_2 NUMBER(19) NULL,
  92. DEC_PROP_1 NUMERIC(13,4) NULL,
  93. DEC_PROP_2 NUMERIC(13,4) NULL,
  94. BOOL_PROP_1 VARCHAR2(1) NULL,
  95. BOOL_PROP_2 VARCHAR2(1) NULL,
  96. TIME_ZONE_ID VARCHAR2(80) NULL,
  97. CONSTRAINT QRTZ_SIMPROP_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
  98. CONSTRAINT QRTZ_SIMPROP_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
  99. REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
  100. );
  101. CREATE TABLE qrtz_blob_triggers
  102. (
  103. SCHED_NAME VARCHAR2(120) NOT NULL,
  104. TRIGGER_NAME VARCHAR2(200) NOT NULL,
  105. TRIGGER_GROUP VARCHAR2(200) NOT NULL,
  106. BLOB_DATA BLOB NULL,
  107. CONSTRAINT QRTZ_BLOB_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
  108. CONSTRAINT QRTZ_BLOB_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
  109. REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
  110. );
  111. CREATE TABLE qrtz_calendars
  112. (
  113. SCHED_NAME VARCHAR2(120) NOT NULL,
  114. CALENDAR_NAME VARCHAR2(200) NOT NULL,
  115. CALENDAR BLOB NOT NULL,
  116. CONSTRAINT QRTZ_CALENDARS_PK PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
  117. );
  118. CREATE TABLE qrtz_paused_trigger_grps
  119. (
  120. SCHED_NAME VARCHAR2(120) NOT NULL,
  121. TRIGGER_GROUP VARCHAR2(200) NOT NULL,
  122. CONSTRAINT QRTZ_PAUSED_TRIG_GRPS_PK PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
  123. );
  124. CREATE TABLE qrtz_fired_triggers
  125. (
  126. SCHED_NAME VARCHAR2(120) NOT NULL,
  127. ENTRY_ID VARCHAR2(140) NOT NULL,
  128. TRIGGER_NAME VARCHAR2(200) NOT NULL,
  129. TRIGGER_GROUP VARCHAR2(200) NOT NULL,
  130. INSTANCE_NAME VARCHAR2(200) NOT NULL,
  131. FIRED_TIME NUMBER(19) NOT NULL,
  132. SCHED_TIME NUMBER(19) NOT NULL,
  133. PRIORITY NUMBER(13) NOT NULL,
  134. STATE VARCHAR2(16) NOT NULL,
  135. JOB_NAME VARCHAR2(200) NULL,
  136. JOB_GROUP VARCHAR2(200) NULL,
  137. IS_NONCONCURRENT VARCHAR2(1) NULL,
  138. REQUESTS_RECOVERY VARCHAR2(1) NULL,
  139. CONSTRAINT QRTZ_FIRED_TRIGGER_PK PRIMARY KEY (SCHED_NAME,ENTRY_ID)
  140. );
  141. CREATE TABLE qrtz_scheduler_state
  142. (
  143. SCHED_NAME VARCHAR2(120) NOT NULL,
  144. INSTANCE_NAME VARCHAR2(200) NOT NULL,
  145. LAST_CHECKIN_TIME NUMBER(19) NOT NULL,
  146. CHECKIN_INTERVAL NUMBER(13) NOT NULL,
  147. CONSTRAINT QRTZ_SCHEDULER_STATE_PK PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
  148. );
  149. CREATE TABLE qrtz_locks
  150. (
  151. SCHED_NAME VARCHAR2(120) NOT NULL,
  152. LOCK_NAME VARCHAR2(40) NOT NULL,
  153. CONSTRAINT QRTZ_LOCKS_PK PRIMARY KEY (SCHED_NAME,LOCK_NAME)
  154. );
  155. create index idx_qrtz_j_req_recovery on qrtz_job_details(SCHED_NAME,REQUESTS_RECOVERY);
  156. create index idx_qrtz_j_grp on qrtz_job_details(SCHED_NAME,JOB_GROUP);
  157. create index idx_qrtz_t_j on qrtz_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
  158. create index idx_qrtz_t_jg on qrtz_triggers(SCHED_NAME,JOB_GROUP);
  159. create index idx_qrtz_t_c on qrtz_triggers(SCHED_NAME,CALENDAR_NAME);
  160. create index idx_qrtz_t_g on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP);
  161. create index idx_qrtz_t_state on qrtz_triggers(SCHED_NAME,TRIGGER_STATE);
  162. create index idx_qrtz_t_n_state on qrtz_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);
  163. create index idx_qrtz_t_n_g_state on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);
  164. create index idx_qrtz_t_next_fire_time on qrtz_triggers(SCHED_NAME,NEXT_FIRE_TIME);
  165. create index idx_qrtz_t_nft_st on qrtz_triggers(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);
  166. create index idx_qrtz_t_nft_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);
  167. create index idx_qrtz_t_nft_st_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);
  168. create index idx_qrtz_t_nft_st_misfire_grp on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);
  169. create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME);
  170. create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);
  171. create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
  172. create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
  173. create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
  174. create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);