MSSQL备份脚本

 declare @name varchar(100)
declare @disk varchar(100)
declare @temp varchar(100)
set @temp=Replace(Replace(Replace(Replace(Convert(varchar(30),GETDATE(),21),':',''),' ',''),'-',''),'.','')
set @name=N'DEMO'+@temp+'-完整 数据库 备份'
set @disk=N'F:\Backup\[full]DEMO'+@temp+'.bak' BACKUP DATABASE [CMDI] TO
DISK = @disk
WITH NOFORMAT, NOINIT, NAME = @name,
SKIP, NOREWIND, NOUNLOAD, STATS = 10 declare @name1 varchar(100)
declare @disk1 varchar(100)
declare @temp1 varchar(100)
set @name1=N'DEMO'+@temp+'-差异 数据库 备份'
set @disk1=N'F:\Backup\[diff]DEMO'+@temp+'.bak'
BACKUP DATABASE [CMDI] TO
DISK = @disk1
WITH DIFFERENTIAL , NOFORMAT, NOINIT, NAME = @name1,
SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
上一篇:Go语言学习笔记五: 条件语句


下一篇:c#用log4Net将日志写入到Oracle数据库,并写入到文件中