views:

9

answers:

0

Given that I have to use log shipping and have a lot of databases that need to be failed over does anyone have any T-SQL/Powershell code for MS SQL Server 2005 that can automate that failover process as much as possible?

These are the steps it would need to cover (or as many as possible):

  1. Attempt to backup the transaction log one last time if the source database is still available.
  2. Copy all transaction log backups that haven't been copied from the source to the target server.
  3. Restore all transaction log backups except the last backup using NO RECOVERY option.
  4. Restore the last transaction log backup using WITH RECOVERY option.