Solved

DB Mirroring AND Log Shipping on same db!

Posted on 2013-12-10
6
603 Views
Last Modified: 2014-01-30
I'm currently employing Database Mirroring in High Safety Mode without Automatic Failover on a SQL Server 2008R2 machine for eighteen high-volume OLTP databases. The architecture is comprised of a Principal and Mirror without a Witness. All of that works well. As an HA/DR solution we're looking get our log backups onto the mirror via Log Shipping.

I've read that DB Mirroring and Log Shipping can operate on the same DBs. But I can't find a whole lot of info describing what both can achieve while both operate on the same DB. With DB Mirroring in High Safety Mode, transactions are sent to the mirror added to the transaction log, persisted to the mirror's disk and then committed to the principal's log and disk. So this is pretty much real-time.

When running Log Shipping on the same DB that employs DB Mirroring, the DB Mirroring Principal is also the Log Shipping Primary and the DB Mirroring Mirror is also the Log Shipping Primary/Standby.

After the Log Shipping backs-up the Principal/Primary is the log first truncated on the Mirroring Mirror / Log Shipping Standby and then the Principal/Primary log or vice-versa?

How does the restore work when employing DB Mirroring and Log Shipping on the same DB? This confuses me especially because mirroring is up-to-the-second.

I've already read this: http://technet.microsoft.com/en-us/library/ms187016%28v=sql.105%29.aspx.

If you have experience with this please respond!

Thanks!

pae2
0
Comment
Question by:pae2
6 Comments
 
LVL 32

Expert Comment

by:Daniel Wilson
ID: 39711492
I haven't set this up ... but having read your scenario and the article you link, I think I understand the scenario.

Your mirror gives you a near-real-time, completely consistent 2nd copy of the DB to which you can fail over during production, should that be needed.  As such, it will assume the role of being the log shipping primary in the event of a failover.

The log shipping recipients become eventually consistent with the primary, serving both as read-only partners and emergency backup sources.

The emergency that requires you to restore from a log shipping partner is an extreme situation in which both the primary and the mirror failed.  As far as I can tell, you would need to re-establish the mirror and log shipping after that restoration.  I can't see any way that a log-shipping recipient could be restored and automatically assume the role of the master.
0
 
LVL 77

Expert Comment

by:arnold
ID: 39711665
The difficulty I am having in understaning what third system is used for the log shipping destination.
Principal/mirror
Primary log shipper to third system.

Log shipping from the mirror would likely need to be established on failover.

Your question seems to suggest that the mirroring and log shipping are going to the same set of systems.
0
 
LVL 24

Expert Comment

by:DBAduck - Ben Miller
ID: 39722936
You can combine Mirroring and LogShipping as illustrated in the article, but your description seems to imply that you can have mirroring and log shipping to the same target.  That would not make sense.

The way the combining works is that you have a Primary Mirror and it mirrors to the secondary, you can use the Primary Mirror in a log shipping scenario to another secondary not the same one that is the Secondary mirror.  So if you have another target for the restore of the log shipping then you are OK.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:pae2
ID: 39809432
arnold/dbaduck, we are using mirroring and log shipping on the same machines i.e. two machines. Machine-1 is the mirroring principal and the log shipping primary. Machine-2 is the mirroring mirror and the log shipping secondary. Our goal is to simply copy over our log backups to our secondary so that we have two copies of our logs backups (one local and one on the mirror/secondary) until our long-term backup storage application grabs those logs from the mirror/secondary. Then we delete those log backups, i.e. both locally and on the mirror/secondary. The architecture works and is very applicable in achieving our goal. Thanks for the effort.
0
 

Accepted Solution

by:
pae2 earned 0 total points
ID: 39809433
I've done some experimenting with this and have validated the following functionality. If you have mirroring and log shipping running on a primary server and a secondary server and then mirroring is paused or stops running, and then a log backup executes while mirroring is paused/not running (but the mirroring session still exists) the log is NOT truncated. In essence, while a mirroring session exists (despite not running at the time), the log will NOT be truncated by a log backup! Once mirroring is dropped completely, the log will then truncate during a log backup, which is normal. So it really doesn't matter which log is truncated first while mirroring is running. And it won't truncate while mirroring isn't running (but the session exists) so the logs will always be synched.

If you need to restore via log shipping because mirroring failed, you can restore a full db w/no recovery, by overwriting the current db or creating a new db. During that time, take a tail-log backup, then you can restore the log shipping logs w/no recovery, and then restore the tail of the log w/recovery to get the db up-to-date and online. Then enable db mirroring.
0
 

Author Closing Comment

by:pae2
ID: 39820341
I spent a lot of time answering my own questions and validating my claims. My statements are proven.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

895 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now