* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download SQL Server Backup - Pearson Education
Survey
Document related concepts
Global serializability wikipedia , lookup
Commitment ordering wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Microsoft Access wikipedia , lookup
Serializability wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Oracle Database wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Functional Database Model wikipedia , lookup
Ingres (database) wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Relational model wikipedia , lookup
Concurrency control wikipedia , lookup
Database model wikipedia , lookup
Transcript
IT390 Business Database Administration Unit 5 : Backup and Restoring Tasks ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 1 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 2 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 3 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 4 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 5 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? ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 6 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 ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 7 Class Activity • List the tasks that need to done before performing a backup on a critical database. ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 8 Performing Backups • In SQL Server 2000, you can perform backups using: Enterprise Manager T-SQL Backup Wizard ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 9 Class Activity • List the steps to perform backup using Enterprise Manager (Pages 7.7 – 7.19). ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 10 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 ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 11 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 ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 12 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. ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 13 Class Activity (cont) • List the steps to perform a backup using the Backup wizard. ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 14 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 ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 15 Recovery (cont) • The following recovery models are available in SQL Server 2000: Simple recovery Full recovery Bulk-logged ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 16 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. ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 17 Class Activity • What is achieved by the following T-SQL statement? RESTORE DATABASE SALES FROM SALES_BACKUPRESTORE LOG saleslog FROM saleslog_backup WITH RECOVERY ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 18 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. ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 19 Activity • List the steps to rebuild and restore the master database in case of a failure. ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 20 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. Location A Location B ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 21 Location C 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 ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 22 ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 23 Database Replication (cont.) • Different database replication models are used for making replicas of the main database. These models are: Snapshot Transactional Merge ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 24 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. Main Database XXXX YYYY XXYY Location A Local Database Location B ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 25 XXXX YYYY XXYY Local Database XXXX YYYY XXYY Location C Snapshot ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 26 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. Main Database Location XXXX YYYY XXYY XXX YYYY A XXYY XXX XXX Local Database XXX YYYY XXYY Location B ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 27 Local Database XXXX YYYY XXYY Location C Transactional……….Changes only ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 28 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. Main Database Main Database XXX YYY XXY XXXX YYYY XXYY XXX YYY ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 29 XXY XXX YYY XXY XXX YYY XXY XXX YYY XXY Continuous Merges may be inefficient ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 30 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 31 Summary Did you understand the key points from the Lesson? Do you have any questions? ©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 32