0
votes

I am trying to restore a .bak file in SQL Server 2008 but I am facing some problem please help

This is my query

 RESTORE DATABASE Dinesh
 FROM DISK = 'E:\MDFFiles\dbdinesh.bak'
 WITH MOVE 'schoolschool' TO 'D:MDFFiles\Dinesh.mdf',
 MOVE 'schoolschool' TO 'D:MDFFiles\Dinesh.mdf'

I am getting error

Cannot open backup device 'E:\MDFFiles\dbdinesh.bak'. Operating system error 21 (The device is not ready.).
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

1
check th path `E:\MDFFiles` for your bak file is correct and assessableNisar
Well - is it seems like SQL Server cannot see the file. Is the E drive accessible? Also why the 2 identical "WITH MOVE" and why no \ in D:MDFiles?Allan S. Hansen
Bear in mind that the paths you're providing have to be paths that the account that SQL Server is running under can see from the server machine - so if e.g. E is a network drive mapped under your account, this will not work.Damien_The_Unbeliever
Also, you have to have the backslash after D: - it's not optional. If you don't then your next question after working out why your server can't access the .bak file will be 'Why won't this restore where I want it to?' ;)Steve Pettifer

1 Answers

0
votes

SQL Error 3013 occur due to various reasons like media failure, write failure, connectivity loss etc. The occurrence factors vary depending upon the versions of SQL Server application and Operating Systems. Here is the workaround of SQL error 3013: http://www.sqlservercentral.com/blogs/sql-server-overview/2018/02/17/sql-server-error-3013-restore-database-is-terminating-abnormally/