May 1, 2018 at 9:41 am
I'm a bit of a novice when it comes to AlwaysOn, so I was hoping some of you that have expertise in this area can help me understand the high-level process for restoring a database to an AOAG cluster. Is it simply:
1) Disable AOAG
2) Delete the database from the primary
3) Restore database to primary
4) Restore database to secondary (and others if necessary)
5) Enable AOAG
Something like that? Also, would your answer change if this were a true production cluster vs a non-production one (where HA isn't critical).
Thank you in advance.
Mike
Mike Scalise, PMP
https://www.michaelscalise.com
May 1, 2018 at 10:59 am
Hi Mike,
To restore a database to an AOAG cluster, you would:
1) Remove the database from Availability Group
2) Drop the database on the Secondary
3) Restore the database on the Primary
4) Back up the database on the Primary
5) Back up the transaction log of the database on the Primary
6) Restore the database on the Secondary with No Recovery
7) Restore the transaction log on the Secondary with No Recovery
8) Run a command on the secondary similar to: ALTER DATABASE xxxx SET HADR AVAILABILITY GROUP = [my AG]
9) Run a command on the primary similar to: ALTER AVAILABILITY GROUP [my AG] ADD DATABASE [xxxx]
For restoring a database on a FCI (Failover Cluster Instance) with no AOAG's, the process would be to simply restore the database as you would on a stand-alone instance.
May 1, 2018 at 11:37 am
RVSC48 - Tuesday, May 1, 2018 10:59 AMHi Mike,
To restore a database to an AOAG cluster, you would:
1) Remove the database from Availability Group
2) Drop the database on the Secondary
3) Restore the database on the Primary
4) Back up the database on the Primary
5) Back up the transaction log of the database on the Primary
6) Restore the database on the Secondary with No Recovery
7) Restore the transaction log on the Secondary with No Recovery
8) Run a command on the secondary similar to: ALTER DATABASE xxxx SET HADR AVAILABILITY GROUP = [my AG]
9) Run a command on the primary similar to: ALTER AVAILABILITY GROUP [my AG] ADD DATABASE [xxxx]
For restoring a database on a FCI (Failover Cluster Instance) with no AOAG's, the process would be to simply restore the database as you would on a stand-alone instance.
Thanks, RVSC! I appreciate the information.
Mike Scalise, PMP
https://www.michaelscalise.com
May 2, 2018 at 8:05 am
RSVC,
I was reviewing your steps and I had a few more questions if you don't mind.
1) Steps 2 and 3 are not making sense to me...drop on the secondary and restore on the primary? Wouldn't I want to drop the database where I'm about to restore? In other words, drop database from primary then restore database to primary?
2) With steps 3 and 4, why would I restore a database on the primary and then back it up right after that? Wouldn't that effectively be the same as the backup I just restored?
Thanks,
Mike
Mike Scalise, PMP
https://www.michaelscalise.com
May 2, 2018 at 2:09 pm
Mike Scalise - Wednesday, May 2, 2018 8:05 AMRSVC,I was reviewing your steps and I had a few more questions if you don't mind.
1) Steps 2 and 3 are not making sense to me...drop on the secondary and restore on the primary? Wouldn't I want to drop the database where I'm about to restore? In other words, drop database from primary then restore database to primary?
2) With steps 3 and 4, why would I restore a database on the primary and then back it up right after that? Wouldn't that effectively be the same as the backup I just restored?
Thanks,
Mike
When you remove the Database from the Availability Group there are two copies..
Server 1 has the copy that you can restore (Step 3). Restore and Overwrite the Database.
Server 2 ( on Step 2) will have a database in RECOVERY mode. It will not be accessible. You will remove the DB in the secondary node.
If you do the above you can then Synchronize again. However, if it tells you that you need to backup the database (Step 4) then you will have to do it (he is trying to make sure you don't get that message but you have a point), otherwise you can synchronize.
May 3, 2018 at 4:12 am
Mike Scalise - Tuesday, May 1, 2018 9:41 AMI'm a bit of a novice when it comes to AlwaysOn, so I was hoping some of you that have expertise in this area can help me understand the high-level process for restoring a database to an AOAG cluster. Is it simply:1) Disable AOAG
2) Delete the database from the primary
3) Restore database to primary
4) Restore database to secondary (and others if necessary)
5) Enable AOAGSomething like that? Also, would your answer change if this were a true production cluster vs a non-production one (where HA isn't critical).
Thank you in advance.
Mike
First please specify is the database to be restored currently a member of the existing AG?
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
May 3, 2018 at 7:00 am
Perry Whittle - Thursday, May 3, 2018 4:12 AMMike Scalise - Tuesday, May 1, 2018 9:41 AMI'm a bit of a novice when it comes to AlwaysOn, so I was hoping some of you that have expertise in this area can help me understand the high-level process for restoring a database to an AOAG cluster. Is it simply:1) Disable AOAG
2) Delete the database from the primary
3) Restore database to primary
4) Restore database to secondary (and others if necessary)
5) Enable AOAGSomething like that? Also, would your answer change if this were a true production cluster vs a non-production one (where HA isn't critical).
Thank you in advance.
Mike
First please specify is the database to be restored currently a member of the existing AG?
In this particular scenario, the database to be restored is NOT currently a member of the existing AG...
Mike Scalise, PMP
https://www.michaelscalise.com
May 3, 2018 at 9:10 am
Can you be more specific on your question. I'll make an assumption.
1. Your database is ONLINE and ready to be added to the Availability Group. First time adding this database to Availability Group.
2. The availability Group is Healthy and there are no issues. Shares are properly configured for Synchronization.
3. You are using either SQL 2012 or 2014. SQL 2016 makes it a little bit easier with "SEEDING".
4. Go to Always ON High Availability > Availability Groups > Select the GROUP > Right click on Availability Databases > "Add Database"
- Here it will tell you if it "Meets Prerequisites"
- Or needs "Full Recovery"
- or needs a "Backup"
5. If it meets Prerequisites then you can add it
6. It will ask you to connect to the secondary node
7. in the Select Data Synchronization it will ask you to choose one of the following:
- Specify the file share path (Location of Full Database and Log backup) - I usually do this one
- Join Only (you have restored database and log backup to each secondary server) - I've had problems with this one
- Skip initial Synchronization (perform own DB/log backup to primary ) -never done this one
8. It will perform a validation... if there are errors it will tell you here. Errors such as
- problems with shared location
- Disk space
- Does database already exists in secondary node or files already exists there
- Compatibility of file locations
9. Once it passes the validation then you are ready to FINISH and make it part of the availability Group.
It will Synchronize and add it to the secondary node.Things to know :
Server 1 : developmentsql1
Server2 : developmentsql2
Database to be added : MyDatabase
Availability Group : DEVSQLGRP
Shared backup location 1 : \\Developmentsql1\SharedLocation\
Shared Backup location: \\Developmentsql2\SharedLocation\
SCRIPTED BELOW..
--- YOU MUST EXECUTE THE FOLLOWING SCRIPT IN SQLCMD MODE.
:Connect developmentsql1 --whatever name of your primary server
May 4, 2018 at 7:23 am
Mike Scalise - Thursday, May 3, 2018 7:00 AMPerry Whittle - Thursday, May 3, 2018 4:12 AMMike Scalise - Tuesday, May 1, 2018 9:41 AMI'm a bit of a novice when it comes to AlwaysOn, so I was hoping some of you that have expertise in this area can help me understand the high-level process for restoring a database to an AOAG cluster. Is it simply:1) Disable AOAG
2) Delete the database from the primary
3) Restore database to primary
4) Restore database to secondary (and others if necessary)
5) Enable AOAGSomething like that? Also, would your answer change if this were a true production cluster vs a non-production one (where HA isn't critical).
Thank you in advance.
Mike
First please specify is the database to be restored currently a member of the existing AG?
In this particular scenario, the database to be restored is NOT currently a member of the existing AG...
Ok so why do you think you need to disable the AG, which incidentally you cannot do.
Correct sequence is
1) Restore backup of the new database to the Primary replica
2) either manually or using wizard, stage the secondary databases
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
May 4, 2018 at 8:13 am
Mike Scalise - Tuesday, May 1, 2018 9:41 AMI'm a bit of a novice when it comes to AlwaysOn, so I was hoping some of you that have expertise in this area can help me understand the high-level process for restoring a database to an AOAG cluster. Is it simply:1) Disable AOAG
2) Delete the database from the primary
3) Restore database to primary
4) Restore database to secondary (and others if necessary)
5) Enable AOAGSomething like that? Also, would your answer change if this were a true production cluster vs a non-production one (where HA isn't critical).
Thank you in advance.
Mike
Look, if the database is fine on the Primary node all you have to do is just add it to the Availability Group.
The wizard will let you know if it needs a Recovery model or a backup or both. Once it meets the prerequisites then everything should work.
If the AOAG is functioning properly.
May 7, 2018 at 9:32 am
Perry Whittle - Friday, May 4, 2018 7:23 AMMike Scalise - Thursday, May 3, 2018 7:00 AMPerry Whittle - Thursday, May 3, 2018 4:12 AMMike Scalise - Tuesday, May 1, 2018 9:41 AMI'm a bit of a novice when it comes to AlwaysOn, so I was hoping some of you that have expertise in this area can help me understand the high-level process for restoring a database to an AOAG cluster. Is it simply:1) Disable AOAG
2) Delete the database from the primary
3) Restore database to primary
4) Restore database to secondary (and others if necessary)
5) Enable AOAGSomething like that? Also, would your answer change if this were a true production cluster vs a non-production one (where HA isn't critical).
Thank you in advance.
Mike
First please specify is the database to be restored currently a member of the existing AG?
In this particular scenario, the database to be restored is NOT currently a member of the existing AG...
Ok so why do you think you need to disable the AG, which incidentally you cannot do.
Correct sequence is1) Restore backup of the new database to the Primary replica
2) either manually or using wizard, stage the secondary databases
I wasn't sure that if I didn't disable AOAG, that when I restored the database to the primary, it would automatically try to rebuild the database on the secondary. I would rather restore to both the primary and secondary and then enable AOAG (which would then recognize the same database is on the Primary and Secondary). Again, in my head that's how I envisioned it...
Mike Scalise, PMP
https://www.michaelscalise.com
May 7, 2018 at 9:41 am
jcarranza 23978 - Friday, May 4, 2018 8:13 AMMike Scalise - Tuesday, May 1, 2018 9:41 AMI'm a bit of a novice when it comes to AlwaysOn, so I was hoping some of you that have expertise in this area can help me understand the high-level process for restoring a database to an AOAG cluster. Is it simply:1) Disable AOAG
2) Delete the database from the primary
3) Restore database to primary
4) Restore database to secondary (and others if necessary)
5) Enable AOAGSomething like that? Also, would your answer change if this were a true production cluster vs a non-production one (where HA isn't critical).
Thank you in advance.
Mike
Look, if the database is fine on the Primary node all you have to do is just add it to the Availability Group.
The wizard will let you know if it needs a Recovery model or a backup or both. Once it meets the prerequisites then everything should work.
If the AOAG is functioning properly.
Ok, thanks. I'm looking for as few steps as possible. So, just to clarify, let's say I have database named "MyDatabase" on the primary and on the secondary (both part of an AG).
Then, just for argument's sake, let's say I want both instances of "MyDatabase" gone because I have a backup of a completely different database that just so happens to also be named "MyDatabase" and that I want on the Primary and Secondary--would your instructions change at all?
I realize it's an odd scenario, but I'm looking to see what would be the best or most efficient way of doing this.
Thanks,
Mike
Mike Scalise, PMP
https://www.michaelscalise.com
May 11, 2018 at 4:06 am
Mike Scalise - Monday, May 7, 2018 9:32 AMI wasn't sure that if I didn't disable AOAG, that when I restored the database to the primary, it would automatically try to rebuild the database on the secondary.
You get the option to auto create and sync or do this manually
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply