It is important to back up your SQL Server database in order to protect your data. The critical part to know is that restoring from backup is your opportunity to recover your data from an earlier backup point, should you make a mistake. Unfortunately, backups can take up a significant amount of computer power and storage space. In our experience, that means companies are more likely to take a gamble on skipping backups.
The good news is that Microsoft is offering backup compression available in standard and higher editions of SQL Server. For wary SQL backup runners, the only difference in a compressed backup is that it contains a smaller backup file—which means, of course, quicker backups.
Better yet, SQL Server is making it easier than ever because it takes no special commands to recover from a compressed backup and processes the recovery efficiently.
Some of the benefits you will gain are:
- Smaller file saves on disk space
- The time it takes to do backups is reduced in a disk IO
If you’re still wary of the amount of CPU backups consume, there’s even more good news.
It is true that compression can take significant CPU time, depending on the size of the file. There are ways to address this. Most companies that are concerned about backup consumption have a window they use each night where things like backup and maintenance occur. SQL backups can be run at this time, and CPU-intensive operations can take effect and not impact normal business processes. Even if your company is running low on compression that night, it will not impact the normal business operations or be of concern.
If your company is running transaction log backups that happen every hour of the day and keeping them compressed, then they have the potential to consume additional CPU. This could be of concern to your database server. The good thing is, transaction log backups are NEVER compressed, so there is no reason to be worried.
Here are a couple of ways to run a full database backup with compression:
Run an TSQL command
This is the TSQL command to do a full database backup with compression:
BACKUP DATABASE model
TO DISK = ‘C:\mssql\backups\model_YYYYMMDD_HHMMSS.bak’
WITH COMPRESSION
Run a SQL Server Management Studio option
Here’s the SQL Server Management Studio option needed to do a FULL DATABASE BACKUP with compression:
In the OPTIONS tab, lower right there is a drop-down that looks like this:
Select “Compress backup”
For most SQL Server environments, backup compression is a good option to turn on.
Want to know how much space you are saving from using backup compression? Simply execute this statement in the SQL Server Management Studio Query window:
SELECT database_name as [name], backup_size as [backup in bytes],
compressed_backup_size as [compressed in bytes],
backup_size – compressed_backup_size as [savings in bytes],
backup_start_date as [date]
FROM msdb..backupset
WHERE type = ‘D’ and backup_size <> compressed_backup_size
order by database_name, backup_finish_date desc
Additional information to keep in mind:
Each FULL DATABASE BACKUP with compression - it will tell you the uncompressed backup size, the compressed backup size and the amount of space saved for that backup.
The list is ordered by database name, then lists all the FULL DATABASE BACKUPS with compression in order, beginning with the most recent backup.
If you have additional questions about database backups, feel free to contact us here, or connect with one of our Myappsanywhere partners.
by Myappsanywhere