Solved

MS SQL Restore to a different Server with Diffs

Posted on 2014-04-15
6
121 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 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