Solved

Restore SQL database to Availability Group

  • 2 April 2024
  • 2 replies
  • 25 views

Userlevel 1
Badge +5

via Command Center it is not possible to restore a SQL-database “in place” to an availability group.

 

Does anybody have a workflow or Powershell-Script that can remove the database from the availability group before the restore … and back to the availability group after the restore?

 

Any help is very much appreciated.

 

Best regards.

 

Michael

icon

Best answer by Albert Williams 3 April 2024, 02:37

View original

2 replies

Userlevel 5
Badge +12

Hello @Michael Seickert 

Thanks for the great question!
In regards to your question you can use the Pre/post script option if you build your own PowerShell script to run.

https://documentation.commvault.com/2023e/expert/pre_processes_and_post_processes_overview.html

The following commands are ones that can be used in that script: 

Remove Database:
https://learn.microsoft.com/en-us/powershell/module/sqlps/remove-sqlavailabilitydatabase?view=sqlserver-ps

Add Database:

https://learn.microsoft.com/en-us/powershell/module/sqlps/add-sqlavailabilitydatabase?view=sqlserver-ps

Kind regards
Albert Williams

Userlevel 1
Badge +5

Hi Albert,

 

This was exactly, what I am was looking for. I will try this.

 

Thank you.

 

Best regards.

Michael

Reply