1

I was trying to copy large database backup files(appx. 2TB each) to different region using robocopy. But I have noticed the speeds are drastically slow when using the switch /Z. So I have removed this switch and my copy is now faster. But now the challenge is,

  1. how to verify the consistency of copied files.
  2. what is the best possible way to skip the files if the files are already present in target location.
  3. I have tried using powershell get-filehash command to verify file consistency but it’s too slow on large files especially on files located in different region.

My current command syntax,

robocopy source_directory destination_directory file_name /R:3 /W:10 /LOG+:log_file_location

Any best possible ways to address this?

S.D.
  • 754
  • 5
  • 19

2 Answers2

3

SQL Server has a very handy command which checks the headers, checksums (if present) and that the backup set is complete. A data integrity check will be performed if a checksum is present but is optional. From the documentation here

RESTORE VERIFYONLY FROM DISK = 'D:\AdventureWorks.bak' WITH CHECKSUM;
GO
kevinskio
  • 4,272
  • 1
  • 30
  • 50
2

Two ways verify consistency come to mind:

  • Perform checksums on each "end" of the copy (you've already tried this)
  • Restore the database after copying the backup files (if this is production data, you will need to be licensed appropriately as verifying those backups would probably be considered a production workload). There are myriad ways you can automate restoring & performing a dbcc checkdb, to varying degrees of detail (the RESTORE VERIFYONLY method may or may not be sufficient for you)

You can skip re-copying files using robocopy's mirroring functionality. I use the following to copy my backups to another location, suppressing all output:

robocopy SOURCE DESTINATION /M /COPY:DAT /E /DCOPY:DAT /MT:128 /nfl /ndl /njh /np /ns /nc /njs

Files that already exist on the destination won't be re-copied, and the directory structure will be maintained.

alroc
  • 1,694
  • 11
  • 20