Click here to Skip to main content
15,882,113 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
RESTORE DATABASE z
   FROM DISK = 'E:\z.bck' ;


this query gives error..please tell me..
Posted
Comments
barneyman 25-Jun-15 0:57am    
<sigh> what error do you get?
Member 11337367 25-Jun-15 1:03am    
Msg 3201, Level 16, State 2, Line 1
Cannot open backup device 'E:\z.bck'. Operating system error 2(The system cannot find the file specified.).
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
barneyman 25-Jun-15 1:33am    
right - so does that file exist on the E drive, and does the user you're running the script as have access to that path?

Spelling mistake in backup file name
try-
SQL
RESTORE DATABASE z
   FROM DISK = 'E:\z.bak' ;


Hope, it helps :)
 
Share this answer
 
Comments
Member 11337367 25-Jun-15 1:14am    
No...still error is same..
First verify your backup file path.
It should exists.
Then you have written wrong backfile extension it should ".bak" not ".bck"
Correct it and then try.
SQL
USE [master]
GO
ALTER DATABASE DatabaseName SET RECOVERY SIMPLE
GO
RESTORE DATABASE [DatabaseName] FROM DISK = 'c:\Your Path\Filename.bak' 
 
Share this answer
 
v2
Comments
Member 11337367 25-Jun-15 1:32am    
no different error..
Msg 3159, Level 16, State 1, Line 2
The tail of the log for the database "z" has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log.
Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.
Nirav Prabtani 25-Jun-15 2:48am    
try that before backup

ALTER DATABASE DatabaseName SET RECOVERY SIMPLE
Nirav Prabtani 25-Jun-15 2:48am    
Try updated solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900