1 Ch 11. Backup your data
2 Backup Device An object contain location of backup device Location can be a file or a tape device
3 Create a backup device 1. Expand Server->server objects 2. Right click Backup Device, select New Backup Device 3. Enter Device name as “Device1” 4. Set Destination file to C:\Device1.bak
4 Types of Backups Full backup – backup all data and log files Differential backup – backup all data and logs since last full backup Transaction Log Backup – back up transaction log and clear old logs
5 Create a full backup 1. Right click on test database, select Tasks- >Backup 2. Set backup type = full 3. Under Destination, click Add, select backup device, choose “Device1” as backup destination, click ok to create backup 4. Check for c:\Device1.bak on your harddrive
6 Create a differential backup 1. Add some data to test.test table 2. Right click on test database, select Tasks- >Backup 3. Set backup type = Differential 4. Under Destination, click Add, select backup device, choose “device1” as backup destination, click ok to create backup 5. Right click on device1 backup device, select properties, select “media content”, you should see a list of backups performed.
7 Create a differential backup 1. Add some data to test.test table 2. Right click on test database, select Tasks- >Backup 3. Set backup type = Transaction Log 4. Under Destination, click Add, select backup device, choose “device1” as backup destination, click ok to create backup 5. Right click on device1 backup device, select properties, select “media content”, you should see a list of backups performed.
8 Backup to multiple devices 1. Create another backup device “device2” 2. Right click on test database, select Tasks->Backup 3. Set backup type = Full 4. Under Destination, click Add, select backup device, choose “device2” as backup destination, click ok to create backup. 5. Right click on both backup devices, select properties, select “media content”, you should see both devices contain backups of the database
9 Restore During restore, database is in a inconsistant state and cannot be used You can set Recovery to true when you are done with restore.
10 Restore 1. Delete all data from test.test table 2. Right click on database->tasks->restore database 3. Select backup you would like to restore from 4. Click Option page 5. Make sure recovery state is set to RESTORE WITH RECOVERY 6. Check “overwrite existing database” option 7. Click okay to start restore 8. Go back to test.test, data has been restored
11 Point in time restore Only available with transaction log backup Allows you to restore back to a specific time
12 Point of time restore 1. Create a transaction log backup 2. Modify some data in test.test table 3. Right click on device1, note the last transaction backup time 4. Right click on test database->tasks- >restore->restore database 5. Click on ellipse on point-of-time text box, enter last transaction log backup time 6. Notice test.test has been reverted