Backup Type | Description |
---|---|
Full | 모든 데이터 파일과 트랜잭션 로그의 일부분을 백업한다. |
Transaction log | 로그 파일에 기록된 데이터베이스 변화들을 백업한다. |
Tail-log | 로그의 활성부분(active portion)을 백업한다. |
Differential | The parts of the database that have changed since the last full database backup |
File/Filegroup | Specified files or filegroups |
Partial | The primary filegroup, every read/write filegroup, and any specified read-only filegroups |
Copy-only | The database or log (without affecting the backup sequence) |
Recovery Model | Description |
---|---|
Simple | Uses full or differential copies of the database. Truncates the transaction logs. |
Full | Includes both database backups and transaction log backups. |
Bulk-logged | Includes both database and transaction log backups, but uses less log space for some operations. |
BACKUP DATABASE {database_name | @dtabase_name_var} TO <backup_device> [, ...n] [WITH [FORMAT] [[,] {INIT | NOINIT}] ]
BACKUP LOG {database_name | @database_name_var} TO <backup_device> [, ...n] [WITH [{INIT | NOINIT}] ]
BACKUP DATABASE {database_name | @database_name_var} TO <backup_device> [, ...n] [WITH [DIFFERENTIAL] ]
BACKUP DATABASE {database_name | @database_name_var} [<file_or_filegroup> [, ...n]] TO <backup_device> [, ...n] Where <file_or_filegroup> is: { FILE = {logical_file_name | @logical_file_name_var} | FILEGROUP = {logical_filegroup_name | @logical_filegroup_name_var} }
USE master RESTORE DATABASE AdventureWorks FROM AWBack WITH NORECOVERY RESTORE DATABASE AdventureWorks FROM AWBackDiff WITH RECOVERY
RESTORE DATABASE AdventureWorks FROM AWBack WITH NORECOVERY RESTORE LOG AdventureWorks FROM AWBackLog WITH FILE = 1, NORECOVERY RESTORE LOG AdventureWorks FROM AWBackLog WITH FILE = 2, RECOVERY
Database +--------------------+ Primary filegroup | Primary | online, database -------> Filegrup | available | | | | | | File unavailable, -------> Filegroup A |<------- Restoring file [백업장치(테이프,디스크)] filegroup offline | | | | | | All files available, -------> Filegroup B | filegroup online | | +--------------------+
RESTORE DATABASE AdventureWorks PAGE = '1:610' FROM AWBack WITH NORECOVERY
RESTORE DATABASE AdventureWorks FILE = AW2 FROM AWBack WITH NORECOVERY
RESTORE DATABASE AdventureWorks FILEGROUP = 'DYNAMIC_DATA' FROM AWBackDynamic WITH PARTIAL, NORECOVERY
Source DB Snapshot DB +--------+ +--------+ | +--+ | | | | | | <--------------------------------- SELECT... | +--+ | | | | | Copy-On-Write | | | +--+ | (first time only) | +--+ | UPDATE... --> | | - - - - - - - - - - - -> | | <--- SELECT... | +--+ | | +--+ | +--------+ +--------+
Undelete a row | Insert original data from snapshot |
---|---|
Undo an update | Get original values from snapshot |
Recover a dropped object | Generate script from snapshot, then copy data |
Revert to snapshot | Restore database from snapshot |