Answered by:

RESTORE

Question

1. I Hav take backup in 1 server n i want to restore it in another server. i hav taken backup successfully but when i m trying to restore it in another server it shows below error. what is the sol pls rep...

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.MSSQLSERVER\MSSQL\DATA\SAMPLE.mdf'.
(Microsoft.SqlServer.SmoExtended)

Answers

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.MSSQLSERVER\MSSQL\DATA\SAMPLE.mdf'. (Microsoft.SqlServer.SmoExtended)

You would get a clue from the error message itself. SQL logon account doesn't have proper permission to C:\Program files\......

as said this is permission issue on the file system level, so where ever you restoring the files you should have R/w or full permission.

Usually you shoudn't put the database files in the Operating system level, as OS team might can remove permissions if there is no proper security track if they dont have it so.

Atlease you need to ensure you are part of the administrator group & this group as R/W permission or full permission on which file you are going to accesses or creating, so usually the SQL server account will have permission if initially they have set
you shouldn't get issue , but check with your OS team on that & fix the issue.

Thanks, Rama Udaya.K (http://rama38udaya.wordpress.com) ---------------------------------------- Please remember to mark the replies as answers if they help and UN-mark them if they provide no help,Vote if they gives you information.

All replies

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.MSSQLSERVER\MSSQL\DATA\SAMPLE.mdf'. (Microsoft.SqlServer.SmoExtended)

You would get a clue from the error message itself. SQL logon account doesn't have proper permission to C:\Program files\......

as said this is permission issue on the file system level, so where ever you restoring the files you should have R/w or full permission.

Usually you shoudn't put the database files in the Operating system level, as OS team might can remove permissions if there is no proper security track if they dont have it so.

Atlease you need to ensure you are part of the administrator group & this group as R/W permission or full permission on which file you are going to accesses or creating, so usually the SQL server account will have permission if initially they have set
you shouldn't get issue , but check with your OS team on that & fix the issue.

Thanks, Rama Udaya.K (http://rama38udaya.wordpress.com) ---------------------------------------- Please remember to mark the replies as answers if they help and UN-mark them if they provide no help,Vote if they gives you information.