Sql-server – Breaking transaction log chain with backups

sql server

I've been nominated to maintain a SQL Server with log shipping on it. Once a week, indexes are rebuilt, and then a backup is taken. Last week, the maintenance plan that rebuilds indexes failed to run correctly and so the backup didn't occur. The next transaction log was 4x bigger than the backup would have been, filled out all the remaining space on the server and threw our whole log shipping off course for a day.

Looking into transaction logs in more detail (I am a developer, not a DBA), I've discovered that I was wrong in my belief that the backup stopped the transaction log being huge after an index rebuild. What it turned out to be was a SQL script at the end of the maintenance plan that makes the database recovery mode simple, shrinks it, then changes it back to full.

Am I correct in assuming that this breaks the transaction log chain, and causes the first full backup after that starts transaction logs from itself – and that any database backup through the week (we backup every morning) can be ignored in favour of just applying transaction logs to this weekly backup instead?

Best Answer

You are correct, changing the logging level to simple and back invalidates the log chain requiring a full backup to be taken.

You should remove this switch and the log file shrink command. Just backup the log and have the log changes be applied to the log shipping destination server.

Every time you change the recovery model of the database from full to simple and back the log shipping operation has to start over again by restoring the full backup. If you don't change the recovery model you never need to restore the full backup to the destination server after the first time.

Related Topic