我如何SQL Azure数据库复制到我的本地开发服务器? [英] How do I copy SQL Azure database to my local development server?

查看:120
本文介绍了我如何SQL Azure数据库复制到我的本地开发服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我可以SQL Azure数据库复制到我的机器?我想停止支付有在云中开发数据库,​​但它是获得生产数据的最佳方式。我在我的生产数据库复制到一个新的发展数据库,但我想有一个相同的数据库本地。

Does anyone know how I can copy a SQL Azure database to my development machine? I'd like to stop paying to have a development database in the cloud, but it's the best way to get production data. I copy my production database to a new development database but I'd like to have that same database local.

有什么建议?

推荐答案

有多种方法可以做到这一点:

There are multiple ways to do this:


  1. 使用SSIS(SQL Server集成服务)。它仅进口数据在表格中。列属性,约束,键,索引,存储过程,触发器,安全设置,用户登录,等不转让。然而,它是非常简单的过程,可以通过在SQL Server Management Studio中的向导会做简单。

  2. 使用 SSIS和DB创建脚本的组合。这将让你的数据并没有被SSIS传输的所有丢失的元数据。这也很简单。使用SSIS(见下文说明)首先传输数据,然后建立数据库从SQL Azure数据库创建脚本,并重新发挥它在本地数据库。

  3. 最后,您可以使用导入/导出在SQL Azure中的服务。这种传输数据(用模式对象)天青Blob存储作为一个BACPAC。您将需要一个Azure存储帐户,并为此在Azure的门户网站。这是因为$ P $中的Azure门户网站pssing的导出按钮,当您选择要导出数据库一样简单。缺点是,它只有手动程序,我不知道的方式,通过工具或脚本来自动化这个 - 至少需要在网页上点击第一部分

  1. Using SSIS (SQL Server Integration Services). It only imports data in your table. Column properties, constraints, keys, indices, stored procedures, triggers, security settings, users, logons, etc. are not transferred. However it is very simple process and can be done simply by going through wizard in SQL Server Management Studio.
  2. Using combination of SSIS and DB creation scripts. This will get you data and all missing metadata that is not transferred by SSIS. This is also very simple. First transfer data using SSIS (see instructions below), then create DB Create script from SQL Azure database, and re-play it on your local database.
  3. Finally, you can use Import/Export service in SQL Azure. This transfers data (with a schema objects) to Azure Blob Storage as a BACPAC. You will need an Azure Storage account and do this in Azure web portal. It is as simple as pressing an "Export" button in the Azure web portal when you select the database you want to export. The downside is that it is only manual procedure, I don't know a way to automate this through tools or scripts -- at least the first part that requires a click on the web page.

有关手册程序的方法1 的(使用SSIS)如下:

Manual procedure for method #1 (using SSIS) is the following:


  • 在SQL Server管理Studio(SSMS)在本地SQL实例创建新的空数据库。

  • 从上下文菜单中选择导入数据(右击数据库 - >任务 - >导入数据...)

  • 类型在源(SQL Azure的)连接参数。选择使用Sql Server .NET Framework数据提供作为供应商。

  • 选择现有的空本地数据库作为目标。

  • 按照向导 - 您可以选择要复制表中的数据。您可以选择跳过任何不需要的表。例如。如果你把应用程序日志数据库中,你可能不需要它在你的备份。

您可以通过创建SSIS包和自动化它重新执行任何你想重新导入数据的时间。请注意,您可以使用SSIS到一个干净的数据库只能导入,一旦你已经做到过一次,你不能做增量更新到本地数据库。

You can automate it by creating SSIS package and re-executing it any time you like to re-import the data. Note that you can only import using SSIS to a clean DB, you cannot do incremental updates to your local database once you already done it once.

方法2 的(SSID数据加上架构对象)是很简单的。第一次去,虽然上述一阶,然后创建数据库创建脚本(右击SSMS中点击数据库,选择生成脚本 - >数据库创建)。在您的本地数据库,然后重新播放这个脚本。

Method #2 (SSID data plus schema objects) is very simple. First go though a steps described above, then create DB Creation script (righ click on database in SSMS, choose Generate Scripts -> Database Create). Then re-play this script on your local database.

方法3 的是在这里博客描述:<一href=\"http://dacguy.word$p$pss.com/2012/01/24/sql-azure-importexport-service-has-hit-production/\">http://dacguy.word$p$pss.com/2012/01/24/sql-azure-importexport-service-has-hit-production/.存在与DB内容传送到天青BLOB存储作为BACPAC的处理的视频剪辑。之后,你可以在本地复制文件,并将其导入到SQL实例。导入BACPAC到数据层应用程序的过程描述如下:<一href=\"http://msdn.microsoft.com/en-us/library/hh710052.aspx\">http://msdn.microsoft.com/en-us/library/hh710052.aspx.

Method #3 is described in the Blog here: http://dacguy.wordpress.com/2012/01/24/sql-azure-importexport-service-has-hit-production/. There is a video clip with the process of transferring DB contents to Azure Blob storage as BACPAC. After that you can copy the file locally and import it to your SQL instance. Process of importing BACPAC to Data-Tier application is described here: http://msdn.microsoft.com/en-us/library/hh710052.aspx.

这篇关于我如何SQL Azure数据库复制到我的本地开发服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