[泛微OA]数据库还原后,清理数据库

— remove doc task
update DocChangeSetting set autoSend=0,autoReceive =0;
–remove all webservices
truncate table wsregiste;
–remove all tasks or update SCHEDULESETTING set cronexpr =’0 0 0 1 1 ?’;
delete from SCHEDULESETTING;
–change pwd
update hrmresource set password=’C4CA4238A0B923820DCC509A6F75849B’; –1
update HrmResourceManager set password=’C4CA4238A0B923820DCC509A6F75849B’ where loginid=’sysadmin’;

–1
–change page temp
update SystemLoginTemplate set isCurrent =0;
update SystemLoginTemplate set isCurrent =1 where loginTemplateId=2;
–del test workflow
update workflow_requestbase set deleted =0 where requestid in(
select requestid from workflow_requestbase t1,workflow_base t2
where t1.workflowid=t2.id and (t1.deleted=1 and (t2.isvalid=’2′ or t2.isvalid=’0′)));
–remove ofs
truncate table ofs_todo_data;
truncate table ofs_log;
–set test work flow,0:invalid,1:valide,2:test
update workflow_base set isvalid = ‘0’;
–打开某个流程
update workflow_base set isvalid = ‘1’ where workflowname like ‘%EEE%’;
–delete workflow auto create
truncate table outerdatawfset;
–清除流程数据
–remove all pending workflow
truncate table workflow_currentoperator;
–remove all workflow instances
truncate table workflow_requestbase;

–正常维护SQL
–删除无效的流程人员配置

–删除已经失效的代理
update Workflow_Agent set enddate =’2019-06-01′ where enddate >=’2019-06-01′; –临时使用
delete from Workflow_Agent where beagenterid not in(select id from hrmresource where status =1);
delete from Workflow_Agent where enddate < convert(char(10),getdate(),120);
–delete from Workflow_Agent where begindate =’1900-01-01′ and enddate =’2099-12-31′;
delete from workflow_agentConditionSet where agentid not in (select agentid from Workflow_Agent);

–去掉验证码,需重启
update HrmSettings set needvalidate = 0;

–delete pending flow
update workflow_requestbase set deleted =1 where requestid in(
select DISTINCT a.requestid from workflow_requestbase a,workflow_currentoperator b,workflow_base c,workflow_type d
where a.requestid = b.requestid and a.workflowid = c.id and c.workflowtype = d.id
and b.userid = 1 and a.deleted =0 and d.id = 1 –workflowtype
);

 

 

发表评论