This article will list out the various types of backups you can create for databases hosted on an SQL Server, explore methods for creating backups manually and automatically, as well as list software/services that may assist you with backing up your data.
If you are seeking information on setting up an SQL Server to store your data in Microvellum, consult this series of tutorial articles on Microvellum’s Knowledge Network:
Different types of SQL Server backups
Full: Backs up everything in the database, including objects, system tables, data, and transactions that occur during the backup. With a full backup, one can restore a database to the exact state it was in when it was backed up. Full backups won’t truncate your transaction log but if your database is in full recovery, you should also consider transaction log backups.
Differential: Retains data that has changed and transactions that have occurred since the last full backup. Differential backups are only useful if used in tandem with a full backup but allow you to delete/remove previous differential backups.
Transaction log: Backs up all the transactions that have occurred since the last log backup or truncation, then truncates the transaction log. This will capture all transaction information, both DML and DDL, that has occurred on the database. With a transaction log backup, you can restore a database to a particular point in time, such as right before a data loss event.
File-group and File: This type of backup is best for larger databases. This type of backup will store all related data in files or file groups (one or more). To use file backups to successfully restore a database, the transaction log also must be backed up to cover all the file groups from beginning to end.
Copy-only: This backup type is usually used on an ad-hoc basis and so as not to disturb any existing process of database backups, since the transaction log copy-backup will ignore the copy backup. Otherwise, this is the same as a full database backup. Copy backups can’t be used for differential backups and transaction log backups.
Manually Backing Up SQL Data
NOTE: The first method of manually backing up your SQL databases relies on SQL Server Management Studio. If you do not have SQL Server Management Studio installed, Microvellum recommends downloading the latest generally available (GA) version from this page.
The most straightforward method of backing up the data in your SQL database is to simply manually do so in SQL Server Management Studio (SSMS). There is a native task in SSMS allowing users to manually back up their data via a simple interface. For information on how to perform this process, consult this
article.
If using SQLCE, an equally simple method to manually back up your data is to locate your data folder, then copy it directly into your backup location via file explorer. Locating your data folder can be done during Toolbox usage by clicking on “Help” then “Browse to Microvellum Data” from the Toolbox interface. Consult this
article for an example of how to back up data locally with this method.
Automating SQL Server Backups
While manually backing up SQL Server databases is an effective method for ensuring data consistency, depending on the size of one’s database, the process might be more laborious and less efficient than one’s workflow might permit. As such, it may be preferable to automate the data backup process. There are different methods for doing this based on one’s software setup:
Maintenance Plans (Standard)
If using a standard SQL Server, one can utilize the SQL Server Agent, a tool that enables a user to set up tasks that can be scheduled to consistently perform, including the backing up of one’s SQL server data. This function is referred to as a maintenance plan. The SSMS has a wizard to walk users through the process from start to finish.
- To set up a maintenance plan, open SSMS, connect to the SQL Server instance, expand the “Management” folder, then right-click the “Maintenance Plans” folder and create a new maintenance plan.
- From the maintenance plan configuration pan, drag the “Back Up Database Task” into the center UI, then open the task to edit it.
- From there, select from the available options what type of SQL backup you want to create (from the options listed above), as well as which databases specifically you would like to be copied, then click “OK”.
- Select the location you intend to store your database backups, then whether you want to create a sub-directory for each database (it is recommended that you enable this option if copying multiple databases).
- Click on the calendar icon, select “Subplan Schedule”. It is recommended to keep the job’s schedule type to “Recurring”. Set the parameters of how frequently you want the backup task to run, the time the task occurs, any start or end point you wish to add to the task and write a description of the task.
- Click “OK” and save the changes you’ve made. Your server will now automatically back up in accordance with your specifications. You can perform all these steps again if you want to set up different types of backups with any other databases on your server in the future.
Task Scheduler (Express)
SQL Express servers do not have access to the SQL Server Agent functions in SSMS, and as such, an alternative method is required to automate the backup process. You will need to create a batch file of Trans-SQL script, then utilize the Windows Task Scheduler to automate it.
NOTE: In SQL Express, to enter a Transact-SQL statement, system procedure, or script file, you will need access to the SQLCMD utility. This is built into the program of all SQL 2014 and lower versions, but if using SQL 2016 or newer, it will be necessary to download the utility. You can download it here.