Search code examples
sql-serverremote-accessdatabase-restore

Restoring an SQL database on a Remote Server


I have remote access to a server, and I want to copy an sql database from my computer to the server.

Both my computer, and the server use Microsoft SQL 2008 R2.

I created a backup of the database on my computer, then copy/Paste it on the remote server. But then when I tried to restore it on the server I get this error:

The media family on device 'c:\Web_Database.bak' is incorrectly formed. SQL Server cannot process this media family.

Any help is appreciated. Thank you


Solution

  • You may have to "Generate Scripts"

    Right click on the database you want to copy / restore.
    Tasks
    Generate Scripts
    Next
    Next ( Do not check the checkbox )
    Scroll down to Table/View Options and set "Script Data" to "true" then click Next
    Check "Tables" - click Next
    Click "select all" - Click Next
    Set your path to generate the script to
    Finish

    Copy the script onto your server
    Open SQL 2008 R2
    Delete your previous attempt at restoring the database - we need a fresh one.
    Create your new database
    Go to the location where you copied your script to and double click on the script - this will automatically open SQL.
    Top line of code where it says "USE [databasename]" - delete this line.
    Next to execute select the drop down and choose the data base you are trying to restore.
    Click Execute.

    Let the query run and then you are done :-)