SQL2008备份所有数据库脚本【鸡蛋】
来源:互联网 发布:条形码识别软件 编辑:程序博客网 时间:2024/05/01 14:54
--SQL备份所有数据库脚本
declare @CurrentDataBaseName nvarchar(100)
declare @CurrentBackFolder nvarchar(200)
declare @CurrentBackString nvarchar(2000)
set @CurrentBackFolder='D:\Test'--这里是备份的目录,所有数据库都备份到这个目录
--查询所有数据库名称
--select * from master..sysdatabases where dbid>=7
declare tb cursor local for select name,dbid from master..sysdatabases where dbid>=7;
open tb
fetch next from tb into @CurrentDataBaseName
while @@fetch_status=0
begin
--备份当前查询到的数据库到指定目录
set @CurrentBackString='
USE [master]
BACKUP DATABASE ['+@CurrentDataBaseName+'] TO DISK = '''+ @CurrentBackFolder+'\'+@CurrentDataBaseName+convert(varchar(50),getdate(),112)+'.bak'' WITH NOFORMAT, NOINIT,NAME='''+@CurrentDataBaseName+'-完整 数据库 备份'',SKIP, NOREWIND, NOUNLOAD;';
print @CurrentBackString;
exec sp_executesql @CurrentBackString;
print '备份数据库'+@CurrentDataBaseName +'完成';
fetch next from tb into @CurrentDataBaseName
end
close tb
deallocate tb
print '备份所有数据库完成'
转自:http://blog.csdn.net/xqf222/article/details/7465440
- SQL2008备份所有数据库脚本【鸡蛋】
- SQL2008清除所有数据库日志脚本【鸡蛋】
- SQL备份所有数据库脚本
- SQL备份所有数据库脚本
- sql2008 定时备份数据库
- SQL2008数据库备份类型
- SQL2008定时备份数据库
- SQL2008删除所有数据表脚本
- Sql2008数据库周期性自动备份
- Sql2008数据库周期性自动备份
- SQL2008清除数据库日志脚本
- shell脚本备份mysql里面所有数据库到远程服务器
- 备份mysql所有数据库的每个表的shell脚本
- sql2008备份还原到sql2012数据库
- sql2008生成数据库脚本到sql2005
- 备份所有数据库代码
- 备份所有数据库
- mysql备份所有数据库
- 向前端设计和开发人员推荐10本优秀的免费电子书
- ubuntu 配置 taglist
- Bat命令学习-1
- android 绘制折线图
- SQLSERVER如何快速insert excel中的内容
- SQL2008备份所有数据库脚本【鸡蛋】
- C/C++中volatile关键字详解
- Spring 注解学习手札
- ITeye 2012年10月第2周重要新闻回顾
- iPad 用xib如何创建UISplitViewController应用程序
- 30佳精美纹理(Beautiful Textured)风格网页设计欣赏
- BAT命令大全
- Matrix使用和详细说明
- java md5加密