In this post we will see how to add a database that hosts PolyBase external tables to an Always On Availability Group. In the previous post we have extracted data from external files stored in Azure Data Lake Gen 2 storage using PolyBase.
Scenario
- A database “MAQDB” that hosts external tables.
- Database is encrypted by the Database Master Key
- Two nodes Always On Availability Group
Solution
-
-
- Create Database Master Key on all secondary nodes using stored procedure “sp_control_dbmasterkey_password”. In our case with the following statement:
123EXEC sp_control_dbmasterkey_password @dbname=N'MAQDB', @password=N'Pa55w.rd@123', @action=N'add' - Add the database “MAQDB” to an already created availability group “agMAQ” using wizard. You will see that the “Check Box” associated with “MAQDB” database is disabled with “Password required” status.
- Double click in the “Password” column to enter the password and press the “Refresh” button at the bottom of the screen after entering the password to enable the “Check Box” next to the database.
- Select the database “MAQDB”
- Connect to secondary replica
- I am choosing “Join Only” as I have already restored the database on the secondary node.
- Finish the wizard and your database will be added to the availability group
- Connect using listener name
- Create Database Master Key on all secondary nodes using stored procedure “sp_control_dbmasterkey_password”. In our case with the following statement:
-
You can also use the following statement to add the above database to availability group
1 2 |
ALTER AVAILABILITY GROUP agMAQ ADD DATABASE MAQDB; GO |
Leave a Reply
Be the First to Comment!