SQL DB Backup fails with Failed to enumerate database when backing up databases in Availability Group
Problem
SQL DB Backup fails with "Failed to enumerate database" when backing up databases in Availability Group
Error Message
Failed to enumerate database files for database
ERR - A failure occurred while creating an ODBC connection to SQL Server
Cause
When NetBackup backs up the databases from a SQL Availability Group it checks whether both the replicas (Primary and Secondary) are in correct state (online state) for every database . If one of the replicas of any database or databases are not in correct state (online) then NetBackup reports the above mentioned error even though other databases are in correct and healthy state.
Issue only observed where SQL Always On Availability Group is configured.
Solution
Option 1:
- Launch the SQL management Studio
- Verify the primary and secondary instances of the SQL Availability group
- Verify the state of the databases on primary and secondary replica
- If found that one of the database or databases is not in correct state (online) then perform the following actions
Please right click on "Availability Group name"
select properties
Select backup preference
please select appropriate replica as preferred replica where all databases are showing online
click OK
- The to run the backup again
- Once the database or databases are back to Online State then please change the preferred replica as per earlier settings
Option 2 :
- Launch the SQL management Studio
- Verify the primary and secondary instance of the Availability Group
- Verify the state of the databases on primary and secondary replica
- If found that one of the database on one of the replica is not in correct state (online) then perform following actions
Please contact your DBA to bring the database online state so that we can run the backup from preferred replica
- Try the backup again
- Once the database or databases are back to Online state then change the preferred replica as per earlier settings