飞泰虚拟交易所&aboss2的初始化和检查

@ECHO off
title 飞泰环境初始化
ECHO ====================================================
ECHO                 主柜台初始化
ECHO ====================================================
ECHO                   集中交易
ECHO ====================================================
sqlplus system/password#@oracle @aboss2.sql
ECHO ====================================================
ECHO                   融资融券
ECHO ====================================================
sqlplus system/password#@oracle @aboss2.sql
ECHO ====================================================
ECHO                检查虚拟交易所
ECHO ====================================================
cd D:\SoftWare\mysqlworkbench
mysql -uuser -ppassword -hIP -Pport -N < D:\1.脚本\VTF\vtf.sql
pause
-- SELECT * FROM vtp.auto_init_log where SUBSTR(auto_start_time,1,8)= date_format(now(),'%Y%m%d') and group_id in (1,2) and task_type=1;
select '**********集中交易**********';
select '====当前交易日====';
select tradedate from vtp_1.tbl_current_tradedate where SUBSTR(tradedate,1,8)= date_format(now(),'%Y%m%d');
select '====初始化日期===='; 
select sys_init_date from vtp_1.tbl_current_tradedate where SUBSTR(sys_init_date,1,8)= date_format(now(),'%Y%m%d');
select '====撮合启动===='; 
select exists (SELECT 1 FROM vtp_1.startup_status where SUBSTR(time,1,10)= date_format(now(),'%Y-%m-%d')); 
select ' ';
select ' ';
select '**********融资融券**********';
select '====当前交易日====';
select tradedate from vtp_2.tbl_current_tradedate where SUBSTR(tradedate,1,8)= date_format(now(),'%Y%m%d');
select '====初始化日期===='; 
select sys_init_date from vtp_2.tbl_current_tradedate where SUBSTR(sys_init_date,1,8)= date_format(now(),'%Y%m%d');
select '====撮合启动===='; 
select exists (SELECT 1 FROM vtp_2.startup_status where SUBSTR(time,1,10)= date_format(now(),'%Y-%m-%d')); 

set heading off;
set echo off;
set serveroutput on;
select '====================================================' from dual;
select '开始aboss2初始化......' from dual;
declare cnt_1 number;
BEGIN
	-- dbms_output.PUT_LINE('开始aboss2初始化......');
	EXECUTE IMMEDIATE ('update ofs.tof_jjfe set djsl=0,mcwtsl=0');
	EXECUTE IMMEDIATE ('truncate table ofs.tof_fedjxmmx');
	EXECUTE IMMEDIATE ('truncate TABLE ofs.tOF_JJWT');
	EXECUTE IMMEDIATE ('update account.tzjzh set djje=0');
	EXECUTE IMMEDIATE ('truncate table account.tzjdjxmmx');
	EXECUTE IMMEDIATE ('truncate table securities.tzqdjxmmx');
	EXECUTE IMMEDIATE ('truncate table securities.twkhqy');
	EXECUTE IMMEDIATE ('truncate table securities.tdrwt');
	EXECUTE IMMEDIATE ('truncate table securities.tSSCJ');
	EXECUTE IMMEDIATE ('truncate table aboss.twtqrno');
	EXECUTE IMMEDIATE ('truncate TABLE securities.tZHYWWT');
	EXECUTE IMMEDIATE ('truncate table securities.tSSCJ_BF');
	EXECUTE IMMEDIATE ('truncate TABLE securities.tDQSWT');
	EXECUTE IMMEDIATE ('truncate TABLE securities.tKHYJFHMX_BF');
	EXECUTE IMMEDIATE ('truncate TABLE securities.temKHLJWTSL');
	EXECUTE IMMEDIATE ('update securities.tjyr set spsj = to_char(sysdate,''yyyymmdd HH24:mi:ss'') where rq = (select max(rq) from securities.tjyr where jyrbs = 0 and rq < to_char(sysdate,''yyyymmdd''))');
	EXECUTE IMMEDIATE ('update ofs.tof_jyr set spsj = to_char(sysdate,''yyyymmdd HH24:mi:ss'') where rq = (select max(rq) from securities.tjyr where jyrbs = 0 and rq < to_char(sysdate,''yyyymmdd''))');
	EXECUTE IMMEDIATE ('commit');
	EXECUTE IMMEDIATE ('update ofs.tof_jyr set cshsj=to_char(sysdate,''yyyymmdd HH24:mi:ss'') where rq=to_char(sysdate,''yyyymmdd'')');
	EXECUTE IMMEDIATE ('update securities.tjyr set cshsj=to_char(sysdate,''yyyymmdd HH24:mi:ss'') where rq=to_char(sysdate,''yyyymmdd'')');
	EXECUTE IMMEDIATE ('delete from aboss.txtzt');
	EXECUTE IMMEDIATE ('insert into aboss.txtzt (DQJYR, LOGIN_ENABLE, ZQJY_ENABLE, ZJYW_ENABLE, LSCXYW_ENABLE, OFS_ENABLE, KHYW_ENABLE, XTCSBZ, STATUS1, STATUS2, STATUS3, STATUS4, STATUS5) values (to_char(sysdate,''yyyymmdd''), 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1)');

-- 重置委托号
	EXECUTE IMMEDIATE ('DROP SEQUENCE securities.SEQ_tDRWT');
	EXECUTE IMMEDIATE ('CREATE SEQUENCE securities.SEQ_tDRWT INCREMENT BY 1 START WITH 1 NOMAXVALUE NOMINVALUE NOCYCLE CACHE 200 NOORDER');
	EXECUTE IMMEDIATE ('DROP SEQUENCE securities.SEQ_TSSCJ');
	EXECUTE IMMEDIATE ('CREATE SEQUENCE securities.SEQ_TSSCJ INCREMENT BY 1 START WITH 1 NOMAXVALUE NOMINVALUE NOCYCLE CACHE 200 NOORDER');
	EXECUTE IMMEDIATE ('commit');
	dbms_output.PUT_LINE('执行成功');
	select count(*) into cnt_1 from dual
	where EXISTS(
	select 1 from aboss.txtzt where SUBSTR(dqjyr,1,8)=to_char(sysdate,'yyyymmdd')
	);
	if cnt_1=0 then
		dbms_output.PUT_LINE('系统未初始化');
	else
		dbms_output.PUT_LINE('系统初始化成功');
	end if;
	
	select count(*) into cnt_1 from dual
	where EXISTS(
	select 1 from securities.tjyr where rq=to_char(sysdate,'yyyymmdd') and jyrbs=0 and cshsj is not null
	);
	if cnt_1=0 then
		dbms_output.PUT_LINE('交易未初始化');
	else
		dbms_output.PUT_LINE('交易初始化成功');
	end if;
	dbms_output.PUT_LINE('====================================================');
end;
/
exit

posted @ 2023-05-23 15:22  孙犯困  阅读(57)  评论(0编辑  收藏  举报