locked
How to import .bak file into SQL Server 2008? RRS feed

  • Question

  • Our application backs up our SQL Server 2005 Express database to a .bak file format. Is there a way to import this into my SQL Server 2008 RE? If so, how do I do it?
    Wednesday, July 20, 2011 6:33 PM

Answers

  • Okay, I finally figured it out. It has to do with the same name. I found it in this thread.
    • Marked as answer by Charlie2 Monday, July 25, 2011 5:42 PM
    Monday, July 25, 2011 5:10 PM

All replies

  • Hello Charlie2,

    You don't import a backup file, you restore it; see TechNet: How to Restore a Database Backup


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing
    Wednesday, July 20, 2011 6:46 PM
  • Many thanks for the help. I'm give that link a try.
    Wednesday, July 20, 2011 7:30 PM
  • Hello Charlie2,

    You don't import a backup file, you restore it; see TechNet: How to Restore a Database Backup


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing


    Okay, I tried that article, and I got this error when I tried to restore it.

    TITLE: Microsoft SQL Server Management Studio
    ------------------------------

    Restore failed for Server 'myApp\Advance'.  (Microsoft.SqlServer.SmoExtended)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

    ------------------------------
    ADDITIONAL INFORMATION:

    System.Data.SqlClient.SqlError: File 'c:\Program Files\Microsoft SQL Server\MSSQL10_50.ADVANCE\MSSQL\DATA\MY.mdf' is claimed by 'my7_bio'(3) and 'MY7'(1). The WITH MOVE clause can be used to relocate one or more files. (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&LinkId=20476

    ------------------------------
    BUTTONS:

    OK
    ------------------------------

    Will someone tell me what this error and how do I resolve it?

    Thanks!

    Thursday, July 21, 2011 5:51 PM
  • Hello,

    You are trying to restore a backup of an existing database. In the backup file the origin filename & location is stored as well and by default it's restored to that origin filename.

    Use the MOVE TO option of the restore command to restore the files with a different loaction/name. If you use SSMS to restore change to tab "options" and change the filename/location there.


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing
    Thursday, July 21, 2011 6:06 PM
  • Okay, now I got this error after I change the filename/location via SSSMS.

     

    TITLE: Microsoft SQL Server Management Studio
    ------------------------------

    Restore failed for Server 'MyApp\Advance'.  (Microsoft.SqlServer.SmoExtended)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

    ------------------------------
    ADDITIONAL INFORMATION:

    System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'RE' database. (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&LinkId=20476

    ------------------------------
    BUTTONS:

    OK
    ------------------------------

    Thursday, July 21, 2011 7:12 PM
  • Hi,

    Please go to the Options tab and select the "Overwrite the existing database (WITH REPLACE)" option.

    And in the "Restore the database files as" section, choose  the original database files (.mdf and .ldf files) to replace.

    Then the restore of the database backup taken from another SQL Server will be successfull.

    Hope this helps


    Best Regards,
    Peja

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Friday, July 22, 2011 6:05 AM
  • Hi,

    Please go to the Options tab and select the "Overwrite the existing database (WITH REPLACE)" option.

    And in the "Restore the database files as" section, choose  the original database files (.mdf and .ldf files) to replace.

    Then the restore of the database backup taken from another SQL Server will be successfull.

    Hope this helps


    Best Regards,
    Peja

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    That's exactly what I have and thus, I received the error above. The issue is, I tried to restore this .bak to a different server. Is this possible? I kept getting errors regardless of what options I've tried.

    Monday, July 25, 2011 3:47 PM
  • I followed this instruction with using SSMS and I still got the error below:

    TITLE: Microsoft SQL Server Management Studio
    ------------------------------

    Restore failed for Server 'myComp\Advance'.  (Microsoft.SqlServer.SmoExtended)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

    ------------------------------
    ADDITIONAL INFORMATION:

    System.Data.SqlClient.SqlError: File 'F:\RE\My7Dev.mdf' is claimed by 'My7_bio'(3) and 'My7'(1). The WITH MOVE clause can be used to relocate one or more files. (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&LinkId=20476

    ------------------------------
    BUTTONS:

    OK
    ------------------------------


    Monday, July 25, 2011 4:34 PM
  • Okay, I finally figured it out. It has to do with the same name. I found it in this thread.
    • Marked as answer by Charlie2 Monday, July 25, 2011 5:42 PM
    Monday, July 25, 2011 5:10 PM