Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: nt script

RE: nt script

From: Seefelt, Beth <Beth.Seefelt_at_TetleyUSA.com>
Date: Tue, 01 Jul 2003 12:15:32 -0700
Message-ID: <F001.005BD469.20030701114517@fatcity.com>

Correct. FORFILES will not work.

-----Original Message-----
Sent: Tuesday, July 01, 2003 3:20 PM
To: Multiple recipients of list ORACLE-L

Hi Seefelt,

with or without match, I added ORA-03113 and deleted it later to test both case. They all run ERRORLEVERL 1 condition. No matter what.

Joan

CODE: FORFILES -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log -d+0 -c"CMD /c type d:[EMAIL PROTECTED]|findstr ORA-03113"

IF ERRORLEVEL 1 ( echo 'there is no match' ) goto :no
IF NOT ERRORLEVEL 1 (echp 'there is a match') GOTO :RUN_PROC
:run_proc
rem d:\psfm\start_proc_sched.bat
echo run
pause
goto end
:no
echo do nothing

TEST RUN WITHOUT MATCH; D:\oracle\admin>FORFILES -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log -d+0 -c"CMD /c echo @FILE"
PSPRCSRV_PSNT_0630.log
PSPRCSRV_PSNT_0701.log

D:\oracle\admin>echo on

D:\oracle\admin>rem FORFILES -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log -d+0 -c"CMD /c type d:\
[EMAIL PROTECTED]|findstr ORA-03113
>D:\oracle\admin\test.log"

D:\oracle\admin>FORFILES -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log -d+0 -c"CMD /c type d:\pslo
[EMAIL PROTECTED]|findstr ORA-03113"

D:\oracle\admin>IF ERRORLEVEL 1 (echo 'there is no match'  )
D:\oracle\admin>goto :no
D:\oracle\admin>echo do nothing

do nothing
D:\oracle\admin>goto end
D:\oracle\admin>echo "finished"
"finished"

TEST RUN WITH A MATCH; D:\oracle\admin>FORFILES -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log -d+0 -c"CMD /c type d:\pslog
[EMAIL PROTECTED]|findstr ORA-03113"
ORA-03113

D:\oracle\admin>IF ERRORLEVEL 1 (echo 'there is no match'  )
D:\oracle\admin>goto :no
D:\oracle\admin>echo do nothing

do nothing
D:\oracle\admin>goto end
D:\oracle\admin>echo "finished"
"finished"

"Seefelt, Beth" wrote:
>
> BTW, it can also be written like this. Just FYI.
>
> FINDSTR /S /I /L "ORA-03113" d:\pslogs_psfm\fmdev8\_psprcsrvlog\*.log
> if errorlevel 1 ( echo 'there is a match'
> d:\start_proc.bat )
> goto :EOF
>
> -----Original Message-----
> Sent: Tuesday, July 01, 2003 12:35 PM
> To: [EMAIL PROTECTED]
>
> Hi,
>
> I think FORFILES is probably overkill here. And it probably is only
> going to return the errorlevel for the last file checked. Just use
> FINDSTR with a wildcard.
>
> FINDSTR /S /I /L "ORA-03113" d:\pslogs_psfm\fmdev8\_psprcsrvlog\*.log
> if errorlevel 1 goto run_proc
> echo 'there is a match'
>
> if errorlevel 0 goto end
> echo 'there is no match'
>
> :run_proc
> d:\start_proc.bat
> goto end
>
> :end
>
> HTH.
>
> -----Original Message-----
> Sent: Tuesday, July 01, 2003 12:15 PM
> To: Multiple recipients of list ORACLE-L
>
> Hi listers,
>
> I am working on a nt script. I download FORFILE exe, it works fine. My
> intention is finding the ORA-03113 string in the log. If there is a
> match, then reboot the server, else do nothing. I don't have problem
> with the findstr part. However, the errorlevel always return 0, no
> matter it find the error or not. So the if statement is not working.
Can
> somebody give me some light on NT syntax? On unix, it is so easy to
> script the condition. Please help,
>
> Thanks,
>
> Joan
>
> FORFILES -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log -d+0
-c"CMD
> /c type d:[EMAIL PROTECTED]|findstr ORA-03113"
> if errorlevel 1 goto run_proc
> echo 'there is a match'
>
> if errorlevel 0 goto end
> echo 'there is no match'
>
> :run_proc
> d:\start_proc.bat
> goto end
>
> :end
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Joan Hsieh
> INET: [EMAIL PROTECTED]
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Seefelt, Beth
> INET: [EMAIL PROTECTED]
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Joan Hsieh
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Seefelt, Beth
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Jul 01 2003 - 14:15:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US