cdub
cdub

Reputation: 25701

Restore SQL Server 2012 error

I backed up a database from a SQL Server 2005 using my SSMS Task and called it datalab_auth.bak.

I then tried to restore it to my SQL Server 2012 but keep getting the following error:

System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQL11\MSSQL\datalab_auth.mdf'. (Microsoft.SqlServer.SmoExtended)

I tried to set the path in the above error to have permissions of Everyone to Full. Which it is currently set to.

What am I missing?

Upvotes: 2

Views: 450

Answers (4)

anil shrestha
anil shrestha

Reputation: 3180

This worked for me. After you select your database to restore, select file option and check realocate all files to folder

enter image description here

Upvotes: 0

Dino Liu
Dino Liu

Reputation: 510

The OS error 5 is about to permissions issue on the files and folder paths, I have check my account on config manager to fix this issue. The fix steps on my case:

  1. open SqlServer Configuration Manager as administration
  2. Click SqlServer Service
  3. Right click on you sql server instance, click properties
  4. Choose Log On tab
  5. Account name: input your administrator account and password.
  6. Then backup database successfully.

The environment is that, the OS is Win7 and the version of sql server is MS Sqlserver 2012

Upvotes: 0

Donal
Donal

Reputation: 32713

When you are performing a restore, make sure you set the option to "Overwrite the existing database" in the restore wizard.

enter image description here

Upvotes: 1

Vinnie
Vinnie

Reputation: 3929

Check what account you are using to run the SQL service through the SQL Configuration Manager and assign permissions to the account on the file and folder.

This post might help: mssql '5(Access is denied.)' error during restoring database

Upvotes: 0

Related Questions