Bài giảng Cơ sở dữ liệu nâng cao Chapter 2 Disaster recovery. Chương này trình bày một số nội dung sau Overview about database backup and recovery, backup restore strategy, disaster recovery planning,... Mời các bạn cùng tham khảo.
Trang 1CHAPTER 2
Disaster Recovery
Trang 2Agenda
Trang 3Overview about database backup and recovery
information about its customers, inventory, purchases,
financials, and products
Anything from a user error to a natural disaster could take your database offline Your backup and recovery plan
needs to account for the possibility of these failures and more
Trang 4Overview about database backup and recovery
• Media failure.
• User errors, for example, dropping a table by mistake.
• Hardware failures, for example, a damaged disk drive or permanent loss of a server.
• Natural disasters.
Trang 5Overview about database backup and recovery
to enable you to recover a damaged database
maximizes data availability and minimizes data loss, while considering your particular business requirements.
Trang 6Backup & restore strategy
• The backup strategy defines:
• The type and frequency of backups
• The nature and speed of the hardware that is required for them
• How backups are to be tested
• Where and how backup media is to be stored (including security considerations)
Trang 7Backup & restore strategy
• The restore strategy defines:
• Who is responsible for performing restores
• How restores should be performed to meet the goals
• for availability of the database
• for minimizing data loss
• Designing an effective backup and restore strategy requires careful planning, implementation, and testing
Trang 8Backup method
• Database Engine provides four different backup methods:
• Full database backup
• Diferential backup
• Transaction log backup
• File (or filegroup) backup
Trang 9Backup method
• Full database backup:
• Capture the state of the database at the time the backup is started
• During the full database backup, the system copies the data, the schema of all tables of the database and the corresponding file structures
• Even all uncommitted transactions in the
transaction log are written to the backup media.
Trang 10Backup method
• Differential Backup
• Create a copy of only the parts of the database that have changed since the last full database backup
• The advantage of a differential backup is speed It minimizes the time required to back up a database.
Trang 11Backup method
• Transaction Log Backup:
• Consider only the changes recorded in the log This form of backup is therefore not based on physical parts (pages) of the database, but rather on logical operations - that is, changes executed using the
DML statements INSERT, UPDATE, and DELETE Again, because the amount of data is smaller, this process can be performed significantly quicker than
a full database backup and quicker than a
differential backup.
Trang 12Backup method
• File or Filegroup Backup:
of the entire database
database backup, allowing recovery from a failure that affects only a small subset of the database files
backup to restore individual files or filegroups This
means that you can use database and transaction log backups as your backup procedure and still be able to restore individual files (or filegroups) from the database backup
Trang 13Recovery model
SQL Server database or individual files or filegroups of the database Table-level backups cannot be created
• Simple
• Full
• Bulk Logged
meant for regular use Bulk Logged,is designed to be an adjunct to the Full recovery model
Trang 14Recovery model
log, because the transaction log is not backed up
the lost data
Trang 15Recovery model
• All activities that affect the database are logged in the transaction log.
• The advantage of this full logging is that every transaction can be recovered in the event of a failure.
Trang 16Recovery model
• Log most bulk operations
• For certain large-scale bulk operations such as bulk import or index creation, switching temporarily to the bulk-logged recovery model increases performance and reduces log space consumption.
Trang 17Backup Types
whole database, a partial database, or a set of files or filegroups
• Full backup
• Differential backup
• Transaction log backup
Trang 18Backup Types
• Contain all the data in a specific database or set of filegroups or files, and also enough log to allow for recovering that data.
• based on the latest full backup of the data.
• Contain only the data that has changed since the differential base.
• In Full or Bulk-Logged recovery models