0

I have a script that runs each night for backup purposes. The just of the script is it will backup a DB, compress it to a 7zip file and then copy it to a network location I have set-up.

My script errors out with the following results when using Robocopy to move the file to a network folder which is cloud based so it might become unavailable depending on the internet.

02:29:32   Moving file...
02:29:32       Filename: MyBackup.7z
02:29:32     Src Folder: C:\SQLBackups\DBBackups\.
02:29:32    Dest Folder: \\myserver\database_backups
02:34:26   -------------------------------------------------------------------------------
02:34:26   ROBOCOPY     ::     Robust File Copy for Windows                              
02:34:26   -------------------------------------------------------------------------------
02:34:26   Started : Tuesday, October 30, 2018 2:29:32 AM
02:34:26   Source : C:\SQLBackups\DBBackups\
02:34:26   Dest = \\myserver\database_backups\
02:34:26   Files : MyBackup.7z
02:34:26   
02:34:26   Options : /DCOPY:DA /COPY:DAT /MOV /NP /R:1000000 /W:30 
02:34:26   ------------------------------------------------------------------------------
02:34:26   1    C:\SQLBackups\DBBackups\
02:34:26   New File          886.7 m    MyBackup.7z
02:34:26   2018/10/30 02:33:56 ERROR 121 (0x00000079) Changing File Attributes C:\SQLBackups\DBBackups\MyBackup.7z
02:34:26   The semaphore timeout period has expired.
02:34:26   Waiting 30 seconds... Retrying...
02:34:26   New File          886.7 m    MyBackup.7z
02:34:26   2018/10/30 02:34:26 ERROR 2 (0x00000002) Changing File Attributes C:\SQLBackups\DBBackups\MyBackup.7z
02:34:26   The system cannot find the file specified.
02:34:26   ------------------------------------------------------------------------------
02:34:26   Total    Copied   Skipped  Mismatch    FAILED    Extras
02:34:26   Dirs :         1         0         0         0         0         0
02:34:26   Files :         1         0         0         0         1         0
02:34:26   Bytes :  886.70 m         0         0         0  886.70 m         0
02:34:26   Times :   0:04:53   0:04:23                       0:00:30   0:00:00
02:34:26   Ended : Tuesday, October 30, 2018 2:34:26 AM
02:34:26   -------------------------------------------------------------------------------
02:34:26   Error moving file.

As you can see above, it has a moment when it seems to be having issues coping over the very large file. Then something happens, like the network becomes unavailable or the share on the server has issues.

By default Robocopy has it's retry options set to retry 1 million times and to wait 30 seconds between each retry. My question is, why does my script only try twice? Is it due to the ERROR 2? Does retry only happen if that specific error is not apparent? Is there a way to make Robocopy continue to retry even if ERROR 2 happens?

I really think the issue is that the internet "goes out" for a little while (maybe even an hour or two). I just want Robocopy to keep on trying until the connection comes back up.

-1

/MOV moves the file and not exist in the source after the first error. The second error (file does not exist) is a critical error and interrupts the copy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.