0

I have high availability enabled with two servers and when trying to restore a database I realised I had to un-synchronize the database and then remove it from the availability group.

I use Ola Hallagrens maintenance solution. Is there something I can amend with Ola's script to automatically remove DB from availability group when I run the restore job or is there a script already available, or simply not do-able?

Thanks

  • 1
    How are you restoring a DB using Ola's scripts? – scsimon Oct 16 at 13:13
2

I think you need to revise your question with clarity:

Olas scripts meant for following, not for restoring database.

  1. Backup
  2. DBCC - Integrity Check
  3. Maintenance - Index and Statistics

Aside from this, you cannot DROP or RESTORE a database while it's part of Availability Group. You can remove a database from availability group with following commands:

PRIMARY Replica:

ALTER AVAILABILITY GROUP AGName remove database DatabaseName;

SECONDARY Replica:

ALTER database DatabaseName set HADR OFF;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.