惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - EricWen

IntelliJ IDEA 2024 安装与激活全攻略 Excel高手秘籍:50招助你效率翻倍 Navicat与DBeaver:数据库管理工具界的“蝙蝠侠”与“钢铁侠” 十年沉淀,重启开发之路 外网不能访问部署在虚机的NodeJs网站(80端口) Common Issues Which Cause Roles to Recycle How to remove a batch of VMs and related Disks How to create a batch of VMs with PowerShell How to build windows azure PowerShell Source Code 如何快速从一个Storage Account拷贝到另一个账号 比较Windows Azure 网站(Web Sites), 云服务(Cloud Services)and 虚机(Virtual Machines) Windows Azure 云服务角色架构 如何批量删除虚拟机及其关联的存储(Windows Azure) PowerShell Script to Deploy Multiple VM on Azure in Parallel #azure #powershell Use Windows Azure AD to create SSO projects 怎样提高Windows Azure Cloud Service中的WebRole的文件访问权限 Windows Azure 名词定义(Glossary) 怎样将SQL Azure数据库备份到本地或者Storage 数据库SQL Server DAC 导入导出数据到SQL Azure问题
自动备份SQL数据库到云存储Storage
EricWen · 2013-11-21 · via 博客园 - EricWen

如何自动备份SQL数据库到Storage呢。

前提条件需要SQL Server2012 SP1 CU2或更高版本

1. 备份SQL Azure数据库到云存储Storage

1)在SQL Server Management Studio中创建Storage存储身份认证

创建Storage身份认证信息脚本样例如下:

IF NOT EXISTS

(SELECT * FROM sys.credentials

WHERE credential_identity = 'mycredential')

CREATE CREDENTIAL mycredential WITH IDENTITY = 'mystorageaccount'

,SECRET = '<storage access key>' ;

2)从数据库导出数据包文件*.BACPAC,并存储到Storage的blob中。

脚本样例如下:

BACKUP DATABASE AdventureWorks2012

TO URL = 'https://mystorageaccount.blob.core.windows.net/mycontainer/AdventureWorks2012.bak'

      WITH CREDENTIAL = 'mycredential'

     ,COMPRESSION

     ,STATS = 5;

GO

上面两步使用的TSQL语句可以用在SQL脚本(如存储过程)或者开发编程(如C#调用)中使用,达到导出数据包BACPAC文件到Storage的目的。

2. 自动备份数据库

1)可以使用Task Scheduler创建计划(Schedule)运行脚本或者程序

2)可以开发编程并发布Windows Azure Worker Role到云服务上定时运行脚本

关于怎样使用Task Scheduler来备份数据,可以参考:http://support.microsoft.com/kb/2019698

注意:

  1. 在创建计划或者开发程序,并设置特定的时间来运行,两次运行的时间要合理定义,不要在上次任务没运行前启动下次任务。这个时间段取决于数据库的大小和数据服务器负载的情况。
  2. 使用异常处理机制和重试(Retry)机制来避免错误,例如超时。
  3. 在设定重试逻辑的时候,不要立即重试,需要一定的时间间隔,而且重试的间隔应该越来越长。

要备份或者恢复数据库使用Storage,至少需要SQL server 2012 SP1 CU2

http://technet.microsoft.com/en-us/library/jj919148.aspx这篇文章有详细的描述。

下载地址如下: