How to upload BACPAC file to Blob in Azure - sql

So frustrating... , Microsoft do not offer help and you have figure out every small thing at the portal ...
My question is: I try to import my DB to Azure. I created a BACPAC file from the .Bak and when try to import, there's the "*storage" and then when I click on Configure required settings it's opens the "Storage Accounts" tab but give the message "Not found".
Here's the thing: I created storage and container and blob - it's just not find it. So annoying. And on the azure portal it's doesn't say how to create and how to upload the file.
Also, when I create the storage and the blob, there's no option where to Upload the BACPAC file. How do I do it? What's going on with Microsoft?? So unclear...
To summarize:
How do I create a storage/container/blob that when I try to import the DB it will see it?
How do I upload the BACPAC to the Azure Blob Storage?. I couldn't find a way to do that on the portal.
Thanks!!

Not 100% following your example, but if you have a later version of SQL Server Management Studio, you can right click the database you want to deploy, click 'Tasks/Export data tier application'. In there you can connect to a storage account which if you press Connect, you will have to type the name of the account from the portal and provide a key. You can then export it to storage and then if you connect to the Azure instance, you can right click the databases level and 'import data tier application'. If you need to create a storage account in the first place, you do that in the portal, but sounds like you have.
If you want to browse your storage and drop a file in directly, I use Azure Storage Explorer. There are various tools out there some free some not to do this. You could of course code your own interface as the API's are published.

View the portal as the administration of your subscription. When you want to use the services (not configure them) - you'll need to look at the toolsets.
Azure Storage Explorer makes navigating and uploading/downloading files in storage accounts super simple. Visual Studio works well too, for Db workloads Sql Management Studio has Azure integration. If all else fails, powershell gives you the finest level of control.

1 - Create an Azure storage account
2 - Create a blob in the new storage account
3 - Access the blob and upload your bacpac file
4 - Access the Sql server, go to import database and use the link "select the backup" to indicate in the blog the bacpac file you want to use to create the database

Related

Error when exporting SQL database from Azure to local

I am trying to export a SQL database in Azure to my local machine using SSMS in order to create a local back up. I used 'Export Data Tier Application' for creating back up. But I am getting the error given below.
How can I get rid of this?
Just from the error message, you don't have permission to alter/access the database.
If you want to do the Export Data Tier Application to create the backup bacpac file, you must using the Azure SQL database server admin account, or you don't have the enough permission.
Please try to using the Azure SQL database server admin account to do the operation.
Hope this helps.

Importing a Azure SQL DB

I am facing a weird issue, can someone please help with this. I have a .bacpac file on the Blob storage, the bacpac file size is around 800 MB. This file was created by doing an export from one of the SQL DB on Azure which is of 4 GB.
While I am trying to import the .bacpac file, only the DB schema is created in the new database, data in the tables is missing. Can someone please suggest with this.
Many thanks
Create a New Database by Importing BACPAC File
Log on to the Azure Management Portal.
Click New > Data Services > SQL Database > Import. ...
Click the folder under BACPAC URL to navigate to the Storage Account, Container, and file name of the exported .bacpac file. ...
Specify a name for the new SQL database.
This works perfectly without any issues.

Azure SQL Backup and Restore

I know Azure does automatic backup and restoring based off those automatic backups. I need to create a manual backup of a database. From reading online, I created a bacpac file using Export and saved to an Azure Blob (how to here). The problem is when I go to 'Restore' using the Azure Portal, it only gives me the option to choose one of their automated backups.
On top of this, I would actually like to restore that database to another database (think restoring Production to Test). I cannot do this either.
I believe they used to have an Import + Export function when in the portal. Now it is Restore and Export, I'm wondering if they somehow took this capability away, I'm not sure.
I know I can create a new database from a .bacpac file, but this does not help me in any way shape or form.
There is a copy command you can execute from the old portal. Select a DB from the list and a copy toolbar item appears.

Saving and accessing SQL databases in Azure?

