SQLSERVER20008 完整备份和差异备份

时间:2021-11-30 14:01:20
--差异备份 DIFFERENTIAL
declare @name varchar(250)
set @name='F:\Backup\testbackup_'+ convert(varchar(50),getdate(),112)+'.bak'
BACKUP DATABASE [testbackup] TO DISK=@name
WITH DIFFERENTIAL, NOFORMAT, NOINIT,
NAME = N'testbackup-数据库差异备份',
SKIP, NOREWIND, NOUNLOAD
--完整备份 DIFFERENTIAL
declare @name varchar(250)
set @name='F:\Backup\testbackup_'+ convert(varchar(50),getdate(),112)+'.bak'
BACKUP DATABASE [testbackup] TO DISK=@name
WITH NOFORMAT, NOINIT,
NAME = N'testbackup-数据库完整备份',
SKIP, NOREWIND, NOUNLOAD

以上代码可以放入SQLSERVER Agent的作业中 设置计划后可自动执行