现在的位置: 首页 > 综合 > 正文

SqlServer2005自动备份

2012年09月04日 ⁄ 综合 ⁄ 共 294字 ⁄ 字号 评论关闭

1、在服务中启动SQL Server Agent

2、在SqlServer代理中,新建作业,使用Sql语句:

DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ':' , '.')
set @strPath = 'D:\bak\' + @strPath + '.bak'
BACKUP DATABASE [databasename] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT

3、选择频率等

抱歉!评论已关闭.