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 = 'D:\bak\' + 'databasename'+@strPath + '.bak'
BACKUP DATABASE [databasename] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT

(D:\bak\改为自己的备份路径,databasename修改为想备份的数据库的名称)

6、添加计划,设置频率,时间等。

确定,完成。

相关文章:

  • 2021-11-18
  • 2021-08-17
  • 2021-10-28
  • 2021-06-16
  • 2022-12-23
  • 2021-11-04
  • 2022-01-25
猜你喜欢
  • 2021-12-03
  • 2021-09-29
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2021-08-05
相关资源
相似解决方案