sqlserver 較大數據庫備份方法

DECLARE @CurrentTime VARCHAR(50), @FileName VARCHAR(200),@FileName2 VARCHAR(200)
,@FileName3 VARCHAR(200),@FileName4 VARCHAR(200),@FileName5 VARCHAR(200)
SET @CurrentTime = REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR, GETDATE(), 120 ),'-','_'),' ','_'),':','')

        
--(Temp2 數據庫完整備份)
SET @FileName = 'F:\Temp2_FullBackup_Partial1_' + @CurrentTime+'.bak'
SET @FileName2 = 'F:\Temp2_FullBackup_Partial2_' + @CurrentTime+'.bak'
SET @FileName3 = 'F:\Temp2_FullBackup_Partial3_' + @CurrentTime+'.bak'
SET @FileName4 = 'F:\Temp2_FullBackup_Partial4_' + @CurrentTime+'.bak'
SET @FileName5 = 'F:\Temp2_FullBackup_Partial5_' + @CurrentTime+'.bak'

BACKUP DATABASE [gongwuyuan]
TO 
DISK=@FileName,
DISK=@FileName2,
DISK=@FileName3,
DISK=@FileName4,
DISK=@FileName5
WITH FORMAT

將數據庫備份爲幾份便就分紅幾個數據組。盤符可指定爲任意盤符,還原數據庫時候,將全部備份文件一次性添加到備份位置下,以下圖數據庫

相關文章
相關標籤/搜索