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.
Related
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
Does anyone know how to unlock a SQL Server .mdf file so can share with friends?
Because the file that my friend share with me for our group assignment happen to be locked up and that I can't use the data within and only can view it.
Actually I want to share my database with my partner in this group assignment. We use a similar database. However, due to reason of time meet up with our instructor, we both need to have our own holding of a database for presentation at different time.
Also the reason, I want to learn to unlock it is because, we may need to try in on different hardware as well. Is in by Exporting? Like what is shown in this link video? https://www.youtube.com/watch?v=c2XmaCFk-kk
Firstly, to be able to use .mdf/.ldf files in common operations like Copy/Paste you need:
1. Under Sql Server Management Studio right click on the DB:
2. Then under Detach window check 'Delete Connexions' and click Ok:
You're free to do whatever you want with your .mdf/.ldf files
You probably shouldn't be sharing the MDF files, but if that's what you want to do you will indeed have to detach the database and transfer MDF and LDF files before attaching it on the other side.
It's not completely clear what you want to accomplish, but I think your best option is to take a backup on your machine, transfer the backup to the other machine and restore it there, that way the database doesn't have to go offline.
See this link for a how-to on the backup/restore method.
See this link for instructions on the detach/attach method
Share SQL connection, not the MDF file. Use SQL Surface to enable network access to your DB and define user logins.
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.
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.
What is the best way to go about moving a database from a Godaddy SQL 2005 account to a local SQL 2005 server? I have access to the DB through Server Management Studio Express and also through the Godaddy SQL explorer.
However, I have no idea where to start. In MySQL, I would just export the data through the PHPMyAdmin page, and conversely import it on the other server using an ASCII file. In access, I'd just use the migrate tool. In Server Management Studio, I've thought about using the "Backup" and "Restore" method, but I'm afraid that I won't have the ability to create a new object with the correct permission schema on the new server.
What are your thoughts? Keep in mind that I do not have access to the MDF or temp files. I've been studying this page.
SMSS should be able to do it for you. If you are looking to move the entire database and not just a few tables, the Backup and Restore method is probably your best bet.
Your steps might include:
connect to Godaddy sql server in ssms
Right click the database you want to move and select Tasks > Backup
Keep/set Backup type = "Full" and add a destination at the bottom that you will be able to access.
After backup completes, move the .bak file to a location that your local sql server can see.
Connect to your local sql server in ssms.
Right click Databases > Restore Database
Enter the database name you want in "To Database:"
Select "From device:" and locate the .bak file you created before.
In the row that shows up in the grid display, check the restore check box.
If it matters to you where the recreated files will be stored, select options on the top left menu and confirm the file locations under the "Restore As" column in the data grid.
Click ok and the restore should start.
To migrate users, follow the directions at http://support.microsoft.com/kb/918992
Don't be so afraid of the backup and restore. You have a much better chance at getting a high fidelity copy of your data than trying to roll your own. Give it a shot, test it out, and see what happens. I think you'll be pleasantly surprised.