When restoring a sql database from a .bak file, are there any limitations on the .bak file location

Greg Booth 1,296 Reputation points
2022-10-17T15:45:36.757+00:00

I will be restoring a very large database from a .bak file that will exist only on an external drive. The file is so large that there will be no room to copy the .bak file to the server. Instead the external drive will be mounted as another drive on the server - say the X: drive.
When i try to restore the database (creating it for the first time on the instance) , are their any limits to what location I specify for the .bak file ?
For example if i issue the command
RESTORE DATABASE [MyDB] FROM DISK = N'X:\mydb.bak' - is it going to complain that i cannot restore from the X: drive ?
I would assume that the service account running the sql engine needs to have at least read access to the location of the .bak file

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

Accepted answer
  1. JimmySalian-2011 41,926 Reputation points
    2022-10-17T15:57:34.513+00:00

    Hi,

    That is correct the account will require full access to the .bak file and also the DB BAK file should not be corrupted, also make sure the external drive is excluded or atleast .bak file excluded from the OnAccess AV scanning process.
    restore-sql-server-database-from-bak-file.php

    Hope this helps.

    ----
    Please don't forget to upvote and Accept as answer if the reply is helpful

    If this answer helped you please mark it as "Verified" so other users can reference it.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. YufeiShao-msft 7,061 Reputation points
    2022-10-18T06:23:37.863+00:00

    Hi @Greg Booth

    The network account you used should have permissions to access the path to database files, and grant full control over that folder to "Network Service" or whatever user your SQL user to interact with your Windows

    Refer to this thread:
    https://social.technet.microsoft.com/Forums/sqlserver/en-US/efbdbfce-b476-4632-b6d0-10b9a9af0dc2/is-possible-to-restore-database-back-up-file-from-external-hard-drive-to-same-location

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Olaf Helper 41,006 Reputation points
    2022-10-18T06:38:54.347+00:00

    that i cannot restore from the X: drive ?

    I guess X: is a mapped network share and if, it's mapped in your user profile and SQL Server don't know that drive.
    Use the UNC path for the network share instead, like
    \server\path\mydb.bak

    0 comments No comments