Solved

DB Mirroring AND Log Shipping on same db!

Posted on 2013-12-10
6
585 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
Comment Utility
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 76

Expert Comment

by:arnold
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:pae2
Comment Utility
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
Comment Utility
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
Comment Utility
I spent a lot of time answering my own questions and validating my claims. My statements are proven.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

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 …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

763 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

11 Experts available now in Live!

Get 1:1 Help Now