有人知道如何复制SQL Azure数据库到我的开发机器吗?我不想再花钱在云端建立开发数据库,但这是获得生产数据的最佳方式。我将我的生产数据库复制到一个新的开发数据库,但我想在本地拥有相同的数据库。
有什么建议吗?
有人知道如何复制SQL Azure数据库到我的开发机器吗?我不想再花钱在云端建立开发数据库,但这是获得生产数据的最佳方式。我将我的生产数据库复制到一个新的开发数据库,但我想在本地拥有相同的数据库。
有什么建议吗?
当前回答
如果有人想要一个免费有效的选项(也不介意手动操作)来将数据库备份到本地,那么可以使用最新版本Microsoft Visual Studio 2015社区版(免费)或专业/高级/终极版中内置的模式和数据比较功能。它像魔法一样有效!
我有BizPark帐户与Azure,没有办法直接备份数据库没有支付。我发现这个选项在VS工作。
答案摘自https://stackoverflow.com/a/685073/6796187
其他回答
如果有人想要一个免费有效的选项(也不介意手动操作)来将数据库备份到本地,那么可以使用最新版本Microsoft Visual Studio 2015社区版(免费)或专业/高级/终极版中内置的模式和数据比较功能。它像魔法一样有效!
我有BizPark帐户与Azure,没有办法直接备份数据库没有支付。我发现这个选项在VS工作。
答案摘自https://stackoverflow.com/a/685073/6796187
关于“我无法让SSIS导入/导出工作,因为我得到了错误“插入只读列“id”失败”。 这可以通过在映射屏幕中指定允许插入Identity元素来解决。
在此之后,使用SQL导入/导出向导从Azure复制到本地数据库,一切工作正常。
我只有SQL Server 2008 R2附带的SQL导入/导出向导(工作良好)和Visual Studio 2012 Express来创建本地数据库。
使用SSMS v18.9+,您可以使用部署数据库到Microsoft Azure SQL数据库。
这不是很直观,但是向导允许您选择一个本地数据库,即使任务的名称是Deploy Database to Microsoft Azure SQL Database。
使用SSMS连接到Azure数据库 右键单击数据库,选择Tasks > Deploy database to Microsoft Azure SQL database。 选择本地SQL server作为目标连接。 按照其他步骤操作。
我无法让SSIS导入/导出工作,因为我得到了错误“插入只读列“id”失败”。我也不能让http://sqlazuremw.codeplex.com/工作,上面的链接到SQL Azure数据同步不适合我。
但我发现了一篇关于BACPAC文件的优秀博客文章:http://dacguy.wordpress.com/2012/01/24/sql-azure-importexport-service-has-hit-production/
在这篇博文的视频中,作者介绍了六个步骤:
Make or go to a storage account in the Azure Management Portal. You'll need the Blob URL and the Primary access key of the storage account. The blog post advises making a new container for the bacpac file and suggests using the Azure Storage Explorer for that. (N.B. you'll need the Blob URL and the Primary access key of the storage account to add it to the Azure Storage Explorer.) In the Azure Management Portal select the database you want to export and click 'Export' in the Import and Export section of the ribbon. The resulting dialogue requires your username and password for the database, the blob URL, and the access key. Don't forget to include the container in the blob URL and to include a filename (e.g. https://testazurestorage.blob.core.windows.net/dbbackups/mytable.bacpac). After you click Finish the database will be exported to the BACPAC file. This can take a while. You may see a zero byte file show up immediately if you check in the Azure Storage Explorer. This is the Import / Export Service checking that it has write access to the blob-store. Once that is done you can use the Azure Storage Explorer to download the BACPAC file and then in the SQL Server Management Studio right-click your local server's database folder and choose Import Data Tier Application that will start the wizard which reads in the BACPAC file to produce the copy of your Azure database. The wizard can also connect directly to the blob-store to obtain the BACPAC file if you would rather not copy it locally first.
最后一步可能只能在SQL Server Management Studio的SQL Server 2012版(我正在运行的版本)中使用。这台机器上没有更早的。在博客文章中,作者使用命令行工具DacImportExportCli.exe进行导入,我相信可以在http://sqldacexamples.codeplex.com/releases上找到
这很简单。这对我很管用……在获取Azure SQL数据库到本地机器方面…
打开SQL Management Studio并连接到Azure SQL Server。 选择您想要下载到本地机器上的数据库,然后右键单击…选择“生成脚本”。按照提示…
但是,要注意的是,如果你也想要数据,以及脚本,一定要检查高级选项在开始生成…向下滚动到“脚本的数据类型”,并确保你有“模式和数据”…或者任何适合你的。
它会给你一个漂亮的SQL脚本文件,然后可以在你的本地机器上运行,它会创建数据库,并填充所有的数据。
请记住,在我的情况下,我没有FK或其他约束…而且,数据也不多。
一般来说,我不建议将此作为备份机制……