SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 import a .bak file (produced by SQL-Server 2005) i
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

fabianus76
Posting Yak Master

191 Posts

Posted - 09/05/2005 :  12:02:47  Show Profile  Reply with Quote
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

USA
15676 Posts

Posted - 09/05/2005 :  12:38:33  Show Profile  Visit robvolk's Homepage  Reply with Quote
You should be able to restore it using the RESTORE command.
Go to Top of Page

fabianus76
Posting Yak Master

191 Posts

Posted - 09/09/2005 :  07:17:16  Show Profile  Reply with Quote
>>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

USA
15676 Posts

Posted - 09/09/2005 :  07:24:45  Show Profile  Visit robvolk's Homepage  Reply with Quote
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 - 09/09/2005 :  07:27:35  Show Profile  Reply with Quote
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

USA
15676 Posts

Posted - 09/09/2005 :  07:51:18  Show Profile  Visit robvolk's Homepage  Reply with Quote
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 - 09/09/2005 :  07:54:34  Show Profile  Reply with Quote
Got it !

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

Thank you very much!

Regards,
Fabian
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000