Solved

MS SQL Restore to a different Server with Diffs

Posted on 2014-04-15
6
125 Views
Last Modified: 2014-04-15
Hi Experts,
I'm creating a script to drop a database and restore with the latest diff file, but I'm having difficulty with the diff. I can manage to drop and restore the database with the full backup. See below at the code.

USE master
--GO
--ALTER DATABASE Live1 SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
--DROP DATABASE Live1;
--RESTORE DATABASE Live1 FROM DISK='C:\Users\test\Desktop\Full Database.bak'  
--WITH NORECOVERY
--MOVE 'MDF' TO 'C:\testdata\Test.mdf',
--MOVE 'Log' TO 'C:\testdata\Test_log.ldf',
--MOVE 'FullText' TO 'C:\testdata\Test_log.ndf'
GO
--RESTORE DATABASE Live1 FROM DISK='C:\Users\test\Desktop\DIFF.bak'
--WITH RECOVERY
--MOVE 'Data' TO 'C:\testdata\Test.mdf',
--MOVE 'Log' TO 'C:\testdata\Test_log.ldf',
--MOVE 'FullText' TO 'C:\testdata\Test_log.ndf'

Thanks,
J
0
Comment
Question by:johnojohno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 40001484
Just a guess, based on reading MS website on differential restores, but I don't believe you need the MOVE statements. However, are you receiving an error? If so, what is it?
0
 

Author Comment

by:johnojohno
ID: 40001512
Hi Shaun,

I need the move statements as I'm restoring them on a different server.
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 40001517
As stated by Shaun Kline, you don't need the MOVE statements for the Diff as you are restoring to an existing database. The MOVE statements in the database restore are what will physically relocate the files.

What is the problem you are currently having?
0
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 

Author Comment

by:johnojohno
ID: 40001522
When I place the norecovery option it errors on the Move.
Incorrect syntax near 'MOVE'
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 100 total points
ID: 40001527
You need a comma after NORECOVERY. Each WITH clause needs to be comma separated.
0
 

Author Comment

by:johnojohno
ID: 40001636
Carl many thanks buddy! That worked like a charm. :)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server maintenance plan 8 61
Parsing this XML works but the other one doesn't 9 35
Linked Server - SP with Param to VIew 7 29
SQL Server Express or Standard? 5 60
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question