320 likes | 395 Views
IT390 Business Database Administration Unit 5 : Backup and Restoring Tasks. 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.
E N D
IT390 Business Database AdministrationUnit 5 :Backup and Restoring Tasks
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.
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
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
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
Activity Julia, the DBA at Ralphsoft Inc., is assigned the responsibility of making backups of critical databases every Friday. How can she perform this task?
Backups • 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
Class Activity • List the tasks that need to done before performing a backup on a critical database.
Performing Backups • In SQL Server 2000, you can perform backups using: • Enterprise Manager • T-SQL • Backup Wizard
Class Activity • List the steps to perform backup using Enterprise Manager (Pages 7.7 – 7.19).
Performing Backup Using T-SQL • 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
Class Activity • 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 (cont) • 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) • List the steps to perform a backup using the Backup wizard.
Recovery • 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 (cont) • The following recovery models are available in SQL Server 2000: • Simple recovery • Full recovery • Bulk-logged
Restoration • 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.
Class Activity • What is achieved by the following T-SQL statement? • RESTORE DATABASE SALES FROM SALES_BACKUPRESTORE LOG saleslog FROM saleslog_backup WITH RECOVERY
Restoring and Rebuilding the Master Database • 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.
Activity • List the steps to rebuild and restore the master database in case of a failure.
Distributed DBMS Architecture • 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.
Database Replication • 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 (cont.) • Different database replication models are used for making replicas of the main database. These models are: • Snapshot • Transactional • Merge
Snapshot Database Replication Model • 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.
Transactional Database Replication Model • 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.
Merge Database Replication Model • 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.
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.
Summary • Did you understand the key points from the Lesson? • Do you have any questions?