[Company Logo Image] 

Home Up Contents Coffee Break Credits Glossary Links Search

 
Unable to connect to the VMM database

 

 

Home
Analysis Services
Azure
CLR Integration
High Availability
Open Source
Security
SQL Server 2008
SQL Server 2012
SQL Server 2014
SQL Server 2016
Tips
Troubleshooting
Tuning

Unable to connect to the VMM database.


Applies to: SQL Server 2012 Enterprise Edition, System Center Virtual Machine Manager 2012 SP1.
 

Problem Description.
 

My teammates at work tried to delete a two-node failover cluster from Virtual Machine Manager console, and received the following errors:



Error (20400)
1 parallel subtasks failed during execution.

Error (2605)
Unable to connect to the VMM database because of a general database failure.
SQL error code: 547.

Recommended Action.
Ensure that the SQL Server is running and configured correctly, then try the operation again.


After receiving above error messages my teammates verified that only one of the nodes was removed.


Workaround.


We found a T-SQL script to workaround those errors on the following thread on TechNet forums:

http://social.technet.microsoft.com/Forums/systemcenter/en-US/116aa1e4-63f0-43ec-af14-22612dd16401/cannot-remove-vmhostcluster-error-20400-parallel-subtasks-failed-and-error-2605-general-database?forum=virtualmachinemanager

The script of the thread contained delete statements to be executed on the VMM database, statements intended to remove the node that VMM console does not allow to remove. We added a few more delete statements to the original script to successfully remove the other cluster node.

The following is the resultant script:

USE VirtualManagerDB

DECLARE @HostClusterId uniqueidentifier

SET @HostClusterId = (Select HostClusterId from tbl_ADHC_Host WHERE ComputerName = 'nodename.domain')

DELETE
FROM
tbl_PMM_PhysicalMachine
WHERE [PhysicalMachineId] IN (Select [PhysicalMachineId] from tbl_ADHC_Host WHERE ComputerName = 'nodename.domain')

DELETE FROM tbl_ADHC_ISCSIHbaToPortalMapping
WHERE ISCSIHbaID IN (SELECT ISCSIHbaID FROM tbl_ADHC_HostInternetSCSIHba WHERE ISCSIHbaID IN (SELECT HbaID from tbl_ADHC_HostBusAdapter WHERE HostID IN (Select HostID from tbl_ADHC_Host WHERE HostClusterID = @HostClusterId)))

DELETE FROM tbl_ADHC_ISCSIHbaToTargetMapping
WHERE ISCSIHbaID IN (SELECT ISCSIHbaID FROM tbl_ADHC_HostInternetSCSIHba WHERE ISCSIHbaID IN (SELECT HbaID from tbl_ADHC_HostBusAdapter WHERE HostID IN (Select HostID from tbl_ADHC_Host WHERE HostClusterID = @HostClusterId)))

DELETE FROM tbl_ADHC_HostInternetSCSIHba
WHERE ISCSIHbaID IN (SELECT HbaID from tbl_ADHC_HostBusAdapter WHERE HostID IN (Select HostID from tbl_ADHC_Host WHERE HostClusterID = @HostClusterId))

DELETE FROM tbl_ADHC_FCHbaToFibrePortMapping
WHERE FCHbaID IN (SELECT FCHbaID FROM tbl_ADHC_HostFibreChannelHba WHERE FCHbaID IN (SELECT HbaID from tbl_ADHC_HostBusAdapter WHERE HostID IN (Select HostID from tbl_ADHC_Host WHERE HostClusterID = @HostClusterId)))

DELETE FROM tbl_ADHC_HostFibreChannelHba
WHERE FCHbaID IN (SELECT HbaID from tbl_ADHC_HostBusAdapter WHERE HostID IN (Select HostID from tbl_ADHC_Host WHERE HostClusterID = @HostClusterId))

DELETE from tbl_ADHC_HostBusAdapter
WHERE HostID IN (Select HostID from tbl_ADHC_Host WHERE HostClusterID = @HostClusterId)

DELETE from tbl_NetMan_InstalledVirtualSwitchExtension --NO FK
WHERE HostID IN (Select HostID from tbl_ADHC_Host WHERE HostClusterID = @HostClusterId)

DELETE FROM dbo.tbl_ADHC_HostDisk
WHERE ClusterDiskID IN (SELECT DiskID from tbl_ADHC_ClusterDisk
WHERE ClusterID = @HostClusterId)

DELETE from tbl_ADHC_ClusterDisk
WHERE
ClusterID = @HostClusterId

DELETE FROM tbl_WLC_VMTemplateRelation
WHERE TemplateId IN (SELECT ObjectId FROM tbl_WLC_VObject WHERE HostID IN (Select HostID FROM tbl_ADHC_Host WHERE HostClusterID = @HostClusterId))

DELETE FROM tbl_WLC_VMInstance

WHERE ObjectId IN (SELECT ObjectId FROM tbl_WLC_VObject WHERE HostID IN (Select HostID FROM tbl_ADHC_Host WHERE HostClusterID = @HostClusterId))

DELETE FROM tbl_WLC_VObject
WHERE
HostID IN (Select HostID FROM tbl_ADHC_Host WHERE HostClusterID = @HostClusterId)

--DELETE from tbl_NetMan_HostNetworkAdapterToLogicalNetwork

--WHERE HostNetworkAdapterID IN (SELECT NetworkAdapterID from tbl_ADHC_HostNetworkAdapter WHERE HostID = 'BB53CF34-452A-464E-A753-D0D42D79168E')

--DELETE from tbl_NetMan_HostNetworkAdapterToIPSubnetVLan --EMPTY

--WHERE HostNetworkAdapterID IN (SELECT NetworkAdapterID from tbl_ADHC_HostNetworkAdapter WHERE HostID = 'BB53CF34-452A-464E-A753-D0D42D79168E')

DELETE FROM tbl_NetMan_HostNetworkAdapterToLogicalNetwork
WHERE HostNetworkAdapterID IN (SELECT NetworkAdapterID from tbl_ADHC_HostNetworkAdapter
WHERE HostID IN (SELECT HostID FROM tbl_ADHC_VirtualNetwork WHERE HostID IN (Select HostID FROM tbl_ADHC_Host WHERE HostClusterID = @HostClusterId)))

DELETE from tbl_ADHC_HostNetworkAdapter
WHERE
HostID IN (SELECT HostID FROM tbl_ADHC_VirtualNetwork WHERE HostID IN (Select HostID from tbl_ADHC_Host WHERE HostClusterID = @HostClusterId))


DELETE
from tbl_ADHC_VirtualNetwork

WHERE HostID IN (Select HostID FROM tbl_ADHC_Host WHERE HostClusterID = @HostClusterId)


DELETE
FROM tbl_ADHC_HostVolume

WHERE HostID IN (SELECT HostID from tbl_ADHC_Host

WHERE HostClusterID = @HostClusterId)


DELETE
FROM tbl_ADHC_HostDisk

WHERE HostID IN (SELECT HostID from tbl_ADHC_Host

WHERE HostClusterID = @HostClusterId)
 

DELETE from tbl_ADHC_Host

WHERE HostClusterID = @HostClusterId


After running the above script we removed the cluster (name) from the SCVMM console.



 

 

.Send mail to webmaster@sqlcoffee.com with questions or comments about this web site.