简体   繁体   English

我需要在SQL脚本文件中自动执行SQL Azure数据库备份。 我怎么能这样做?

[英]I need to automate SQL Azure database backup in SQL Script files. How can i do so?

Presently i am generating SQL scripts everyday to take the backup of SQL Azure database. 目前我每天都在生成SQL脚本以备份SQL Azure数据库。 I need to automate this process using some freeware. 我需要使用一些免费软件自动化这个过程。 How can i achieve this? 我怎样才能实现这一目标?

Note:- I need to take the backup in form of SQL Script to some local machine. 注意: - 我需要以SQL Script的形式将备份带到某个本地机器。

Option 1: Run some code/script to backup the database 选项1:运行一些代码/脚本来备份数据库

You could run the SQL using the SQLCMD utility. 您可以使用SQLCMD实用程序运行SQL。

http://msdn.microsoft.com/en-us/library/ms162773.aspx http://msdn.microsoft.com/en-us/library/ms162773.aspx

To schedule this, just use the Windows Task Scheduler. 要安排此操作,只需使用Windows任务计划程序。

http://msdn.microsoft.com/en-us/library/bb756979.aspx http://msdn.microsoft.com/en-us/library/bb756979.aspx

Option 2: Use Azure Data Sync 选项2:使用Azure数据同步

Keep a local database in sync with your SQL Azure database, like a constant backup. 使本地数据库与SQL Azure数据库保持同步,就像持续备份一样。

http://msdn.microsoft.com/en-us/library/windowsazure/hh456371.aspx http://msdn.microsoft.com/en-us/library/windowsazure/hh456371.aspx

Option 3: Use BacPac 选项3:使用BacPac

There is an API available in Azure to backup your database to a BACPAC format. Azure中有一个API可用于将数据库备份为BACPAC格式。

http://msdn.microsoft.com/en-us/library/windowsazure/hh335292.aspx http://msdn.microsoft.com/en-us/library/windowsazure/hh335292.aspx

A RedGate tool then allows you to restore to a local SQL Server. 然后,RedGate工具允许您还原到本地SQL Server。

http://www.red-gate.com/products/dba/sql-azure-backup/ http://www.red-gate.com/products/dba/sql-azure-backup/

Edit 编辑

I have since created a command line tool which will create a copy of your database, and back it up to BacPac using the Azure Management API: 我已经创建了一个命令行工具,它将创建数据库的副本,并使用Azure Management API将其备份到BacPac:

https://github.com/richorama/SQLDatabaseBackup https://github.com/richorama/SQLDatabaseBackup

You could try RedGate Azure Sql backup http://www.red-gate.com/products/dba/sql-azure-backup/ 您可以尝试RedGate Azure Sql备份http://www.red-gate.com/products/dba/sql-azure-backup/

That can be also scheduled using Task Scheduler. 也可以使用任务计划程序安排。

I have written some ideas on how to do that: http://anttitech.wordpress.com/2011/11/06/azure-sql-backup-and-restore-scenarios-using-bacpac-exportimport/ 我已经写了一些关于如何做到这一点的想法: http//anttitech.wordpress.com/2011/11/06/azure-sql-backup-and-restore-scenarios-using-bacpac-exportimport/

创建数据库的云端备份(以获得一致的快照),然后使用数据层应用程序框架 (DACFx)客户端工具将快照复制到本地计算机,如自动化Windows Azure SQL数据库备份中所述

I have come across a free tool that makes backups of your SQL Azure Databases. 我遇到了一个免费工具,可以备份SQL Azure数据库。 Backups can be stored locally or on blob. 备份可以存储在本地或blob上。 You can also schedule backup operations with its built-in scheduler, or use the Windows Scheduler and the provided command-line utilities. 您还可以使用其内置调度程序计划备份操作,或使用Windows计划程序和提供的命令行实用程序。

Source: http://blog.idera.com/sql-server/backup-and-recovery/announcing-new-free-tool-azure-sql-database-backup/ 资料来源: http//blog.idera.com/sql-server/backup-and-recovery/announcing-new-free-tool-azure-sql-database-backup/

SQL Azure Database does not support SQL Server Agent or jobs. SQL Azure数据库不支持SQL Server代理或作业。 You can, however, run SQL Server Agent on your on-premise SQL Server and connect to SQL Azure Database. 但是,您可以在内部部署的SQL Server上运行SQL Server代理并连接到SQL Azure数据库。

Source: http://msdn.microsoft.com/en-us/library/windowsazure/ee336245.aspx 来源: http//msdn.microsoft.com/en-us/library/windowsazure/ee336245.aspx

SQL Server Agent is a Microsoft Windows service that executes scheduled administrative tasks, which are called jobs...For example, if you want to back up all the company servers every weekday after hours, you can automate this task. SQL Server代理是执行计划管理任务的Microsoft Windows服务,称为作业...例如,如果要在每个工作日备份所有公司服务器,则可以自动完成此任务。 Schedule the backup to run after 22:00 Monday through Friday 安排备份在周一至周五22:00之后运行

Source: http://msdn.microsoft.com/en-us/library/ms189237.aspx 来源: http//msdn.microsoft.com/en-us/library/ms189237.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何以编程方式备份​​Sql Server Express数据库? - How do I backup Sql Server Express database programatically? 如何在运行时创建Azure SQL数据库副本? - How do I create an Azure SQL Database copy during runtime? 升级后是否需要备份数据库? - Do I need to backup a database after an upgrade? 如何在SQL Server 2012或更高版本中使用密码进行数据库备份? - How can I take database backup with password in SQL Server 2012 or higher version? 如何使用sql developer备份和还原数据库(oracle 9i) - how to backup and restore database(oracle 9i ) using sql developer 如何从损坏的备份文件中还原SQL Server 2000? - How can I restore SQL Server 2000 from corrupted backup files? 当SQL Azure中不存在数据库时,我是否需要首先迁移EF代码? - Do I need a migration for EF code first when the database does not exist in SQL Azure? 如何基于sql脚本创建新数据库 - how can i create a new database base on a sql script Python数据结构-我需要使用SQL插件吗?如果需要,如何使用? - Python data structures — do I need to use SQL plugin… if so, how? 如何在SQL Azure中找到最大数据库空间和已用数据库空间? - How do I find the maximum database space and the used database space in SQL Azure?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM