tables_xxl_job.oracle.sql 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. -- oracle 11g 测试通过
  2. /*
  3. -- 清理脚本
  4. drop table xxl_job_info;
  5. drop table xxl_job_log;
  6. drop table xxl_job_log_report;
  7. drop table xxl_job_logglue;
  8. drop table xxl_job_registry;
  9. drop table xxl_job_group;
  10. drop table xxl_job_user;
  11. drop table xxl_job_lock;
  12. drop sequence SEQ_XXL_JOB_COMMON_ID;
  13. drop sequence SEQ_XXL_JOB_LOG_ID;
  14. */
  15. create sequence SEQ_XXL_JOB_COMMON_ID
  16. minvalue 10000001
  17. maxvalue 2147483647
  18. increment by 1
  19. cache 20
  20. cycle;
  21. create sequence SEQ_XXL_JOB_LOG_ID
  22. minvalue 10000001
  23. maxvalue 99999999999999
  24. increment by 1
  25. cache 20
  26. cycle;
  27. create table xxl_job_info (
  28. id number(11) not null, -- AUTO_INCREMENT
  29. job_group number(11) not null,
  30. job_desc varchar2(255) not null,
  31. add_time date default null,
  32. update_time date default null,
  33. author varchar2(64) default null,
  34. alarm_email varchar2(255) default null,
  35. schedule_type varchar2(50) default 'NONE' not null,
  36. schedule_conf varchar2(128) default null,
  37. misfire_strategy varchar2(50) default 'DO_NOTHING' not null,
  38. executor_route_strategy varchar2(50) default null,
  39. executor_handler varchar2(255) default null,
  40. executor_param varchar2(512) default null,
  41. executor_block_strategy varchar2(50) default null,
  42. executor_timeout number(11) default '0' not null,
  43. executor_fail_retry_count number(11) default '0' not null,
  44. glue_type varchar2(50) not null,
  45. glue_source clob,
  46. glue_remark varchar2(128) default null,
  47. glue_updatetime date default null,
  48. child_jobid varchar2(255) default null,
  49. trigger_status number(4) default '0' not null,
  50. trigger_last_time number(13) default '0' not null,
  51. trigger_next_time number(13) default '0' not null,
  52. primary key (id)
  53. );
  54. comment on column xxl_job_info.job_group is '执行器主键ID';
  55. comment on column xxl_job_info.author is '作者';
  56. comment on column xxl_job_info.alarm_email is '报警邮件';
  57. comment on column xxl_job_info.schedule_type is '调度类型';
  58. comment on column xxl_job_info.schedule_conf is '调度配置,值含义取决于调度类型';
  59. comment on column xxl_job_info.misfire_strategy is '调度过期策略';
  60. comment on column xxl_job_info.executor_route_strategy is '执行器路由策略';
  61. comment on column xxl_job_info.executor_handler is '执行器任务handler';
  62. comment on column xxl_job_info.executor_param is '执行器任务参数';
  63. comment on column xxl_job_info.executor_block_strategy is '阻塞处理策略';
  64. comment on column xxl_job_info.executor_timeout is '任务执行超时时间,单位秒';
  65. comment on column xxl_job_info.executor_fail_retry_count is '失败重试次数';
  66. comment on column xxl_job_info.glue_type is 'GLUE类型';
  67. comment on column xxl_job_info.glue_source is 'GLUE源代码';
  68. comment on column xxl_job_info.glue_remark is 'GLUE备注';
  69. comment on column xxl_job_info.glue_updatetime is 'GLUE更新时间';
  70. comment on column xxl_job_info.child_jobid is '子任务ID,多个逗号分隔';
  71. comment on column xxl_job_info.trigger_status is '调度状态:0-停止,1-运行';
  72. comment on column xxl_job_info.trigger_last_time is '上次调度时间';
  73. comment on column xxl_job_info.trigger_next_time is '下次调度时间';
  74. create table xxl_job_log (
  75. id number(20) not null, -- AUTO_INCREMENT
  76. job_group number(11) not null ,
  77. job_id number(11) not null ,
  78. executor_address varchar2(255) default null ,
  79. executor_handler varchar2(255) default null ,
  80. executor_param varchar2(512) default null ,
  81. executor_sharding_param varchar2(20) default null ,
  82. executor_fail_retry_count number(11) default '0' not null,
  83. trigger_time date default null ,
  84. trigger_code number(11) not null,
  85. trigger_msg clob ,
  86. handle_time date default null ,
  87. handle_code number(11) not null,
  88. handle_msg clob ,
  89. alarm_status number(4) default '0' not null,
  90. primary key (id)
  91. );
  92. create index i_trigger_time on xxl_job_log (trigger_time);
  93. create index i_handle_code on xxl_job_log (handle_code);
  94. comment on column xxl_job_log.job_group is '执行器主键ID';
  95. comment on column xxl_job_log.job_id is '任务,主键ID';
  96. comment on column xxl_job_log.executor_address is '执行器地址,本次执行的地址';
  97. comment on column xxl_job_log.executor_handler is '执行器任务handler';
  98. comment on column xxl_job_log.executor_param is '执行器任务参数';
  99. comment on column xxl_job_log.executor_sharding_param is '执行器任务分片参数,格式如 1/2';
  100. comment on column xxl_job_log.executor_fail_retry_count is '失败重试次数';
  101. comment on column xxl_job_log.trigger_time is '调度-时间';
  102. comment on column xxl_job_log.trigger_code is '调度-结果';
  103. comment on column xxl_job_log.trigger_msg is '调度-日志';
  104. comment on column xxl_job_log.handle_time is '执行-时间';
  105. comment on column xxl_job_log.handle_code is '执行-状态';
  106. comment on column xxl_job_log.handle_msg is '执行-日志';
  107. comment on column xxl_job_log.alarm_status is '告警状态:0-默认、1-无需告警、2-告警成功、3-告警失败';
  108. create table xxl_job_log_report (
  109. id number(11) not null, -- AUTO_INCREMENT
  110. trigger_day date default null,
  111. running_count number(11) default '0' not null,
  112. suc_count number(11) default '0' not null,
  113. fail_count number(11) default '0' not null,
  114. update_time date default null,
  115. primary key (id)
  116. );
  117. create unique index i_trigger_day on xxl_job_log_report (trigger_day);
  118. comment on column xxl_job_log_report.trigger_day is '调度-时间' ;
  119. comment on column xxl_job_log_report.running_count is '运行中-日志数量' ;
  120. comment on column xxl_job_log_report.suc_count is '执行成功-日志数量' ;
  121. comment on column xxl_job_log_report.fail_count is '执行失败-日志数量' ;
  122. create table xxl_job_logglue (
  123. id number(11) not null, -- AUTO_INCREMENT
  124. job_id number(11) not null,
  125. glue_type varchar2(50) default null,
  126. glue_source clob,
  127. glue_remark varchar2(128) not null,
  128. add_time date default null,
  129. update_time date default null,
  130. primary key (id)
  131. );
  132. comment on column xxl_job_logglue.job_id is '任务,主键ID';
  133. comment on column xxl_job_logglue.glue_type is 'GLUE类型';
  134. comment on column xxl_job_logglue.glue_source is 'GLUE源代码';
  135. comment on column xxl_job_logglue.glue_remark is 'GLUE备注';
  136. create table xxl_job_registry (
  137. id number(11) not null, -- AUTO_INCREMENT
  138. registry_group varchar2(50) not null,
  139. registry_key varchar2(255) not null,
  140. registry_value varchar2(255) not null,
  141. update_time date default null,
  142. primary key (id)
  143. );
  144. create index i_g_k_v on xxl_job_registry(registry_group, registry_key, registry_value);
  145. create table xxl_job_group (
  146. id number(11) not null, -- AUTO_INCREMENT
  147. app_name varchar2(64) not null,
  148. title varchar2(255) not null,
  149. address_type number(4) default '0' not null,
  150. address_list clob,
  151. update_time date default null,
  152. primary key (id)
  153. );
  154. comment on column xxl_job_group.app_name is '执行器AppName';
  155. comment on column xxl_job_group.title is '执行器名称';
  156. comment on column xxl_job_group.address_type is '执行器地址类型:0=自动注册、1=手动录入';
  157. comment on column xxl_job_group.address_list is '执行器地址列表,多地址逗号分隔';
  158. create table xxl_job_user (
  159. id number(11) not null, -- AUTO_INCREMENT
  160. username varchar2(50) not null,
  161. password varchar2(50) not null,
  162. role number(4) not null,
  163. permission varchar2(255) default null,
  164. primary key (id)
  165. );
  166. create unique index i_username on xxl_job_user(username);
  167. comment on column xxl_job_user.username is '账号';
  168. comment on column xxl_job_user.password is '密码';
  169. comment on column xxl_job_user.role is '角色:0-普通用户、1-管理员';
  170. comment on column xxl_job_user.permission is '权限:执行器ID列表,多个逗号分割';
  171. create table xxl_job_lock (
  172. lock_name varchar2(50) not null,
  173. primary key (lock_name)
  174. );
  175. comment on column xxl_job_lock.lock_name is '锁名称';
  176. -- 初始化数据
  177. insert into xxl_job_group(id, app_name, title, address_type, address_list, update_time) values (1, 'xxl-job-executor-sample', '示例执行器', 0, NULL, to_date('2018-11-03 22:21:31', 'yyyy-mm-dd hh24:mi:ss') );
  178. insert into xxl_job_info(id, job_group, job_desc, add_time, update_time, author, alarm_email, schedule_type, schedule_conf, misfire_strategy, executor_route_strategy, executor_handler, executor_param, executor_block_strategy, executor_timeout, executor_fail_retry_count, glue_type, glue_source, glue_remark, glue_updatetime, child_jobid) values (1, 1, '测试任务1', to_date('2018-11-03 22:21:31', 'yyyy-mm-dd hh24:mi:ss'), to_date('2018-11-03 22:21:31', 'yyyy-mm-dd hh24:mi:ss'), 'XXL', '', 'CRON', '0 0 0 * * ? *', 'DO_NOTHING', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', to_date('2018-11-03 22:21:31', 'yyyy-mm-dd hh24:mi:ss'), '');
  179. insert into xxl_job_user(id, username, password, role, permission) values (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);
  180. insert into xxl_job_lock ( lock_name) values ( 'schedule_lock');
  181. commit;