Friday, June 18, 2021

Failed to obtain the resource handle for cluster resource with name or ID 'xxxxxxxxxxxxxxx' error on Availability Group databases

We recently had failures for our Backup Maintenance Plan (performing T-Log backups) and it would fail with the below error message:

Message

Error: Maintenance plan 'Backups'.Failed to obtain the resource handle for cluster resource with name or ID '7751d61b-6354-4b73-9f9c-7b57b60a3a64'. Cluster service may not be running or may not be accessible in its current state, or the specified cluster resource name or ID is invalid.  Otherwise, contact your primary support provider

If you faced the above error message, it most likely that the backup job is unable to figure out where the backup needs to be performed for a db that is part of Availability Groups. The function sys.fn_hadr_backup_is_preferred_replica is the one that is used to used to determine if the current replica is the preferred backup replica. One more dbs could be erroring out when this function is run against them, and that is the reason the maintenance plan fails.

To check which db is causing the error, run this query

select sys.fn_hadr_backup_is_preferred_replica('DBNAME')

If you have multiple DBs, and would like to run this above query against all of them at once, use the below code. The result is not pretty looking, but you will get to know which db is erroring out for this query.

EXEC master..sp_MSForeachdb

'USE [?]

IF DB_ID(''?'') > 4

select DB_NAME()

select sys.fn_hadr_backup_is_preferred_replica(''?'')'


Once you figured out which db is erroring out, remove it from the Availability Group and re-run your maintenance plan. It should run successfully now!

Thursday, May 13, 2021

Error when perofrming SQL Install - 'the volume that contains sql server data directory does not belong to the cluster group'

​When performing SQL Install on a Failover cluster, there might be an error :

'the volume that contains sql server data directory does not belong to the cluster group'. Watch out for another error in the screen preceding this error in the Install wizard, there might be another error:

The mount point disk volume '\\?\Volume{fdba841d-9c06-11df-b213-0017a4770490}\' mounted at 'I:\$RECYCLE.BIN\S-1-5-21-1214440339-854245398-1801674531-11362\$RXP8E68\' is not a clustered resource.To continue, add the resource to the cluster, or remove the mount point to cluster the shared disk.

If you faced both these errors, read the below

​The reason for this error is that the Recycle Bin on the root drive is not empty. There could be leftover folders in the Recycle Bin from any previous deletions or cleanup. To resolve the issue, empty the recycle bin on that root letter, and attempt the install again. If that doesn't work, format the root drive and attempt the install again.

Failed to obtain the resource handle for cluster resource with name or ID 'xxxxxxxxxxxxxxx' error on Availability Group databases

We recently had failures for our Backup Maintenance Plan (performing T-Log backups) and it would fail with the below error message: Message ...