Restoring Back-Ups into a Different Server

  • Hello,

    This is my first time to restore a backup db from our production db server and to be restored in development server. An error occur when I restore it using the SQL Server management studio. The error is like this: "System.Data.SqlClient.SqlError: Directory lookup for the file "D:\DATA_FILES\OSM_eTech.mdf" failed with the operating system error 21(The device is not ready.). (Microsoft.SqlServer.Smo)"

    Hope there will be someone to help me this out.

     

  • The backups store the path of each file that was backed up, by default a restore will restore these files to the same path.

    The trouble comes when restoring on a different machine where this path does not exist. If you're doing the restore through Sql Managment Studio then you can change the path each file will be restored to by going to the "Options" page and changing the "Restore As" value.

  • while you may find it a little harder to do then using a GUI in SSMS but TSQL is better to this.  I have posted a script that you just need to change the database name and data/log filename and the location you need to restore.  Prior to this you can run the first command to find out about the database file names if you don't know.  For the example I assume that your database name is mydb1.  Once you restore your database in dev environment you may want to change the recovery mode to simple if you don't want/need to take a log backup and prevent the log file growth.

    restore filelistonly from disk= 'c:\mydb1.bak'

    restore database mydb1 from disk = 'c:\mydb1.bak' with

     move 'mydb1_Data' to 'D:\MSSQL\Data\mydb1_Data.mdf',

     move 'mydb1_log' to 'e:\MSSQL\Log\mydb1_Log.ldf';

    if you need to change the recovry mode run this

    Alter database mydb1 Set Recovery Simple

    good day,

    Bulent

  • Thanks, it works.

  • Chris Chilvers (4/26/2007)


    The backups store the path of each file that was backed up, by default a restore will restore these files to the same path.

    The trouble comes when restoring on a different machine where this path does not exist. If you're doing the restore through Sql Managment Studio then you can change the path each file will be restored to by going to the "Options" page and changing the "Restore As" value.

    Thank you SO MUCH for posting this. I was stuck with the same issue and was pulling my hair out because nothing I tried worked.

  • I have something similar, but I need to restore from ServerA to ServerB. Using Restore filelistonly... I've tried: \\serverA\shared drive\folder structure\file --while on ServerB

    restore ...move 'logical' to ...

    folder structure\file on ServerA and then \\ServerB\shared drive\file --while on ServerA

    restore ...move 'logical' to...

    \\ServerB\shared drive\folder structure\file to 'folder structure\file' --while on ServerA

    I've tried various combinations and always with the same results; Operating System Error.

    I'm tired of having to copy a backup from one server to another; how do you restore from one server to another?

  • Please post your exact command you are executing. I have no problem running restore filelistonly against another server using UNC syntax, or any problem with actually restoring a db.

    "Got no time for the jibba jabba!"
    -B.A. Baracus

  • I've got a restore generator script[/url] that will generate a restore (with move) statements. See the section "-- Change these variables:" in the script for the examples.

    This will only generate a script for you to run, it will not execute the restore. Once you have the generated script, you can set any options to whatever you need.

    Your friendly High-Tech Janitor... 🙂

  • Thanks, This works for me. Excellent

  • Thanks dud..it worked..

    I changed the location to a new location and created 2 files(ldf & mdf) and made the owerwriting true...

    great man...

    keep posting

    cheers

    Vivek

  • Hi,

    i have been trying to restore a backup file that i copied from a server that run MSDE to another server that runs Microsoft SQL Server 2005, am actually trying to upgrade from MSDE to MS SQL Server 2005, i have also tried the script option you suggested but am still having the problem.

    The error message is: Msg 314, Level 16, State 4, Line 1

    The backup set holds a backup of a database other than the existing 'XXXXX' database

    Msg 3013, Level 16, State 1, Line 1

    RESt

    ORE DATABASE is terminating abnormally.

    Can somebody pls help?

    Thanks

    Seun

  • Please create a new thread for a new question, don't just tag on to the end of an existing thread.

    In addition, this is a repeat of a post tagged onto another thread - http://www.sqlservercentral.com/Forums/FindPost645834.aspx

    No more replies here please.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I know you posted this a while ago but it was the quick answer I needed.

    Thank you.

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply