2
votes

I need to get the .bacpac files exported to blob storage automatically. In the azure management portal I have configured it so that it export the db. But it fails again and again it says in the operation logs:"...failed in creating temporary database.." and the an email like this "...The temporary database copy to export from could not be made. You can view more details for this Automated SQL Export in the Windows Azure Management Portal ". Somebody have a clue.? regards

2

2 Answers

2
votes

We encountered the same issue with our automated sql azure backups. As part of our troubleshooting, we first tried to export to blob storage manually via the "export" link in the newer azure portal (portal.azure.com). When that failed - or actually just never completed with no errors in the "notifications" side tab, we decided to move to the older azure portal (manage.windowsazure.com) in hopes of receiving a more detailed error message.

When we manually kicked off the export in the older portal, we soon received a very detailed error message down the bottom part of the screen where you find the notifications.

The error specifically for us was related to a stored procedure we had created to help us troubleshoot the performance of our indexes. Some folks may be familiar with the stored procedure: sp_AskBrent (http://www.brentozar.com/askbrent/).

Essentially what happened was sql azure allowed us to create the stored procedure and execute it. However, the backup/export functionality was failing with that stored procedure in our database. The cause was the fact that the sp was referencing tempdb.

We ended up dropping the sp_AskBrent stored procedure, after which the backup/export started working again. Hope this helps someone.

0
votes

This error is generally due a schema change in the database which has resulted in an object becoming invalid.

You can see if this is the case by doing a manual export in the portal. The export will fail, with a red notification being generated saying "Export database 'db_name' failed. Clicking on the "Details" will show another line with an arrow in a circle which will contain the actual error message.

The error message will likely look like:

 Error encountered during the service operation. 
 Validation of the schema model for data package failed.
 Error SQL71501: Error validating element.... 

In most cases this is the result of a schema change that has rendered a stored procedure, view or function invalid. The simplest example of this is dropping a column that is referenced in a stored procedure or view.

The reason for this is that a bacpac file also generates the commands needed to replicate the schema. If some of these commands fail (because they reference a non existent column), then the entire restore would fail.

Simply fix any views/stored procedures/functions that are mentioned in the error log and the export should resume.