Posts

Showing posts with the label Restore

Unable to open the physical file

Image
While trying to attach the .mdf file of a database I faced following error: Msg 5120, Level 16, State 101, Line 1 Unable to open the physical file "D:\AdventureWorks2012_Data.mdf". Operating system error 5: "5(Access is denied.)". This was resolved by running the SQL server management studio as Administrator account shown below.

Restore failed for Server 'ServerName'

I recently faced an error while restoring a database from the backup file on a server. Following is the error I faced: Restore failed for Server 'ServerName'.  (Microsoft.SqlServer.SmoExtended) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.2531.0+((Katmai_PCU_Main).090329-1045+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476 ADDITIONAL INFORMATION: System.Data.SqlClient.SqlError: RESTORE detected an error on page (0:256) in database "DatabaseName" as read from the backup set. (Microsoft.SqlServer.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.2531.0+((Katmai_PCU_Main).090329-1045+)&LinkId=20476 Another similar error was below: Msg 3183, Level 16, State 2, Line 1 RESTORE detected an error on page (0:16777216) in database "DatabaseName" as read from the...

"The WITH MOVE clause can be used to relocate one or more files." Error while restore

Image
Recently trying to restore a database following message was thrown: System.Data.SqlClient.SqlError: File 'F:\DATA\DatabaseName.mdf' is claimed by 'DBFileGroup1'(3) and 'DBFile'(1). The WITH MOVE clause can be used to relocate one or more files. (Microsoft.SqlServer.Smo) The issue might be because of the restore process using same physical file name and path for two different database files. Go to the options tab and see. Following is the screenshot: In any file system there would be no physical files with same name in any given folder. This is why the error comes. Just modify the file name as per your requirement as below: Now hit the OK button. This will restore the database without any error.

Make Money from Surveys