- T-SQL 語法
TO [備份裝置] [ ,...n ]
MIRROR TO [備份裝置] [ ,...n ]
WITH [DIFFERENTIAL | 各項可用在 WITH 選項]
- 簡易範例
BACKUP DATABASE AdventureWorks
TO DISK = 'C:\Backup Mirror 1\AdventureWorks.bak'
MIRROR TO DISK = 'C:\Backup Mirror 2\AdventureWorks.bak'
WITH FORMAT
BACKUP DATABASE AdventureWorks
TO DISK = 'C:\Backup Mirror 1\AdventureWorks.bak'
MIRROR TO DISK = 'C:\Backup Mirror 2\AdventureWorks.bak'
WITH DIFFERENTIAL
BACKUP LOG AdventureWorks
TO DISK = 'C:\Backup Mirror 1\AdventureWorks.bak'
MIRROR TO DISK = 'C:\Backup Mirror 2\AdventureWorks.bak'
- 利用上述語法產生的備份檔
- 利用 RESTORE LabelOnly 語法可以確定 Mirror To 的數量
RESTORE LabelOnly FROM Disk = N'C:\Backup Mirror 1\AdventureWorks.bak'
- 進行完整備份的備份鏡像的 FORMAT選項
- 備份鏡像最多只能有 4 份
BACKUP DATABASE AdventureWorks
TO DISK = 'C:\Backup Mirror 1\AdventureWorks.bak'
MIRROR TO DISK = 'C:\Backup Mirror 2\AdventureWorks.bak'
MIRROR TO DISK = 'C:\Backup Mirror 3\AdventureWorks.bak'
MIRROR TO DISK = 'C:\Backup Mirror 4\AdventureWorks.bak'
MIRROR TO DISK = 'C:\Backup Mirror 5\AdventureWorks.bak'
WITH FORMAT
- Mirror To 檔案必須跟 To 檔案數量一致
BACKUP DATABASE AdventureWorks
TO DISK = 'C:\Backup Mirror 1\AdventureWorks.bak'
MIRROR TO DISK = 'C:\Backup Mirror 2\AdventureWorks.bak' ,
DISK = 'C:\Backup Mirror 3\AdventureWorks.bak'
WITH FORMAT
- 備份時利用 Mirror To 產生多份備份,但還原時僅需一份備份就可以還原。
- Mirror To 功能無法在 SSMS 的 UI 介面操作,必須利用 T-SQL 語法實現。
- 備份設備必須相同,都是 Disk 或都是 Tape,不可以 Disk 和 Tape 混用來進行 Mirror。
- 只有 SQL Server 2005 Enterprise 和更新版本才提供這個選項。
沒有留言:
張貼留言