SQL Backup - Native
Caution
Use the native backup together with a snapshot-based backup ONLY WITH CAUTION! Snapshot-based backups are created by a VM backup software which makes use of "Application-aware" processing. If e.g. your chosen Veeam settings interfere with SQL, SQL differentials or log backups could be linked to a full backup which is not available to SQL, but only to the backup application which created it, rendering those backups unusable. More about this here.
If you want to use SQL native backups even so, below is a general description of how to configure it. The settings (e.g. scheduling) might differ for your company's individual needs, so please, follow the guide with care and planning ahead.
Prerequisites
Repository
You need to have an external repository that is connected to the SQL server where your backup files will be stored. This can be e.g. a NAS attached to the server as an SMB share.
SQL Agent
You need to enable the SQL Server Agent and the Agent XPs component otherwise you'll get an error similar to the one below.
Open SQL Server Management Studio, connect to your server as you usually do.
Click on the + sign next to the server > Management
Right click SQL Server Agent (Agent XPs disabled) > Start
Open the New Query window
Type the following:
SP_CONFIGURE 'SHOW ADVANCE',1
GO
RECONFIGURE WITH OVERRIDE
GO
SP_CONFIGURE 'AGENT XPs',1
GO
RECONFIGURE WITH OVERRIDE
GO
Click Execute
Types of Backups
Full: it includes objects, system tables data, and transactions. With a full backup, you can restore your database to the state, when it was backed up. Full backups won’t truncate your transaction log.
Differential: it retains data since the last full backup. A differential backup is only useful if used together with a regular full backup.
Transaction log: it will backup all of the transactions that have occurred since the last log backup or log truncation, then it will truncate the transaction log.
Maintenance plans
To create a complete maintenance plan for the system, all three backup types need to be used, so there will be 3 different maintenance plans with 3 different schedules.
- Full: weekly, on Saturday, 11 PM
- Differential: daily, except for Saturday, 12 AM
- Transaction log: every 15 minutes.
The times can be different in your scenario depending on your needs, you may set up differentials every 4 hours, and log backups every hour. Please, note that if a backup takes place, no other backups can be started, so if a transaction log backup is set to run every 15 minutes, but takes 20 minutes, it will never allow to run the other backups!
For the 3 types, we'll need to create 3 separate directories on your repositories, one for each.
Configure backups
Full
Click on the + sign next to the server > Management
Right click on Maintenance Plans > Maintenance Plan Wizard
Click Next on the splash screen
On the Plan properties screen:
- Give it a meaningful name
- Choose "Single schedule for the entire plan"
- Click Change next to Schedule and choose the following:
- Occurs Weekly > tick Saturday
- Occurs once at 11:00:00 PM
Click OK and Next in the wizard.
Choose the maintenance tasks: Check Database integrity and Back Up Database (Full)
Leave the order of tasks as it is
Define All databases for the check integrity task
Click Next
Define All databases for the Back up database (Full) task, then click the Destination tab
On the Destination tab, choose Create a sub-directory for each database and define the folder on your external repository dedicated for your full backups, then click the Options tab
On the Options tab set the following:
Set backup compression: Compress backup
Backup will expire after 14 days (or your retention period)
Tick the Verify backup integrity checkbox
Click Next
Leave the defaults on the reporting window and click Next
Click Finish to complete the wizard
Differential
For the differential backup, you need to go through the same process as above for the full backup making the following changes in the configuration.
- Choose a meaningful name
- Specify the schedule:
- Choose Weekly then choose 6 days except for Saturday (when the full backup will run).
- Occur once at 12:00:00 AM
Choose Back Up Database (Differential) from among the tasks
On the Destination tab, choose Create a sub-directory for each database and define the folder on your external repository dedicated for your differential backups
Everything else is the same as for the full backup.
Transaction Log
For the transaction log backup, you need to go through the same process as above for the full backup making the following changes in the configuration.
- Choose a meaningful name
- Specify the schedule:
- Choose Daily
- Occurs every 15 minutes
Choose Back Up Database (Transaction Logs) from the task list
On the Destination tab, choose Create a sub-directory for each database and define the folder on your external repository dedicated for your transaction log backups
Everything else is the same as for the full backup.
When the configuration is done, you'll have 3 maintenance plans:
To have the differentials run properly, first you need to create a full backup. So out of business hours, right click on your Weekly full schedule and choose Execute
No Comments