How do I copy SQL Azure database to my local development server?

后端 未结 22 1020
抹茶落季
抹茶落季 2020-11-28 01:06

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

相关标签:
22条回答
  • 2020-11-28 01:46

    Use the Import/Export service in SQL Azure to create a .bacpac file.

    Then take a look at this method in another Stack Overflow article.

    Azure SQL Database Bacpac Local Restore

    0 讨论(0)
  • 2020-11-28 01:48

    Regarding the " I couldn't get the SSIS import / export to work as I got the error 'Failure inserting into the read-only column "id"'. This can be gotten around by specifying in the mapping screen that you do want to allow Identity elements to be inserted.

    After that, everything worked fine using SQL Import/Export wizard to copy from Azure to local database.

    I only had SQL Import/Export Wizard that comes with SQL Server 2008 R2 (worked fine), and Visual Studio 2012 Express to create local database.

    0 讨论(0)
  • 2020-11-28 01:48

    Download Optillect SQL Azure Backup - it has 15-day trial, so it will be enough to move your database :)

    0 讨论(0)
  • 2020-11-28 01:49

    I couldn't get the SSIS import / export to work as I got the error 'Failure inserting into the read-only column "id"'. Nor could I get http://sqlazuremw.codeplex.com/ to work, and the links above to SQL Azure Data Sync didn't work for me.

    But I found an excellent blog post about BACPAC files: http://dacguy.wordpress.com/2012/01/24/sql-azure-importexport-service-has-hit-production/

    In the video in the post the blog post's author runs through six steps:

    1. 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.

    2. 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.)

    3. In the Azure Management Portal select the database you want to export and click 'Export' in the Import and Export section of the ribbon.

    4. 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).

    5. 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.

    6. 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.

    The last step may only be available in the SQL Server 2012 edition of the SQL Server Management Studio (that's the version I am running). I do not have earlier ones on this machine to check. In the blog post the author uses the command line tool DacImportExportCli.exe for the import which I believe is available at http://sqldacexamples.codeplex.com/releases

    0 讨论(0)
提交回复
热议问题