Question : restoring a .bak file SQL SERVER 2005

Hello,

I have created a .bak file on file office machine and I want to restore this on my home machine. After creating a new GiftWeb database when I run the following statement to restore I am getting erros, please see attached.

use master
RESTORE DATABASE GiftWeb
FROM DISK = 'C:\G_DB\20091211.bak'
WITH REPLACE

Can someone please advise

Thanks
C
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Msg 5133, Level 16, State 1, Line 2
Directory lookup for the file "D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\GiftWeb.mdf" failed with the operating system error 21(The device is not ready.).
Msg 3156, Level 16, State 3, Line 2
File 'GiftWeb' cannot be restored to 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\GiftWeb.mdf'. Use WITH MOVE to identify a valid location for the file.
Msg 5133, Level 16, State 1, Line 2
Directory lookup for the file "D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\GiftWeb_log.ldf" failed with the operating system error 21(The device is not ready.).
Msg 3156, Level 16, State 3, Line 2
File 'GiftWeb_log' cannot be restored to 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Gift_log.ldf'. Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Line 2
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.

Answer : restoring a .bak file SQL SERVER 2005

Try this syntax:

use master
GO
RESTORE DATABASE GiftWeb
FROM DISK = 'C:\G_DB\20091211.bak'
WITH MOVE 'ur_db_data_file_name' TO 'mdf_file_location',
MOVE 'ur_db_log_file_name' TO 'ldf_file_location'
GO

Replace the file names and file path before running it..
Random Solutions  
 
programming4us programming4us