一。SqlServer自动作业备份
1、打开SQL Server Management Studio
2、启动SQL Server代理
3、点击作业->新建作业
4、"常规"中输入作业的名称
5、新建步骤,类型选T-SQL,在下面的命令中输入下面语句
DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath=replace(@strPath,'-','')
set @strPath=replace(@strPath,' ','')
set @strPath=replace(@strPath,':','')
set @strPath=substring(@strPath,0,13)
set @strPath = 'D:/DataBack/' + DBName'+@strPath + '.bak'
BACKUP DATABASE [DBName] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
(D:/DataBack/改为自己的备份路径,DBName修改为想备份的数据库的名称)
6、添加计划,设置频率,时间等。
确定,完成。