Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 import a .bak file (produced by SQL-Server 2005) i

Author  Topic 

fabianus76
Posting Yak Master

191 Posts

Posted - 2005-09-05 : 12:02:47
Hallo!

I would like to know how I may import a .bak file (produced by SQL-Server 2005) into SQLExpress.

Thank you very much for any help !

Regards,
Fabian

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-09-05 : 12:38:33
You should be able to restore it using the RESTORE command.
Go to Top of Page

fabianus76
Posting Yak Master

191 Posts

Posted - 2005-09-09 : 07:17:16
>>You should be able to restore it using the RESTORE command.

Hallo robvolk,

thank you for your reply.

I do not know where and how to use the RESTORE command. I would be very happy if you could tell me where this has to be executed and how I tell the command where is located my file to be restored.


Regards,
Fabian
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-09-09 : 07:24:45
Here ya go:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ra-rz_25rm.asp

I'm not fully versed in what SQL Server Express has in the way of query tools, but the Express Manager should let you run a RESTORE command, or have a menu option to restore a database.
Go to Top of Page

fabianus76
Posting Yak Master

191 Posts

Posted - 2005-09-09 : 07:27:35
When I execute this :

RESTORE DATABASE MealManager FILE = 'D:\savedata\SQL-Server\MealManager.bak'

I get this error :
.Net SqlClient Data Provider: Msg 3118, Level 16, State 1, Line 1
The database "MealManager" does not exist. RESTORE can only create a database when restoring either a full backup or a file backup of the primary file.
.Net SqlClient Data Provider: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Any idea what I could change?

Regards,
Fabian
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-09-09 : 07:51:18
If you are creating a new database, you must specify where the data and log files are to be placed. Your syntax was also off a little bit:

RESTORE DATABASE MealManager FROM DISK='D:\savedata\SQL-Server\MealManager.bak'
WITH MOVE 'Data_File' TO 'e:\MealManager_Data.mdf',
MOVE 'Log_File' TO 'F:\MealManager_Log.ldf'


If you need a list of the logical and physical file names in the backup file:

RESTORE FILELISTONLY FROM DISK= 'D:\savedata\SQL-Server\MealManager.bak'
Go to Top of Page

fabianus76
Posting Yak Master

191 Posts

Posted - 2005-09-09 : 07:54:34
Got it !

RESTORE DATABASE MealManager
FROM DISK = 'D:\savedata\SQL-Server\MealManager.bak'

Thank you very much!

Regards,
Fabian
Go to Top of Page
   

- Advertisement -