quartz.sql 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. -- ----------------------------
  2. -- 1、存储每一个已配置的 jobDetail 的详细信息
  3. -- ----------------------------
  4. create table qrtz_job_details (
  5. sched_name varchar2(120) not null,
  6. job_name varchar2(200) not null,
  7. job_group varchar2(200) not null,
  8. description varchar2(250) null,
  9. job_class_name varchar2(250) not null,
  10. is_durable varchar2(1) not null,
  11. is_nonconcurrent varchar2(1) not null,
  12. is_update_data varchar2(1) not null,
  13. requests_recovery varchar2(1) not null,
  14. job_data blob null,
  15. constraint qrtz_job_details_pk primary key (sched_name,job_name,job_group)
  16. );
  17. -- ----------------------------
  18. -- 2、 存储已配置的 Trigger 的信息
  19. -- ----------------------------
  20. create table qrtz_triggers (
  21. sched_name varchar2(120) not null,
  22. trigger_name varchar2(200) not null,
  23. trigger_group varchar2(200) not null,
  24. job_name varchar2(200) not null,
  25. job_group varchar2(200) not null,
  26. description varchar2(250) null,
  27. next_fire_time number(13) null,
  28. prev_fire_time number(13) null,
  29. priority number(13) null,
  30. trigger_state varchar2(16) not null,
  31. trigger_type varchar2(8) not null,
  32. start_time number(13) not null,
  33. end_time number(13) null,
  34. calendar_name varchar2(200) null,
  35. misfire_instr number(2) null,
  36. job_data blob null,
  37. constraint qrtz_triggers_pk primary key (sched_name,trigger_name,trigger_group),
  38. constraint qrtz_trigger_to_jobs_fk foreign key (sched_name,job_name,job_group)
  39. references qrtz_job_details(sched_name,job_name,job_group)
  40. );
  41. -- ----------------------------
  42. -- 3、 存储简单的 Trigger,包括重复次数,间隔,以及已触发的次数
  43. -- ----------------------------
  44. create table qrtz_simple_triggers (
  45. sched_name varchar2(120) not null,
  46. trigger_name varchar2(200) not null,
  47. trigger_group varchar2(200) not null,
  48. repeat_count number(7) not null,
  49. repeat_interval number(12) not null,
  50. times_triggered number(10) not null,
  51. constraint qrtz_simple_trig_pk primary key (sched_name,trigger_name,trigger_group),
  52. constraint qrtz_simple_trig_to_trig_fk foreign key (sched_name,trigger_name,trigger_group)
  53. references qrtz_triggers(sched_name,trigger_name,trigger_group)
  54. );
  55. -- ----------------------------
  56. -- 4、 存储 Cron Trigger,包括 Cron 表达式和时区信息
  57. -- ----------------------------
  58. create table qrtz_cron_triggers (
  59. sched_name varchar2(120) not null,
  60. trigger_name varchar2(200) not null,
  61. trigger_group varchar2(200) not null,
  62. cron_expression varchar2(120) not null,
  63. time_zone_id varchar2(80),
  64. constraint qrtz_cron_trig_pk primary key (sched_name,trigger_name,trigger_group),
  65. constraint qrtz_cron_trig_to_trig_fk foreign key (sched_name,trigger_name,trigger_group)
  66. references qrtz_triggers(sched_name,trigger_name,trigger_group)
  67. );
  68. -- ----------------------------
  69. -- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并不知道如何存储实例的时候)
  70. -- ----------------------------
  71. create table qrtz_blob_triggers (
  72. sched_name varchar2(120) not null,
  73. trigger_name varchar2(200) not null,
  74. trigger_group varchar2(200) not null,
  75. blob_data blob null,
  76. constraint qrtz_blob_trig_pk primary key (sched_name,trigger_name,trigger_group),
  77. constraint qrtz_blob_trig_to_trig_fk foreign key (sched_name,trigger_name,trigger_group)
  78. references qrtz_triggers(sched_name,trigger_name,trigger_group)
  79. );
  80. -- ----------------------------
  81. -- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围
  82. -- ----------------------------
  83. create table qrtz_calendars (
  84. sched_name varchar2(120) not null,
  85. calendar_name varchar2(200) not null,
  86. calendar blob not null,
  87. constraint qrtz_calendars_pk primary key (sched_name,calendar_name)
  88. );
  89. -- ----------------------------
  90. -- 7、 存储已暂停的 Trigger 组的信息
  91. -- ----------------------------
  92. create table qrtz_paused_trigger_grps (
  93. sched_name varchar2(120) not null,
  94. trigger_group varchar2(200) not null,
  95. constraint qrtz_paused_trig_grps_pk primary key (sched_name,trigger_group)
  96. );
  97. -- ----------------------------
  98. -- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息
  99. -- ----------------------------
  100. create table qrtz_fired_triggers (
  101. sched_name varchar2(120) not null,
  102. entry_id varchar2(95) not null,
  103. trigger_name varchar2(200) not null,
  104. trigger_group varchar2(200) not null,
  105. instance_name varchar2(200) not null,
  106. fired_time number(13) not null,
  107. sched_time number(13) not null,
  108. priority number(13) not null,
  109. state varchar2(16) not null,
  110. job_name varchar2(200) null,
  111. job_group varchar2(200) null,
  112. is_nonconcurrent varchar2(1) null,
  113. requests_recovery varchar2(1) null,
  114. constraint qrtz_fired_trigger_pk primary key (sched_name,entry_id)
  115. );
  116. -- ----------------------------
  117. -- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例
  118. -- ----------------------------
  119. create table qrtz_scheduler_state (
  120. sched_name varchar2(120) not null,
  121. instance_name varchar2(200) not null,
  122. last_checkin_time number(13) not null,
  123. checkin_interval number(13) not null,
  124. constraint qrtz_scheduler_state_pk primary key (sched_name,instance_name)
  125. );
  126. -- ----------------------------
  127. -- 10、 存储程序的悲观锁的信息(假如使用了悲观锁)
  128. -- ----------------------------
  129. create table qrtz_locks (
  130. sched_name varchar2(120) not null,
  131. lock_name varchar2(40) not null,
  132. constraint qrtz_locks_pk primary key (sched_name,lock_name)
  133. );
  134. create table qrtz_simprop_triggers (
  135. sched_name varchar2(120) not null,
  136. trigger_name varchar2(200) not null,
  137. trigger_group varchar2(200) not null,
  138. str_prop_1 varchar2(512) null,
  139. str_prop_2 varchar2(512) null,
  140. str_prop_3 varchar2(512) null,
  141. int_prop_1 number(10) null,
  142. int_prop_2 number(10) null,
  143. long_prop_1 number(13) null,
  144. long_prop_2 number(13) null,
  145. dec_prop_1 numeric(13,4) null,
  146. dec_prop_2 numeric(13,4) null,
  147. bool_prop_1 varchar2(1) null,
  148. bool_prop_2 varchar2(1) null,
  149. constraint qrtz_simprop_trig_pk primary key (sched_name,trigger_name,trigger_group),
  150. constraint qrtz_simprop_trig_to_trig_fk foreign key (sched_name,trigger_name,trigger_group)
  151. references qrtz_triggers(sched_name,trigger_name,trigger_group)
  152. );
  153. create index idx_qrtz_j_req_recovery on qrtz_job_details(sched_name,requests_recovery);
  154. create index idx_qrtz_j_grp on qrtz_job_details(sched_name,job_group);
  155. create index idx_qrtz_t_j on qrtz_triggers(sched_name,job_name,job_group);
  156. create index idx_qrtz_t_jg on qrtz_triggers(sched_name,job_group);
  157. create index idx_qrtz_t_c on qrtz_triggers(sched_name,calendar_name);
  158. create index idx_qrtz_t_g on qrtz_triggers(sched_name,trigger_group);
  159. create index idx_qrtz_t_state on qrtz_triggers(sched_name,trigger_state);
  160. create index idx_qrtz_t_n_state on qrtz_triggers(sched_name,trigger_name,trigger_group,trigger_state);
  161. create index idx_qrtz_t_n_g_state on qrtz_triggers(sched_name,trigger_group,trigger_state);
  162. create index idx_qrtz_t_next_fire_time on qrtz_triggers(sched_name,next_fire_time);
  163. create index idx_qrtz_t_nft_st on qrtz_triggers(sched_name,trigger_state,next_fire_time);
  164. create index idx_qrtz_t_nft_misfire on qrtz_triggers(sched_name,misfire_instr,next_fire_time);
  165. create index idx_qrtz_t_nft_st_misfire on qrtz_triggers(sched_name,misfire_instr,next_fire_time,trigger_state);
  166. create index idx_qrtz_t_nft_st_misfire_grp on qrtz_triggers(sched_name,misfire_instr,next_fire_time,trigger_group,trigger_state);
  167. create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(sched_name,instance_name);
  168. create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(sched_name,instance_name,requests_recovery);
  169. create index idx_qrtz_ft_j_g on qrtz_fired_triggers(sched_name,job_name,job_group);
  170. create index idx_qrtz_ft_jg on qrtz_fired_triggers(sched_name,job_group);
  171. create index idx_qrtz_ft_t_g on qrtz_fired_triggers(sched_name,trigger_name,trigger_group);
  172. create index idx_qrtz_ft_tg on qrtz_fired_triggers(sched_name,trigger_group);
  173. commit;