Can't restore AdventeureWorksDW2022.bak

Nada 0 Reputation points
2024-08-26T11:43:25.3066667+00:00

TITLE: Microsoft SQL Server Management Studio


Restore of database 'AdventureWorksDW2022' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)


ADDITIONAL INFORMATION:

Microsoft.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\AdventureWorksDW2022.mdf'. (Microsoft.SqlServer.Smo)

For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=17.100.40.0&LinkId=20476


BUTTONS:

OK


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

2 answers

Sort by: Most helpful
  1. Haris Rashid 81 Reputation points
    2024-08-26T20:04:22.62+00:00

    Check / grant SQL Server Service Account read and write permission for the folder.

    0 comments No comments

  2. MikeyQiaoMSFT-0444 2,705 Reputation points
    2024-08-27T06:03:11.9066667+00:00

    Hi,Nada

    Welcome to Microsoft Q&A fourm!

    The issue may arise due to insufficient permissions for the folder, or the instance name not matching. You can try to fix this by granting the SQL user access permissions to the relevant directory. You can refer to the content in the following two links.

    https://stackoverflow.com/questions/7031792/sql-server-restore-error-access-is-denied

    https://www.stellarinfo.com/blog/fix-operating-system-error-5-access-is-denied-in-ms-sql-server

    Regards

    Mikey Qiao


    If you're satisfied with the answer, don't forget to "Accept it," as this will help others who have similar questions to yours.


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.