宋子宪博客

工作常用SQL

/**查询表的总记录*/

select COUNT(1) from XXL_JOB_REGISTRY;

/**查询暂停的启动器*/

SELECT * FROM XXL_JOB_WSDL WHERE VALID_TYPE !=1

/**查询启动的启动器*/

SELECT * FROM XXL_JOB_WSDL WHERE VALID_TYPE !=0

/**全部启动*/

UPDATE XXL_JOB_INFO SET TRIGGER_STATUS = 1

/**全部停止*/

UPDATE XXL_JOB_INFO SET TRIGGER_STATUS = 0

/**设置超时时间*/

UPDATE XXL_JOB_INFO SET EXECUTOR_TIMEOUT = 5

/**修改调度周期*/

UPDATE XXL_JOB_INFO SET JOB_CRON = '0/30 * * * * ?';

/**清空表*/

TRUNCATE TABLE 表名;

/**查询所有任务的状态码*/

SELECT TRIGGER_CODE ,COUNT(1),HANDLE_CODE FROM XXL_JOB_LOG GROUP BY TRIGGER_CODE,HANDLE_CODE

/**任务总记录数*/

SELECT COUNT(1) FROM XXL_JOB_LOG 

/**成功的总记录数*/

SELECT COUNT(1) FROM XXL_JOB_LOG WHERE TRIGGER_CODE = '200' AND HANDLE_CODE = '200';

/**失败记录数*/

SELECT COUNT(1) FROM XXL_JOB_LOG WHERE TRIGGER_CODE = '500' OR (TRIGGER_CODE = '200' AND HANDLE_CODE = '500')

/**正在进行中*/

SELECT COUNT(1) FROM XXL_JOB_LOG WHERE TRIGGER_CODE = '200' AND HANDLE_CODE = '0'

/**调度任务启动与关闭,等于1的时候是启动,0为关闭*/

UPDATE XXL_JOB_INFO SET TRIGGER_STATUS = '1'

/**修改路由策略*/

UPDATE XXL_JOB_INFO SET EXECUTOR_ROUTE_STRATEGY = 'CONSISTENT_HASH'

/**修改分组*/

UPDATE XXL_JOB_INFO SET JOB_GROUP = '11'

/**根据ID查询任务*/

SELECT * FROM XXL_JOB_INFO where ID IN(194,195)

/**修改EXECUTOR_ROUTE_STRATEGY*/

UPDATE XXL_JOB_INFO SET EXECUTOR_ROUTE_STRATEGY = 'ROUND'

/***批量启动/

UPDATE GZMPCJOB.XXL_JOB_INFO t SET t.TRIGGER_STATUS = 1 WHERE t.ID IN(#id);

/**按条件修改*/

UPDATE GZMPCJOB.XXL_JOB_INFO t SET t.JOB_GROUP = 5 WHERE t.ID = 2

/**批量修改*/

UPDATE GZMPCJOB.XXL_JOB_INFO t SET t.TRIGGER_STATUS = 1 WHERE t.ID IN(15,16,17,18);

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »