Terje Nygård
Terje Nygård

Reputation: 1257

Azure SDK 2.4 update "broke" Development Storage Blobs

After installing the newest Azure SDK VS2013 update i lost all my existing Development Storage Containers, and are unable to create new ones.

Anyone familiar with this and know how to "re-attach" them or fix otherwise?

Not much info on this on this to be found yet.

EDIT : it seems new blobs are successfully created now, i only miss the ones i had before i updated.

Upvotes: 3

Views: 503

Answers (3)

Clark
Clark

Reputation: 488

I found a relatively simple way to migrate data between versions that took me less than 5 minutes (at least going from AzureStorageEmulatorDb54 -> AzureStorageEmulatorDb57), but as a disclaimer I'm only using blob storage for images

This will also definitely not work if there were schema changes between emulator versions

Before starting, make sure all instances of storage emulator are stopped

What you need to do is generate insert scripts for data you care about from the old database (after you have updated and installed the new version of storage emulator)

  1. Open up SSMS and connect to both the new and old databases that Azure Storage Emulator created (in my case, AzureStorageEmulatorDb54 and AzureStorageEmulatorDb57)
  2. Right click old DB and select Tasks -> Generate Scripts
  3. Select tables you care about, in my case Blob, BlobContainer, BlockData, and CommittedBlock. You will need to select more / others depending on what you care about and how you're using the emulator. I didn't care about logs or table data, only blob data.
  4. On the "Specify how scripts should be saved or published page", Select "Save to new query window", and then select "Advanced", scroll down to "Types of data to script" and select "Data Only"
  5. Next a few times and finish, and a new query window should open up with all of your data scripted as insert statements
  6. For the script that gets generated, change the first line - USE [AzureStorageEmulatorDbXX] to your new version, in my case I updated USE [AzureStorageEmulatorDb54] to USE [AzureStorageEmulatorDb57]
  7. Run the script

In my case, I was able to use the new version of the storage emulator with my old data. YMMV. This will only work if your storage location for the actual files is the default and the default location didn't change between versions. You'll have to move the actual files if this changes.

At the time of writing, the default location for me was: C:\Users\username\AppData\Local\AzureStorageEmulator\BlockBlobRoot\2

Upvotes: 2

Moch Yusup
Moch Yusup

Reputation: 1356

Unfortunately, it is expected behavior. Every time you update the storage emulator version, it uses a different database to store the information.

I just suggest that you back-up all the data in development storage manually before you install the newer version of storage emulator in the future. If you're using Azure Storage Explorer, this will ease the backup process:

  • Blob Storage: simply create a folder resemble container name, and download all the file to that folder (using storage explorer, you can simply select all and click on download). But be warned, since this only backup blob content. Blob metadata and any other blob specific properties won't be saved.
  • Table Storage: export a table (using storage explorer, you can export your table data into cvs, json or xml file. But be aware that different versions of storage explorer sometimes use different formatting. In my case, when I tried to export the data into a cvs in storage explorer v.5 and import it in v.6, some of the data failed. I need to change the data format manually again.:( )

But yeah, even Storage Explorer couldn't backup all the data in one click. Hopefully, there's a tool to backup data in dev storage with just one click. And of course I wish the next version of emulator doesn't reset the data.

Upvotes: 0

Gaurav Mantri
Gaurav Mantri

Reputation: 136226

This is expected behavior. Basically when a new version of storage emulator is installed, it creates a new SQL Server Database to store local data.

enter image description here

Unfortunately there is no simple way to get your data into the newer database. One possible solution would be to uninstall the latest version, reinstall the old version and download blobs on your computer. Then install the latest version again and upload the blobs again (I know it's really lame solution). You may find this blog post useful for doing this: http://blog.cerebrata.com/windows-azure-sdk-1-5-and-empty-development-storage/.

Upvotes: 4

Related Questions