1.创建一个sql文件,test.sql;
INSERT INTO TR_HK_RC_TEMPERATURE2 (HWINSTANCEID, KPIITEMID, BRANCHID, COLLECTTIME, KPINUMBERVALUE, INSERTTIME)
select scadadeviceid hwinstanceid,
kpiitemid ,channelid * 64 + sensorid+1 branchid,SYSDATE,
dbms_random.value(20,40),SYSDATE from TR_R_SRACKMAPPING a,(select deviceid from
dt_devices where devicetoptypeid = 6) b where a.deviceid = b.deviceid and
kpiitemid = 42;
INSERT INTO TR_HK_RC_TEMPERATURE6 (HWINSTANCEID, KPIITEMID,
BRANCHID, COLLECTTIME, KPINUMBERVALUE, INSERTTIME)
select scadadeviceid
hwinstanceid, kpiitemid ,channelid * 64 + sensorid+1 branchid,SYSDATE,
dbms_random.value(20,40),SYSDATE from TR_R_SRACKMAPPING a,(select deviceid from
dt_devices where devicetoptypeid = 6) b where a.deviceid = b.deviceid and
kpiitemid = 46;
/
commit;
exit;
2.创建sql.bat文件,
sqlplus cmscrfid_sit/cmscrfid_sit@orcl @test.sql
3.创建vbs文件,用于隐藏窗口。
Set ws = CreateObject("Wscript.Shell")
ws.run "cmd /c sql.bat",vbhide
创建任务,每分钟一次:
schtasks /create /sc minute /mo 1 /tn "InertTempratureData"
/tr c:/runbat.vbs
删除任务:
schtasks /delete /tn "InertTempratureData"