©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 1
IT390 Business Database AdministrationUnit 5 :Backup and Restoring Tasks
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 2
Objectives
• Backup, Recover and Replicate a Microsoft SQL Database Server.
• Implement database backup in SQL Server 2000.• Explain the importance of database restoration in SQL Server
2000.• Explain various database recovery models in SQL Server 2000.• Restore and rebuild a master database.• Explain the process and features of Replication.
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 3
SQL Server Backup
• SQL Server supports several types of backup: A complete backup makes a copy of the entire
database A differential backup makes a copy of the database
changes since the last complete backup Differential backups are faster and can be taken more
frequently Complete backups are simpler to use for recovery
• The transaction log also needs to be periodically backed up
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 4
Database Recovery
• Both data and log files are created by SQL Server• SQL Server provides a wizard for setting up database
maintenance plan, e.g., scheduling database and log backups
• To recover a database with SQL Server: The database is restored from a prior database
backup Log after images are applied to the restored database At the end of the log, changes from any transaction
that failed to commit are then rolled back
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 5
SQL Server Recovery Models
• Three recovery models Simple recovery: neither logging is done nor log
records applied:• To recover a database is to restore the database to the
last backup
• This method can be used for a database that is never changed
Full recovery: all database changes are logged Bulk-logged: all changes are logged except
those that cause large log entries
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 6
Julia, the DBA at Ralphsoft Inc., is assigned the responsibility of making backups of critical databases every Friday.
How can she perform this task?
Activity
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 7
• A backup of a database is another copy of the database stored in another physical location, which may be a disk or a tape.
• In SQL Server 2000, you can make the following backups:
Full backup Differential backup Transaction Log backup File Group backup
Backups
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 8
• List the tasks that need to done before performing a backup on a critical database.
Class Activity
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 9
• In SQL Server 2000, you can perform backups using:
Enterprise Manager
T-SQL
Backup Wizard
Performing Backups
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 10
• List the steps to perform backup using Enterprise Manager (Pages 7.7 – 7.19).
Class Activity
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 11
• You can perform a backup using T-SQL in the following manner:
EXEC sp_addumpdevice 'disk', 'master_backup',
'c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\ masterbackup.bak'
BACKUP DATABASE master TO master_backup WITH INIT
Performing Backup Using T-SQL
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 12
• What is the output of the following T-SQL statement?
EXEC sp_addumpdevice 'disk', 'Inventorylog', ‘C:\BACKUPS\inventory_backup.dat‘ BACKUP LOG inventory TO Inventorylog
Class Activity
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 13
• Write the command to create a backup for the Employee database named Employee_backup.
• The backup must be stored on a disk device named empbackup at the location, C:\Backups\empbackup.bak.
Class Activity (cont)
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 14
• List the steps to perform a backup using the Backup wizard.
Class Activity (cont)
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 15
• Recovery is a method provided by SQL Server 2000 to restore the database that you backed up.
• You can recover your data from any of the following types of failures:
Permanent loss of servers
Media failures
User errors
Recovery
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 16
• The following recovery models are available in SQL Server 2000:
Simple recovery Full recovery Bulk-logged
Recovery (cont)
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 17
• SQL Server provides the following options to restore a database:
Restore the database and its transaction log. Restore from a full database backup to a differential
backup. Restore from a file group backup.
Restoration
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 18
• What is achieved by the following T-SQL statement?
RESTORE DATABASE SALES FROM SALES_BACKUPRESTORE LOG saleslog FROM saleslog_backup WITH RECOVERY
Class Activity
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 19
• The master database stores various types of configuration information about SQL Server and all the user-defined databases.
• SQL Server provides a utility called rebuildm to rebuild the master database.
• You cannot rebuild the master database if you do not have its backup.
Restoring and Rebuilding the Master Database
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 20
• List the steps to rebuild and restore the master database in case of a failure.
Activity
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 21
• In a distributed DBMS environment, multiple copies of a database are maintained across geographical regions. Data is generally stored in a region or department where it is needed the most.
Distributed DBMS Architecture
Location A
Location B Location C
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 22
• Database replication is the process of making the copies of a database available to different database users spanning across different locations. Data is replicated for:
Data sharing Reduction in network traffic Database backup
Database Replication
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 23
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 24
• Different database replication models are used for making replicas of the main database. These models are:
Snapshot Transactional Merge
Database Replication (cont.)
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 25
• In the snapshot database replication model, the replica of the main database consists of an exact copy of the data and database objects present in the central database at any point in time.
Snapshot Database Replication Model
Location A
Location B Location C
M ain D atabase
Local D atabase
Local D atabase
XXXX
YY YYXXY Y
XXXX
YY YYXXY Y
XXXX
YY YYXXY Y
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 26
Snapshot
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 27
• The transactional replication model is used in organizations where data needs to be replicated as soon as transactions take place or as data gets modified in the central database.
Transactional Database Replication Model
Location A
Location B Location C
M ain D atabase
Local D atabase
Local D atabase
XXXYY YYXXY Y
XXXX
YYYYXXYY
XXX
XXX
XXXX
YYYYXXYY XXX
YY YYXXY Y
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 28
Transactional……….Changes only
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 29
• The merge database replication model is used by organizations in which local users can modify the local database copies without simultaneously updating the central database.
Merge Database Replication Model
M ain D atabase
M ain D atabase
XXXX
Y Y Y YXXY Y
XXX
YYYXXY
XXX
YYYXXY
XXX
YYYXXY
XXX
YYYXXY
XXXYYY
XXY
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 30
Continuous Merges may be inefficient
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 31
Summary
• Creating a Backup and Managing a restore with Transact SQL and Enterprise Manager is a key skill
• Database restoration is a key procedure in case of failure. A business cannot afford to lose their data
• There are several options for backing up and recovering databases.
• Replication is the maintenance of data at multiple sites. There are several methods to replicate data.
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 32
Did you understand the key points from the Lesson?
Do you have any questions?
Summary
Top Related