[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Scheduled task in Windows server 2003 returns 0x2 and doesn't seem to run batch file

Posted on 2007-11-30
10
Medium Priority
?
22,023 Views
Last Modified: 2013-12-01
I am running 2 scheduled tasks on a Windows 2003 server. Each of these calls a separate batch file to run various backup and database maintenance processes on a  Mimer SQL database. These have both been working correctly for months. In the last 3 days they have stopped working.

When I run the batch files manually (in explorer) they complete everything correctly. When they are set to run as scheduled they do not complete the tasks and return last result 0x2.

I have looked up this code and believe it to mean: ERROR_FILE_NOT_FOUND 2 The system cannot find the file specified. From http://msdn2.microsoft.com/en-us/library/ms681382.aspx 

Ive checked the paths and all looks OK. What can this mean?


 
0
Comment
Question by:jamesd84
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 30

Expert Comment

by:SteveGTR
ID: 20387323
If you are using mapped drives they might not be available. I'd suggest using URNs:

\\server\share\dir
0
 

Author Comment

by:jamesd84
ID: 20387327
Thanks for your response, both batch files are local to the server.
0
 
LVL 17

Accepted Solution

by:
JohnGerhardt earned 1000 total points
ID: 20387364
Have you considered just recreating the tasks...? Often this can solve the problem, quickly and simply!
Hope this Helps
-Jaggie
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 30

Expert Comment

by:SteveGTR
ID: 20387986
Can you post 1 of the batch files?
0
 

Author Comment

by:jamesd84
ID: 20390175
I have re-created both tasks - thanks for that suggestion John. Ive just got a funny feeling that it is scheduled tasks bug, because after I re-created the tasks and ran them, the scripts ran and the backup was successful - but it still exited with 0x2. Thoughts?

Here is one of the batch files

**START

CD\OASIS824CM
 
REM - Delete all dbc and log files in the backup folder
DEL C:\OASIS824CM\backup\*.dbc
DEL C:\OASIS824CM\backup\*.log
 
REM - Set database offline/online to clear cache
BSQL OASIS824CM <OFFLINE.TXT
BSQL OASIS824CM <ONLINE.TXT
 
REM - Stop Mimer Database
NET STOP MIMER-OASIS824CM
MIMCONTROL -t OASIS824CM
 
REM - Perform  physical checks on system databank
DBC C:\OASIS824CM\data\sysdb92.DBF C:\OASIS824CM\backup\sysdb92.DBC
REM - Restart Mimer Database
NET START MIMER-OASIS824CM
MIMCONTROL -s OASIS824CM
 
REM - Force Database Online Again in case of errors
BSQL OASIS824CM <ONLINE.TXT
 
REM - Call Utils to verify database
xcopy C:\OASIS824CM\oasis8.ini C:\oasis8\oasis8.ini /y /e /h /c
C:\OASIS824CM\UTILS82E [VERIFY]
 
REM - If Utils writes a flag file then drop out
If exist C:\OASIS824CM\backup\DBC.LOG goto :EOF
 
REM - Delete all dbf files in backup directory
DEL C:\OASIS824CM\backup\*.dbf
 
REM - Stop Mimer Database and Dos Copy Files
NET STOP MIMER-OASIS824CM
MIMCONTROL -t OASIS824CM
XCOPY C:\OASIS824CM\log\*.DBF C:\OASIS824CM\logarch1 /y /e /h /c /i
COPY C:\OASIS824CM\data\*.DBF C:\OASIS824CM\log
 
REM - Restart Mimer Database
NET START MIMER-OASIS824CM
MIMCONTROL -s OASIS824CM
 
REM - Perform an online backup
BSQL OASIS824CM <OBACKUP.TXT
 
 
REM - Force Database Online Again in case of errors
BSQL OASIS824CM <ONLINE.TXT

**END
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 20390436
One thing you might do is alter your initial cd command to this:

CD /D C:\OASIS824CM

Other than that it looks good to me. The only thing I can think is that the last BSQL command is returning the code. You could dump some debugging information:

BSQL OASIS824CM <ONLINE.TXT
(echo [%date% %time%] Errorlevel: %errorlevel%)>>debug.txt

0
 
LVL 32

Expert Comment

by:r-k
ID: 20399217
Anything of interest in the Scheduler log?
(Scheduled Tasks -> Advanced -> View Log)
0
 

Author Comment

by:jamesd84
ID: 20402094
Thanks everyone for your input - im kicking myself. After re-creating the tasks it is working again. Lots of other scheduled tasks were created by another tech - maybe this had something to do with it. Does scheduler have a bug of this nature??
0
 

Author Closing Comment

by:jamesd84
ID: 31412083
Thanks a heap John - sometimes the simplest thing hey ;)
0
 

Expert Comment

by:mservidio
ID: 32356232
I was receiving the same 0x2 error message when trying to execute a batch script that used mapped network drives. Once I removed mapped network drives, and specified the full patch \\machine\folder, ie... it works.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is an update and follow-up of my previous article:   Storage 101: common concepts in the IT enterprise storage This time, I expand on more frequently used storage concepts.
"Any files you do not have backed up in at least two [other] places are files you do not care about."
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question