[Company Logo Image] 

Home Up Contents Coffee Break Credits Glossary Links Search

How to refresh development and test databases



Analysis Services
CLR Integration
High Availability
Open Source
SQL Server 2008
SQL Server 2012
SQL Server 2014
SQL Server 2016
SQL Server 2017
SQL Server 2019

How to refresh development and test databases.


Date created: May 31, 2018.

An easy way to refresh your development and test Azure SQL databases with the production Azure SQL database is to copy or clone the production database. Copying is an option if you do not need to exclude (big) tables related logs or auditing from the production database.

To copy a production database you can use the Azure portal or PowerShell.

New-AzureRmSqlDatabaseCopy -ResourceGroupName "myResourceGroup" `
-ServerName $sourceserver `
-DatabaseName "MySampleDatabase" `
-CopyResourceGroupName "myResourceGroup" `
-CopyServerName $targetserver `
-CopyDatabaseName "CopyOfMySampleDatabase"

The PowerShell option give you the ability to involve Azure Automation to automate the process.

You can also automate refreshing the development database by recreating it using Azure Automation with PowerShell and the following CREATE DATABASE AS COPY OF T-SQL statement.

AS COPY OF ozabzw7545.db_original ( SERVICE_OBJECTIVE = 'P2' );

If you would like to know the progress of a copy database operation, you can use below statement.

From [sys].[databases] Left Outer Join
On [sys].[databases].[database_id] =
Where [sys].[databases].[name] = 'mydatabase'




.Send mail to webmaster@sqlcoffee.com with questions or comments about this web site.