Home > Database > Mysql Tutorial > 简单的SQL Server备份脚本代码

简单的SQL Server备份脚本代码

WBOY
Release: 2016-06-07 17:57:16
Original
1058 people have browsed it

简单的SQL Server备份脚本代码

一般的情况下我们会选用SQL Server自带的数据库维护计划来定义备份.
但有些时候,有的机器数据库维护计划不能成功实现备份.
错误原因可能不尽相同, 这时我们可以用简单的SQL Server备份脚本来做备份.
生成简单的SQL Server备份脚本的SQL语句:
use master
select 'backup database '+name+' to disk=''F:\sqlserver_backup\'+name+'.bak'' with init' from sysdatabases
-------------------------------------------------------------------------------------------------
backup database master to disk='F:\sqlserver_backup\master.bak' with init
backup database model to disk='F:\sqlserver_backup\model.bak' with init
backup database msdb to disk='F:\sqlserver_backup\msdb.bak' with init
backup database db_app1 to disk='F:\sqlserver_backup\db_app1.bak' with init
backup database db_app2 to disk=F:\sqlserver_backup\db_app2.bak' with init
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template