Solved

MS SQL Restore to a different Server with Diffs

Posted on 2014-04-15
6
118 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
  • 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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 is using more virtual memory. 5 84
Can I convert a numeric string into referenced values with an SQL query? 10 40
SQL Pivot Rows To Columns 10 53
SQL Error - Query 6 25
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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