Skip to content

Instantly share code, notes, and snippets.

@melvinlee
Created March 3, 2017 07:07
Show Gist options
  • Save melvinlee/54a917a1c04c3454c8e3c6c91e95b403 to your computer and use it in GitHub Desktop.
Save melvinlee/54a917a1c04c3454c8e3c6c91e95b403 to your computer and use it in GitHub Desktop.
-- Remove database from Availability Group:
Alter Database [StackExchange.Bicycles.Meta] SET HADR OFF;
-- Apply t-logs to catch up. This can be done manually in SSMS or via:
RESTORE LOG [StackExchange.Bicycles.Meta] FROM DISK = '\\ny-back01\backups\SQL\_Trans\SENetwork_AG\StackExchange.Bicycles.Meta\StackExchange.Bicycles.Meta_LOG_20160217_033201.trn' WITH NORECOVERY;
-- Re-join database to availability group
ALTER DATABASE [StackExchange.Bicycles.Meta] SET HADR AVAILABILITY GROUP = [SENetwork_AG];
ALTER DATABASE [StackExchange.Bicycles.Meta] SET HADR RESUME;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment