SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Restoring Back-Ups into a Different Server


Restoring Back-Ups into a Different Server

Author
Message
Maria Carmen Vilbar
Maria Carmen Vilbar
Right there with Babe
Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)

Group: General Forum Members
Points: 795 Visits: 25

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.


Chris Chilvers
Chris Chilvers
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1954 Visits: 215

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.


Bulent Gucuk
Bulent Gucuk
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4774 Visits: 620

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


Maria Carmen Vilbar
Maria Carmen Vilbar
Right there with Babe
Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)Right there with Babe (795 reputation)

Group: General Forum Members
Points: 795 Visits: 25
Thanks, it works.
skorcher
skorcher
SSC-Enthusiastic
SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)

Group: General Forum Members
Points: 103 Visits: 106
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.
Tim Riley-492074
Tim Riley-492074
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1295 Visits: 147
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?
the__t
the__t
Hall of Fame
Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)

Group: General Forum Members
Points: 3000 Visits: 419
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
Gordon-265412
Gordon-265412
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2758 Visits: 1188
I've got a restore generator script 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... Smile
mihir.desai
mihir.desai
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 1
Thanks, This works for me. Excellent
vivek.v-992941
vivek.v-992941
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 2
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum









































































































































































SQLServerCentral


Search