我有一个Program2.bat
有Oracle查询,它会生成一个文件log.txt
,其内容结构如下:
SQL> SELECT SID, SERIAL#, STATUS, USERNAME, LOGON_TIME FROM GV$SESSION WHERE USERNAME = 'DBADMIN' and status in ('ACTIVE','INACTIVE','KILLED') ;
no rows selected
SQL> spool off;
或者喜欢:
SQL> SELECT SID, SERIAL#, STATUS, USERNAME, LOGON_TIME FROM GV$SESSION WHERE USERNAME = 'DBADMIN' and status in ('ACTIVE','INACTIVE','KILLED') ;
SID SERIAL# STATUS USERNAME LOGON_TI
---------- ---------- ---------- ---------- -------------
2388 54 Active DBADMIN 28-FEB-14
2391 37 Active DBADMIN 17-FEB-14
2395 111 Inactive DBADMIN 28-FEB-14
2780 325 Killed DBADMIN 26-FEB-14
2790 111 Killed DBADMIN 8-FEB-14
5 rows selected.
SQL> spool off
我正在努力实现以下目标:
动作-4:如果找不到字符串,请执行以下操作:
再次调用program2.bat并
以5分钟的间隔再次执行Action-2(意味着以5分钟的间隔继续搜索log.txt中的字符串“no rows selected”,直到找到“没有选择行”字符串。)< / p>
@echo off
setlocal
Call Program2.bat
>nul findstr /c:"no rows selected" log.txt && (
call program1.bat
) || (
call program2.bat
)
如何在上述脚本中实现Action-4的Point-2,或者我们是否有其他方式以最简单的方式实现所有目标?