메뉴 건너뛰기

kode2.com

Database Backup,Restore

2019.02.16 16:03

kode2 조회 수:251

---------------------------------------------------------------------------------------------------------------------------

BACKUP DATABASE [DBName] TO  DISK = N'C:\DBName.BAK' WITH  INIT ,  NOUNLOAD ,  NAME = N'DBName Backup',  NOSKIP ,  STATS = 10,  NOFORMAT

 

-------------------------------------------------------------------------------------------------------------------------- 

RESTORE DATABASE [DBName] FROM DISK = 'C:\DBName.BAK' 
    WITH RECOVERY, 
    MOVE  'DBName' TO 'c:\DBName.mdf',
    MOVE  'DBName_Log'  TO 'c:\DBName_log.ldf'

 

---------------------------------------------------------------------------------------------------------------------------

RESTORE DATABASE [DBName] FROM DISK = 'd:\DBName_201211140600.bak' 

    WITH NORECOVERY,

    MOVE  'DBName' TO 'd:\DBName.mdf',

    MOVE  'DBName_Log'  TO 'd:\DBName_log.LDF'

 

restore log DBNamefrom disk='d:\DBName_backup_201211140800.trn' with noRecovery

 

restore log DBNamefrom disk='d:\DBName_backup_201211141000.trn' with noRecovery

 

restore log DBNamefrom disk='d:\DBName_backup_201211141200.trn' with noRecovery

 

restore log DBNamefrom disk='d:\DBName_backup_201211141400.trn' with noRecovery

 

restore log DBNamefrom disk='d:\DBName_backup_201211141600.trn' with Recovery