SQL Server Backup – Backup Files Growing Quickly on SQL Server 2016 Always On Cluster

availability-groupsbackupsql serversql-server-2016

I have a two-node SQL Server 2016 Always On Cluster. I also have a job that updates about 200 records in one table every 3 minutes. Even when there are no updates, it does change a TimestampDt field with the current time.

Previously my backup files were growing at a manageable 10-20 MB per day. However, now that I started making the TimestampDt field updates every 3 minutes (this was a recent change) my backup files are growing at a size of 200 MB per day.

I think that the backup is including the entire transaction log.

Here is the backup SQL Query:

SET @BackupUrl = CONCAT('https://backup.blob.core.windows.net/databasebackup/dbname-',GETDATE(),'.bak');
BACKUP DATABASE dbname
   TO URL = @BackupUrl
   ;

What is the recommended approach here? Should I purge the transaction logs somehow on backup? If so, how can I do that safely in an Always On Availability Group clustered environment?

Any help would be greatly appreciated.

Best Answer

When a database is operating in the FULL recovery model (which yours is, as that's a requirement for AGs), transaction log backups must be taken periodically. Without doing this, the log will grow until it's stopped by hitting the maximum log file size or your storage runs out of space.

You asked:

Should I purge the transaction logs somehow on backup?

Only if you don't care about point in time recovery, which you probably should if you're updating records every 3 minutes.

The recommended approach is to take both full and transaction log backups on a regular schedule, which will keep the TLog at a reasonable size (and probably a lot smaller than it currently is, so at some point you may want to right-size it).

The easiest way to get this up and running is by installing Ola Hallengren's Maintenance Solution, and have it create the Agent jobs to run these backups. This is totally free and used by tens of thousands of DBAs the world over. It's AG-aware as well. Schedule your full and TLog backup jobs to run on a schedule that meets your Recovery Point Objective (RPO) requirements; in my environment, that's full backups daily and TLogs every 15 minutes.