Joining DB to AOAG

Steps:


1. Disable backup jobs
2. Go to Primary node. Take a Full and TLog backup. Copy it over to the secondary.
3. Restore the full with Recovery option in secondary. Then change the owner to 'SA'. Restore the DB again. It will not change the owner any more. Another way to do it - login as 'SA' in the secondary node and then restore it.
4. Restore the TLog after that in No Recovery Mode.
5. Go to the Primary again. Right click on the AOAG name and select add databases in the AOAG.
6. In the AOAG config GUI select join only and proceed.
7. The new databases should be joined now.


Things to remember:


1. Check the owner in both nodes. it should be 'SA'. If not it needs to be changed. Another approach is to restore with command

Execute as login = 'sa';
GO
USE master;
GO -- First determine the number and names of the files in the backup. -- AdventureWorks2012_Backup is the name of the backup device. RESTORE FILELISTONLY FROM AdventureWorks2012_Backup; -- Restore the files for MyAdvWorks. RESTORE DATABASE MyAdvWorks FROM AdventureWorks2012_Backup WITH NORECOVERY, MOVE 'AdventureWorks2012_Data' TO 'D:\MyData\MyAdvWorks_Data.mdf', MOVE 'AdventureWorks2012_Log' TO 'F:\MyLog\MyAdvWorks_Log.ldf'; GO

Comments

Popular posts from this blog

Log is not getting shipped in SQL Server Logshipping

SQL Loader with dynamic control file generation

Oracle Job Operations