Bobcares

How to fix SQL server error 976?

by | Sep 4, 2020

SQL server error 976 occurs while connecting to the secondary replica of AlwaysOn Availability Group configuration.

As a part of our Server Management Services, we help our Customers to fix SQL related errors regularly.

Let us today discuss the possible causes and fixes for this error.

What is SQL server error 976?

An availability group supports a replicated environment for a discrete set of user databases, known as availability databases.

Each set of availability database is hosted by an availability replica. Two types of availability replicas exist:

  • A single primary replica that hosts the primary databases.
  • One to eight secondary replicas, each of which hosts a set of secondary databases and serves as a potential failover target for the availability group.

Further, SQL server error 976 occurs while connecting to the secondary replica of AlwaysOn Availability Group configuration.

For instance, a typical error message looks like:

~~
Cannot connect to ‘Secondary Replica Server’.

ADDITIONAL INFORMATION:
The target database, ‘SDGC’, is participating in an availability group and is currently not accessible for queries. Either data movement is suspended or the availability replica is not enabled for read access. To allow read-only access to this and other databases in the availability group, enable read access to one or more secondary availability replicas in the group. For more information, see the ALTER AVAILABILITY GROUP statement in SQL Server Books Online. (Microsoft SQL Server, Error: 976)
~~

What causes SQL server error 976?

The possible reasons for the 976  error include:

  • Disconnected availability replica.
  • Suspended data movement.
  • Inaccessible database.
  • Temporary delay due to network latency or the load on the primary or secondary replica.

Let us now look at the steps to fix this error.

How to fix SQL server error 976?

As there are a number of reasons that trigger the error 976,  there are multiple methods available to fix it. Some of them to list out include:

1. Change Connect to database value in SQL Server Management Studio while establishing the connection.
2. Change default database value of your Login in Login Property window.
3. Force the resume synchronization

Change Connect to database value in SSMS

  • Initially, from the SQL Server Management Studio, click on Options tab of the connection details window in SSMS.
  • The ‘Connect to database’ value will now show as ‘default’. Now, verify if the default database for the user’s login is the same as that of the database facing issues.
  • If yes, change the “connect to database” value from default to master or some other database.
  • Once you make changes, hit the connect button and establish a database connection. This time you will be able to establish a database connection to the secondary replica.

Change default database value of your Login

We can fix this issue permanently by changing the default database for login to a master one. However, this can only be done if it is not mandatory for the default database of the login to be an availability database.

To change the default database, we can connect to the secondary replica or to the server where we are facing this issue. This can be done using a different admin or security admin account. A right-click on SSMS icon while pressing SHIFT button will help to login using a different user to the SQL Server instance.

  • Click on “Run as different user” option. Enter the new credentials in the login screen displayed.
  • After authentication, it launches SSMS. Click on Connect button to establish the connection.
  • Now expand Security folder and Identify the login for which you have to change the default database setting.
  • Right-click and choose properties on this login to launch properties window. It shows the default database set for this login.
  • Now we need to change it to master or any accessible database. Once you make changes, click on Ok button to proceed.

 

Force the resume synchronization

Using a T-SQL command to force the resume synchronization can also help to fix this error. The command is as follows:

ALTER DATABASE YourDatabase SET HADR RESUME;

Further, we can perform this task using SQL Server Management Studio as well:

  • In Object Explorer, connect to the server instance that hosts the availability replica. Then, expand the server tree.
  • Now, expand the AlwaysOn High Availability node and the Availability Groups node.
  • Then, expand the Availability Databases node, right-click the database, and click Resume Data Movement.
  • Finally, in the Resume Data Movement dialog box, click OK.

[Need any further assistance in fixing SQL errors? – We’re available 24*7]

 

Conclusion

In short, SQL server error 976 occurs while connecting to the secondary replica of AlwaysOn Availability Group configuration. Today, we saw how our Support Engineers fix this error.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF