Databases Not Visible in Availability Groups on Primary or Secondary Server

George Vrynios 5 Reputation points
2025-01-23T15:52:31.31+00:00

In MS SQL Servers with version "Microsoft SQL Server 2022 (RTM-CU10) (KB5031778) - 16.0.4095.4 (X64) Oct 30 2023 16:12:44 Copyright (C) 2022 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Linux (Ubuntu 20.04.6 LTS) <X64>", there is an issue with an availability group setup. A second availability group has been created successfully, but the databases are not visible under the availability databases on the primary server.

When attempting to add the database to the group, a message indicates that the database already exists in the group. On the secondary server, the databases appear in the availability group, and synchronization functions correctly.

Additionally, it has been noted that sometimes the databases are visible on the primary server but not on the secondary, while in other availability groups, the databases are not visible on either server.

The queries on the following views return relevant information about the availability group and the databases:

  • sys.dm_hadr_database_replica_states
  • sys.availability_groups
  • sys.availability_replicas
  • sys.dm_hadr_availability_replica_states

However, sys.availability_databases_cluster does not return the names of the invisible databases, only the names from the availability groups where the databases are visible. The AG Dashboard also fails to display the databases.

Any insight into resolving this issue would be greatly appreciated.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,438 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.