Backups are extremely important for the continuity of business. Many companies fire their engineers just because they didnâ€™t have proper backups in place.
Wouldnâ€™t it be great if there was a way that DBAâ€™s and engineers didnâ€™t have to worry about backups and SQL Server was smart enough to perform the backup based on workload pattern (data changes) or based on some defined recovery interval and the backups are auto-magically stored offsite without having to worry about putting them on tapes and then shipping them.
The SQL Server product team has done an awesome job in delivering this new feature that takes away the headache of managing and maintaining database backups. SQL Server Managed Backup automatically performs backups of your databases and stores them to Windows Azure Blob Storage Service.
SQL Server Managed Backups can be enabled at the database or Instance level. With the database level backup, you can only perform managed backup per database. However, if you enable instance level managed backups then you can perform managed backups for all user databases and for any new future databases. (Note: System databases are not currently supported with Managed backups) SQL Server Managed backups can be used for both on premise and hosted environments (ex: VM).
The good thing about SQL Server Managed Backups is that you do not have to specify the type of backup or frequency of the backup. You only specify the retention period which will take care of determining both the type and frequency of the database backup. You can also use the new backup encryption feature introduced in SQL Server 2014 along with SQL Server Managed Backups.
What is a Retention Period?
The retention period is used by SQL Server Managed Backup to determine what backup files should be retained (or left) in the storage so that you can perform a point-in-time recovery of the database. (Currently supported values for retention are 1 thru 30 days)
Note: SQL Server Managed Backup is currently only supported using T-SQL.
Important: Only FULL and LOG backups are currently supported by SQL Server Managed Backups.
Full database backup happens automatically if the following conditions are met:
- SQL Server Managed Backup is enabled at the Database or Instance level.
- T-log has grown >= 1 GB in size since the last full database backup.
- The log chain is broken
- T-Log backup file is deleted (by human / system error)
- Backup files are overwritten with different backups
T-Log Backup happens automatically if the following conditions are met:
- Database has had >=5 MB of T-Log change
- It has beenÂ >= 2 hours since the last Log backup was taken
- Anytime the T-Log backup is lagging behind a full database backup
- T-Log backup history is deleted or is not found
Important things to keep in mind:
- System databases cannot be backed up using SQL Server Managed Backup
- T-SQL and SSMS are both supported for performing SQL Server Managed Backup
- Only Windows Azure Blob Storage Service is currently supported as backup storage option
- Backup size of the database cannot exceed 1 TB in size currently. (you can use backup compression to reduce the backup size)
- Databases must be in either FULL or BULK-LOGGED Recovery model. SQL Server Managed Backup doesnâ€™t support databases with Simple Recovery model.
- Enabling SQL Server Managed Backup at Instance level enables managed backups for new databases but doesnâ€™t enable that for existing databases. You must configure each databases specifically.
- A Windows Azure storage account and a SQL Credential that stores the authentication information to the storage account should both be created before configuring SQL Server Managed Backup to Windows Azure.
Letâ€™s now look at an example on how to perform SQL Server Managed Backup:
To disable instance level backup use the below command:
Let’s now take a look at enabling database level managed backup:
To disable database level managed backup:
Alternatively, you can also use SSMS for performing SQL Server Managed Backups as shown in the below screen.