SQL Server: Restoring database from a remote location directly vs. copy .bak file and then restore

travisGatesMcGee@hotmail.com 21 Reputation points
2020-08-27T23:41:29.643+00:00

SQL Server: Restoring database from a remote location directly vs. copy .bak file and then restore

Will anybody know why restoring directly from a LAN location is far faster than the total time require for copying the .bak file first and then restoring.

Example: Restoring directly from a remote location takes 55 minutes
Copying from remote to local to SQL Server takes 98 minutes
Restoring from local location takes 2 minutes.

Why is that?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,013 questions
{count} votes

5 answers

Sort by: Most helpful
  1. tibor_karaszi@hotmail.com 4,311 Reputation points
    2020-08-29T08:53:24.837+00:00

    If you aren't willing to try to improve on the file copy process, then there's not much we can do. My experience is that the GUI file copy is provocatingly slow, and that it gets worse with every version of Windows. So, I again, suggest that you investigate (yourself or ask in an OS Q&A/forum) on the file copy aspect. I'd just tak a reasonable sized file and give it a few tries. And remember to try various command-line options (I believe that there's a /x option for copy command to not cache the data - but my memory might be failing me). If you go that path, pls let us know if you get any significant improvement of the file copy times.

    1 person found this answer helpful.
    0 comments No comments

  2. Cris Zhan-MSFT 6,636 Reputation points
    2020-08-28T02:13:10.857+00:00

    Hi sy27295,

    Usually restoring a backup file locally is more reliable and faster than remotely restoring from a network drive.
    You can see that it only takes 2 minutes to restore the database locally, but it takes 55 minutes to restore the database remotely.

    The problem is on remote copy operation. What is the size of the backup file? It took 98 minutes to copy from remote to local. You need to take multiple tests to obtain results. Certain factors (such as network and server performance) may affect the file copy.

    ===============================================
    If the response helped, do "Accept Answer" and upvote it.

    0 comments No comments

  3. tibor_karaszi@hotmail.com 4,311 Reputation points
    2020-08-28T06:46:12.463+00:00

    When you restore directly, you only read the data to be restore once. When copying the file, you first read the original file, copy it to a local file. And then read it again (the restore operation). I.e., more work, result in longer time.

    Or are you saying that the copy operation alone takes 98 minutes? Then you need to look into that operation. Use a proper copy command (xcopy, robocopy etc), check out what command line switches are available (like don't cache the data that you copy) etc.

    Another possibility is that the backup file has more than one backup. I.e., when you restore remote you only read what you need. But my guess would be on something weird with your copy command. Oh, and never use the GUI to copy large files...

    0 comments No comments

  4. travisGatesMcGee@hotmail.com 21 Reputation points
    2020-08-29T02:26:31.797+00:00

    Yes, I am using the Windows File Manager GUI WAN copy (file server in Boston to db server in Houston where the copying happens in a server ) with the assumption that Microsoft must have optimized it up the the gazulu (just invented this word); other than posting % stuff back to the client.

    Full Backup copy .... 200 Gig Compressed single backup, no trans - simplest possible backup.

    Option A ..... restore from file server in Boston to the Database in Houston server 55 minutes.

    Option B ..... copy the 200 Gig file from Boston to Houston 98 minutes and restore once the files is in Houston locally 2 minutes; total time 100 minutes.

    0 comments No comments

  5. Victor Hugo Rios Salgado 1 Reputation point
    2020-08-29T03:01:35.577+00:00

    Copying from remote to local takes more time because some things could affect for example,
    -Disk IOPS, there are reads from disk remote,

    • Network, if you use your computer as a bridge from source and target all the traffic is passing through your computer. Network speed r/w.
    • More IOPS, in the target computer(disk) there are write tasks
    • Integrity, there is a checksum at the end of the copy task
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.