Listeners in AG for multiple databases

Ales Ventus 41 Reputation points

I have environment, where is one cluster with 2 nodes. In every node there are 4 Availability group each with one database and its own listener.
AG A - DB A - Listener A
AG B - DB B - Listener B
AG C - DB C - Listener C

Application uses Listener A.

There is situation where application needs to read view, that combines data from database A and database B. But database A has listener A and database B has listener B. So if application uses listener A, there can be situation where database B will be on different node as database A. And view will not work.
What is best solution for this situation?

  • Group database A and B under one Availability group and one listener?
  • Create second listener that will be same for database A and B?
  • Keep databases on the same node? - this is really bad idea I believe.


SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
9,867 questions
0 comments No comments
{count} votes

Accepted answer
  1. Dan Guzman 7,306 Reputation points
    • Group database A and B under one Availability group and one listener?

    The above is proper solution, an AG and listener with both databases. This way, the cross-database view will function regardless of the node that hosts the AG at a given time. Databases with cross-database dependencies should be part the the same AG.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Tom Phillips 17,636 Reputation points

    Just to add to Dan's response.

    What you describe is the purpose of allowing multiple databases in an AG. AGs allow you to "group" databases into dependent groups, so they all are on the same server at the same time.

    0 comments No comments