Backup and restore SQL 2008 - Part 1

Don Schlichting

TipsMake.com - In this article, we will introduce you to backup and restore SQL Server database. In addition to introducing standard backup options like Full Backups and Differential Backups, new SQL Server 2008 features like Backup Compression will also be introduced in this series. Backup from SQL Server Management Studio as well as from the command line utility. There is also a backup of the system database for users who have created databases. Scheduled Backups are reviewed, checking the security and logon issues related to transferring the database from the test server to the production machine.

Full Backup

To begin, we begin with an introduction to Full Backups, Full Backups can be understood as the simplest way to provide a complete backup solution. Full Backup will create a file containing the entire database, including Transaction Logs. (In the next section, we will introduce Transaction Logs and Recovery Models recovery models.) When viewing a database from within SQL Server Management Studio Object Explorer, you will encounter a number of different objects such as Tables, Views, Stored Procedures and Security.

Backup and restore SQL 2008 - Part 1 Picture 1

All of these objects are included within a full SQL Server backup file. To create a backup, click on the database, select Tasks and then click Backup. This will bring up the ' Back Up Database ' window with the General settings. The source will be filled in with the database you selected. Make sure the ' Full ' option has to be selected for this backup type.

Backup and restore SQL 2008 - Part 1 Picture 2

The other options like Differential and Transaction Log will also be introduced in the following section. In the Backup Component, select Database .

Backup and restore SQL 2008 - Part 1 Picture 3

Another option button is ' Files and Filegroups ' which is also used when the database has been created to expand into multiple files on the operating system. This problem is sometimes done on very large databases to increase performance issues. If you are in this case, select the database that has any and all Filegroup.

Next, name the backup and its description.

The next section ' Backup set will expire ' can be used when backing up to tape or creating backup groups ' Media Sets '. In this example, we will backup to a hard drive so by default it will be 'after 0' days.

The last option on this screen locates the location for backup. By default, SQL Server will put all backups into the MSSQLBackup folder. Backups end with an extension of .BAK. Although this is not necessary, you should note that there are many target files that can be specified as shown below.

Backup and restore SQL 2008 - Part 1 Picture 4

This can allow SQL backups to spread across other hard disks. In the above example, both files are required for Restore. This technique can also be used to extend backups on multiple tapes when your environment is too small to hold the entire database on a tape.

To check options, select ' Options ' from the top right menu.

Backup and restore SQL 2008 - Part 1 Picture 5

The first set of options is labeled ' Overwrite Media '.

Backup and restore SQL 2008 - Part 1 Picture 6

This volume is typically used when backing up to tape. When backing up to the hard drive, if you use a unique name for your backup on the previous screen, these options can be ignored. If the backup name is not unique, select the ' Overwrite All existing backup sets ' button. This will create a file with only the most recent backup in it. When you want to restore from this file, you will be prompted to choose which backup settings to reside to restore.

In the next section, ' Reliability ', select ' Verify backup when finished ' to make sure your backup is valid.

The Transaction Log section will be displayed in gray because the Full Backup will automatically remove the log file.

The final section contains options for compression (only for SQL Server 2008). Compression compression is a new feature in SQL Server 2008. It can reduce up to 20% of the physical size of the original file. If this feature is used, Restore will automatically recognize this compressed file. However, one weakness of this feature is that it takes up a lot of computer resources during the backup process.

Click the OK button in the lower right corner to start the backup process. When the backup is complete, a message will appear saying that the process is complete.

Command line

Backup can also be done from the command line or by script. To execute a backup using TSQL, open a new Query Window (To open Query Window, from Management Studio, click the New Query button in the upper right corner). The following command will execute Full backup to the hard drive.

BACKUP DATABASE AdventureWorksLT2008
TO DISK = 'C: Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLBackuptest.bak'
WITH FORMAT;

The backup statement starts by specifying the backup database. However, there is no way to back up all databases that can only be performed separately. We will introduce you to a simple script and a task in which all the databases are grouped. The next statement specifies that we will backup to the disk and the destination of the file. If we backup to tape, use ' To TAPE ' instead of ' To Disk '. Finally, ' With Format ' means creating a new file. Without the last statement if the backup already exists, your new backup will append to it.

Conclude

There are indeed many options and different types of backups for SQL Server, but Full Backup will still be the option that contains all the objects related to a database. In the next part of this article series, I will cover database recovery as well as checking Transaction Logs, Recovery Methods and other backup options and how to manage them.

4 ★ | 1 Vote

May be interested

  • How to backup and restore bookmarks on Coc CocHow to backup and restore bookmarks on Coc Coc
    in the course of browsing you often use bookmarks to save your favorite websites. so you will not have to search those sites again when browsing. the following article details how to backup and restore bookmark on coc coc.
  • Delete log information in Windows Server BackupDelete log information in Windows Server Backup
    windows server backup is one of windows server 2008 / r2's useful features that allows users to easily back up, restore files, data and other important components in the system like system state, full server or the entire hard drive according to user needs. after such processes, windows server backup will display the files
  • How to backup and restore all Firefox data with ProfileHow to backup and restore all Firefox data with Profile
    when we use firefox on many different computers and want them to have all the features that we previously installed on the original computer, we will force you to backup your data and restore them. on firefox the most common way to backup and restore is to copy the firefox data folder on your computer.
  • How to Backup and Restore data on iPhone, iPadHow to Backup and Restore data on iPhone, iPad
    how to backup and restore data on iphone, ipad. one drawback on apple mobile devices is that they do not support memory cards and we cannot copy data to a memory card and store it on our computer. however, there are ways to backup and restore data easily on iphone and ipad
  • Backup and restore passwords on Coc CocBackup and restore passwords on Coc Coc
    how to backup and restore passwords saved on coc coc browser. please follow along with the following tutorial of tipsmake.com
  • Top 3 best software for free PC driver backup and restoreTop 3 best software for free PC driver backup and restore
    top 3 best software for free pc driver backup and restore. for those who do not know much about computers, installing enough drivers for stable operation is a difficult problem. today, the software tips will introduce to you the top 3 best software to back up and restore computer driver.
  • Guide to backup and restore device drivers in WindowsGuide to backup and restore device drivers in Windows
    it's a good idea to back up your device drivers before performing a clean install to make it easy to restore any of these drivers if needed later. this guide will show you how to back up and restore all 3rd party device drivers on a windows 10 pc.
  • How to backup and restore Skype contactsHow to backup and restore Skype contacts
    when performing a backup of skype contacts, users can easily find their friends' accounts in the list, by restoring the contacts file.
  • Steps to Backup and Restore Windows 10 Driver with 1 command line in cmdSteps to Backup and Restore Windows 10 Driver with 1 command line in cmd
    backup and restore windows 10 driver with a single command. instructions for backing up and restoring computer drivers effectively
  • How to back up and restore drivers in Windows 10, backup and restore drivers in Windows 10How to back up and restore drivers in Windows 10, backup and restore drivers in Windows 10
    back up the driver version to facilitate the installation process. the following article details how to backup and restore drivers in windows 10, backup and restore drivers in windows 10