Automate Log Shipping Failover

3.9k views Asked by At

Is it possible to automate Log Shipping Failover and Recover Secondary Database in Log Shipping, something in Powershell where it checks for are there any more .trn files to be copied, restore all the unapplied transactions and recover secondary database?

2

There are 2 answers

2
gbn On

Log shipping is manual failover: you'd use it for "disaster recovery"

You'd use Database Mirroring for automatic fail-over: this is "high availability".

You can use both though.

So, no, if you want to achieve this you're using the wrong feature of SQL Server

0
Morteza Azizi On

Log Shipping Failover

No automated failover. If automatic failover is required, consider Mirroring instead. To failover: - Stop the jobs

  • Take a tail of the log backup (BACKUP LOG … WITH NO_RECOVERY)

  • Apply tail of the log backup to secondary with a RESTORE LOG ... WITH RECOVERY

  • If required, configure log shipping in reverse direction See this

Allows for rolling patches an upgrades - Upgrade secondary

  • Failover

  • Upgrade the original primary (now secondary)

See this