概述
Alwayson在添加數(shù)據(jù)庫的過程中如果同步首選項(xiàng)選擇的是“完整”,那么就會在主副本上執(zhí)行copyonly的完整備份和日志備份在輔助副本上執(zhí)行還原操作,也正是這個(gè)操作讓我對copyonly有了新的理解。雖然以前也經(jīng)常使用copyonly執(zhí)行完整備份,
但是之前對copyonly的理解存在一點(diǎn)誤區(qū)。接下來詳細(xì)說明copyonly的操作。
一、備份測試
CREATE DATABASE city;GOCREATE TABLE city.dbo.test(id INT);---執(zhí)行完整備份BACKUP DATABASE [city] TO DISK = N'D:\backup\city_full_20170613.bak' WITH NOFORMAT, NOINIT, NAME = N'city-完整 數(shù)據(jù)庫 備份', SKIP, NOREWIND, NOUNLOAD, STATS = 10GO--插入1條記錄INSERT INTO city.dbo.test VALUES(1);--執(zhí)行日志備份1BACKUP LOG [city] TO DISK = N'D:\backup\city_log1_20170613.trn' WITH NOFORMAT, NOINIT, NAME = N'city-日志備份1 備份', SKIP, NOREWIND, NOUNLOAD, STATS = 10GOINSERT INTO city.dbo.test VALUES(2);GO--執(zhí)行完整copy only備份BACKUP DATABASE [city] TO DISK = N'D:\backup\city_full_copyonly_20170613.bak' WITH COPY_ONLY, NOFORMAT, NOINIT, NAME = N'city-完整copyonly 數(shù)據(jù)庫 備份', SKIP, NOREWIND, NOUNLOAD, STATS = 10GOINSERT INTO city.dbo.test VALUES(3);--執(zhí)行差異備份BACKUP DATABASE [city] TO DISK = N'D:\backup\city_diff_20170613.bak' WITH DIFFERENTIAL , NOFORMAT, NOINIT, NAME = N'city-差異 數(shù)據(jù)庫 備份', SKIP, NOREWIND, NOUNLOAD, STATS =&n