Lesson Learned #8: Monitoring the geo-replicated databases.

We received multiple requests in order to have answered the following questions:

  • Is there needed a maintenance plan for geo-replicated databases?
  • How to monitor the geo-replicated databases

Answering the question: "Is it needed a maintenance plan for geo-replicated databases?",

No, there is not needed because is you have a maintenance plan for rebuilding indexes and update statistics for the primary database, these command will be executed in all geo-replicated databases that you have.

Answering the question: "How to monitor the geo-replicated databases".

We developed a PowerShell Script, as an example, for monitoring any geo-replicated database(s) and server(s) in Azure SQL Database. Every time that you executed this PowerShell command you will have a JSON file in the following format for every server, database, query for user database (or query master database) and YYYYMMDDHHNNSS. Please, feel free to update and improve it.