Hello experts,
I've been tasked with automatically refreshing a dev database from a production backup each day. This task is fairly straightforward for a standalone server, but I am running into some complications when trying to set up the same for a database that has been added to an availability group. Also, in full disclosure, I have just started getting trained on AGs within the past year, so a lot of this is new to me.
I've tried following the steps suggested at the link below.
However, it so happens that one node of the cluster I am working with doesn't seem to have the same common UNC path as the other two. Additionally, it seems that another way to do the AG restore is to:
The link I referenced above does not drop the dbs; rather it restores from the common UNC path.
So my questions are:
At the moment, the jobs I have set up are schematically as follows:
Job 1:
Primary Server - Create one job that does the following:
Removes database from Availability Group
Restores the database
Sets recovery model of database to FULL
Job 2:
Secondary Server 1
drop db
Job 3: Secondary Server 2
drop db
Job 4
On Primary Server
Adds database to Availability Group
Creates database backup and log backup
I suspect DBAs out there are doing these automated restores in a much more elegant and efficient manner. Thanks for any help with this.
-- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
Are you saying your DEV system is setup with an availability group and you need to refresh the DEV database(s) from production on a daily basis?
I see no reason to have a development environment setup and configured this way.
As for the steps to be taken - you can actually restore the database to both the primary and the secondary from the same source backup and enable the database without having to backup the database from the primary. The steps are:
The key is that the restored database must be at the same LSN on both systems when the database is joined. As soon as a new tlog backup is performed on the primary you cannot join and then must take another backup and log and restore to secondary.
I would also recommend NOT dropping the databases on the secondary - is isn't needed. In fact, there are several settings that can be made on a secondary database that will be maintained when restoring over the existing database that could be lost. For example, if you have to change the owner of the database on the secondary - if you restore over the existing database the owner isn't updated - but if you drop the database the owner will now be the account the performs the restore.
As for where you get the backup files...you can either restore over the network using a common UNC path or better yet - copy the backup file from the source to each destination and restore locally. The local restore will execute and perform much faster than restoring across the network.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply