Pages

Monday, December 29, 2014

How to make a database copy from production to staging server in Azure

On the same server


We need 1 user name with its password on staging database and production database. It is 1 time process only. If same user is not present in source and destination database then we can not create backup of database.
Note: It is required only if your Source and destination database is present on different server. If they are present in same server then you need to execute only following query with your respected values.


1.       Connect to destination server (Here Staging DB) “master” database with productions username and pwd  because we need to have same username with password on source and destination DB.

2.       Execute the following command:
a.       CREATE DATABASE [NEWDATABASENAME] AS COPY OF [SOURCE_SERVERNAME].[SOURCEDATASE]
b.      IMP: Replace the NEWDATABASENAME, SOURCE_SERVERNAME and SOURCEDATASE with correct names

To track progress you can run following command or you can connect to Azure portal and check the progress in database tab

3.       Execute: Select *  from sys.dm_database_copies, this will give you the stats of the % of database copied

hHappy Coding !!


1 comment: