一般的情况下我们会选用SQLServer自带的数据库维护计划来定义备份.
但有些时候,有的机器数据库维护计划不能成功实现备份.
错误原因可能不尽相同,这时我们可以用简单的SQLServer备份脚本来做备份.
生成简单的SQLServer备份脚本的SQL语句:
usemaster
select'backupdatabase'+name+'todisk=''F:sqlserver_backup'+name+'.bak''withinit'fromsysdatabases
-------------------------------------------------------------------------------------------------
backupdatabasemastertodisk='F:sqlserver_backupmaster.bak'withinit
backupdatabasemodeltodisk='F:sqlserver_backupmodel.bak'withinit
backupdatabasemsdbtodisk='F:sqlserver_backupmsdb.bak'withinit
backupdatabasedb_app1todisk='F:sqlserver_backupdb_app1.bak'withinit
backupdatabasedb_app2todisk=F:sqlserver_backupdb_app2.bak'withinit
【简单的SQL Server备份脚本代码】相关文章: