I need to automate SQL Azure database backup in SQL Script files. How can i do so? I need to automate SQL Azure database backup in SQL Script files. How can i do so? database database

I need to automate SQL Azure database backup in SQL Script files. How can i do so?


Option 1: Run some code/script to backup the database

You could run the SQL using the SQLCMD utility.

http://msdn.microsoft.com/en-us/library/ms162773.aspx

To schedule this, just use the Windows Task Scheduler.

http://msdn.microsoft.com/en-us/library/bb756979.aspx

Option 2: Use Azure Data Sync

Keep a local database in sync with your SQL Azure database, like a constant backup.

http://msdn.microsoft.com/en-us/library/windowsazure/hh456371.aspx

Option 3: Use BacPac

There is an API available in Azure to backup your database to a BACPAC format.

http://msdn.microsoft.com/en-us/library/windowsazure/hh335292.aspx

A RedGate tool then allows you to restore to a local SQL Server.

http://www.red-gate.com/products/dba/sql-azure-backup/

Edit

I have since created a command line tool which will create a copy of your database, and back it up to BacPac using the Azure Management API:

https://github.com/richorama/SQLDatabaseBackup


SQL Azure Database does not support SQL Server Agent or jobs. You can, however, run SQL Server Agent on your on-premise SQL Server and connect to SQL Azure Database.

Source: http://msdn.microsoft.com/en-us/library/windowsazure/ee336245.aspx

SQL Server Agent is a Microsoft Windows service that executes scheduled administrative tasks, which are called jobs...For example, if you want to back up all the company servers every weekday after hours, you can automate this task. Schedule the backup to run after 22:00 Monday through Friday

Source: http://msdn.microsoft.com/en-us/library/ms189237.aspx