A friend of mine has 3 small SQL databases on her Azure account that she asked me to download for her. I said no problem…thinking she had a VM running with SQL Server and I could just RDC in and grab everything…no such luck and no FTP access.
I've done an export but have no idea how to download the .bacpac file.
I've logged in through the management portal - but there's no options in there to export/download anything.
Can someone tell me the best - easiest - way to save these databases? Is there an easy way to download them? If I configure a VM in her account can access them that way? Is there a way I can transfer them over to my account?
I don't know all that much about Blob storage and container management - I've seen a few instructions and they seem very complex to me just to download a .bacpac file so I'm assuming I'm missing something.
Any help or ideas would be great!
Thank you...
Rob
Here is a solution to your problem.
Use a linked server connection between your on premise database and SQL AZURE.
http://blogs.msdn.com/b/windowsazure/archive/2012/09/19/announcing-updates-to-windows-azure-sql-database.aspx
Quick list of steps.
1 - Link to SQL Azure database.
2 - Script out objects.
http://craftydba.com/?p=4827
Check out how to manage Azure from SSMS on my blog. Half way down, right click table, script as Create.
http://blogs.msdn.com/b/sqlazure/archive/2010/05/24/10014071.aspx
How to script a whole database.
3 - Create mirror database on premise using scripts from step 2.
4 - Create linked server to AZURE database.
http://msdn.microsoft.com/en-us/library/aa560998.aspx
5 - INSERT INTO SELECT * FROM
http://technet.microsoft.com/en-us/library/ms174335.aspx
Why select * into does not work in Azure. Might work with a linked server. Never tried.
http://blogs.msdn.com/b/windowsazure/archive/2010/05/04/select-into-with-sql-azure.aspx
6 - Watch out for constraints such as primary key on identity column. You will have to enable identity insert. Other constraints, you can disable.
7 - Re-enable constraints with checking.
Again, this whole process assumes you do not have a ton of data. If you do, you might want to look into using a ETL tool such as SSIS.
You can mount the Azure Page Blob as an NTFS drive using a utility like XDrive. I'm trying to use "Azure Storage Explorer" to do the same thing but it's not allowing me access to the files inside of the VHDS file (and I think that it should). XDrive is supposed to allow for a mapped drive type feel in Windows Explorer.
Backup the databases to the secondary hard drive on the Vm's. Download, install, and configure XDrive to point to this hard drive. Grab the backups. Voila! Please note that XDrive limits read/write access to distributed enviornments so this should only be used as a tempory solution for environments not distributed (ie. load balanced) or you could cause a disruption to your production users.
XDrive: http://blog.maartenballiauw.be/post/2010/02/02/Using-Windows-Azure-Drive-%28aka-X-Drive%29.aspx
Updated:
Download "Azure Storage Explorer" from http://azurestorageexplorer.codeplex.com/
From the Azure portal, click on the db you want to export and from the dashboard tab, there's an "Export" button. This will create a bacpac file.
Choose a storage account (remember which one you chose because you will have to access it later).
For the container, create a new one called "DB Storage" or something like that. You will need to server credentials to do the export.
After the export completes, open up "Azure Storage Explorer" and add the storage account you placed the backup in. You will need the storage account name and the primary key (both can be pulled from the Azure portal). I have to use the option "HTTPS" but you may or may not.
Once the account is in the explorer, on the left pane you should see the new container you created in the earlier step. Click on it which should pull up your bacpac file in the middle pane.
Highlight the bacpac file and choose download.
It's a bit of a pain because you have to install the explorer utility but after that's done, it's really easy.
Let me know if this works.

Download an entire SQL Azure database as single file

Is there a facility in Azure to get a copy of the database? Or rather, detach the mdf and get it as file? On occasion I create a database in the cloud, it's up for a while, and then I want to take it down and archive it. My current rutine copies the database using SQL Azure Migration Wizard to a local Express instance, which I then detach and put in a safe place.
EDIT
Interestingly my method of choice throws an exception this time around. So it's far from ideal.
There is another way to do it:
"C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\SqlPackage.exe" /Action:Export /SourceServerName:"tcp:xxxxx.database.windows.net,1433" /SourceDatabaseName:DbName /SourceUser:user /SourcePassword:password /TargetFile:C:\backups\backup.bacpac
From SQL Server Management Studio 2014, connect to the destination database server, right click its Databases node, and click Import Data-tier Application. In the import wizard, select the option to import from Windows Azure.
Using Sql Managment Studio (I use 2012):
Create a new local database.
Right-click in the database -> Tasks -> Import Data
Then you need to select the azure database as the data source and you new local database as data destination.
At this point, you can create a sql server backup or generate a sql script file to get a local copy at that moment.
I created the Enzo Backup for SQL Azure utility for that very reason. You can create a full backup and get your hands on a file that you can restore later to either another SQL Azure database, or a SQL Server database.
Note that SQL Azure will offer a form of backup, cloud-only, in the future. That's another good option. Finally Red-Gate has a product to copy a SQL Azure database to a local SQL Server database, but I am not sure that it gives you a "backup file" per say.
There is a RedGate tool that will backup your database to a local server http://www.red-gate.com/products/dba/sql-azure-backup/
I have found this useful before I do any database upgrades, in case bad stuff happens.
Since I've asked this question, the Azure management console added an option to export the entire database to blob storage. You can keep your backups there, but if you prefer a hardcopy there are many blob explorer tools such as this one.
A good free option I've been using for past few years is Sql Backup and Ftp. It's 100% free if you backup to your local laptop.
External storage requires paid license though.
From the website:
No more multi-step SSMS configuration, just a single form to automate backups: select databases, backup (full, diff, tran log), encrypt, compress, send to a folder, FTP or cloud service:
schedule backups, receive confirmation emails and restore when needed.