Azure Database Copy

May 21, 2013 at 4:19 PM
Edited May 21, 2013 at 4:19 PM
All these features are awesome.

But I seem to find my self copying one database which is Live. to a Staging Database.

The sql command is simple enough but if we could use an option to copy (backup) a database to a new databse (or existing- delete it and recreate it)

Just fire a the SP across

-- Execute on the master database.
-- Drop the whole Database before copying.
DROP DATABASE liveDB;

-- Execute on the master database.
-- Start copying live data to test db.
CREATE DATABASE liveDBcopy AS COPY OF liveDB;

-- Execute on the master database.
-- Retrieve state of the new database, Database1B.
--SELECT name, state, state_desc FROM sys.databases WHERE name = 'liveDBcopy'

Thanks a trillion!
Coordinator
May 21, 2013 at 10:34 PM
Hi,

I am not sure that I understand, but is your request to drop an existing database and then upload a new database? You can do this via SQLAzureMW when you get to the target server. SQLAzureMWBatchBackup and SQLAzureMWBatchUpload are command lines version of SQLAzureMW and in the config file (or command line parameter) you can tell it to drop an existing database if it exists.

Regards,
George