Restoring a database on top of an existing

Hi,
Our scenario is that we have a production database and associated website.   The database is a linked resource in our Azure website configuration.

We also have an identical configuration for our staging environment.

As part of our pre-release testing, we would like to copy the production database to the staging database and do testing on our web application in a staging environment.  Up until last year, we used to do this by restoring a BACPAC of our production database over the top of the staging database - unfortunately this is now not possible with the new point-in-time restore functionality.

I have seen some posts that recommend deleting the staging database, and then use the Db copy functionality (or a simple BACPAC import).   I am hesitant to do this, however, as I am unsure whether this will affect the website this database is associated with (ie remember its a linked resource).   I am also unsure of whether all my monitoring, webjobs, configuration, scaling, etc already setup for my staging database will be preserved if I delete and recreate the db.


My question is what is the recommended way of doing this now?

Thanks,

Steve


March 26th, 2015 3:46am

Hi Steve,

There are a couple of ways to accomplish this.

As you mentioned you could create a copy of your database or use Point in Time Restore to copy your database. You could then have your staging application connect to this new database. 

Another option is to create a database Copy of your production database, then export the copy database, and then import the BACPAC onto your staging database using PowerShell. To import into an existing database the database needs to be completely empty (no objects, schema, etc...)

Either of these options are fine, however the first option may have less cost because you will only need one new database during the process. The reason Export requires the database copy is that it performs an individual bulk copy of the data from each table in the database. Because of this it can't guarantee transaction consistency if the database is being written too. 

Hope this helps!

Free Windows Admin Tool Kit Click here and download it now
March 26th, 2015 11:26am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics