Note: Ensure to take a backup of the vCenter Server database before proceeding. For more information, see Backing up the vCenter Server database running on Microsoft SQL or SQL Express server (2012138).
To correct any Alarms associated with invalid Virtual Machines or invalid Datastores:
- To retrieve the details about the alarms configured in the vCenter Server, run this query:
- For MSSQL, run query:
SELECT a.ALARM_ID, a.NAME, a.ENTITY_ID, a.ENTITY_TYPE, b.OBJECT_TYPE, b.OBJECT_PATH FROM VPX_ALARM a JOIN VPX_ALARM_EXPRESSION b ON a.ALARM_ID=b.ALARM_ID WHERE a.ALARM_ID !='' AND OBJECT_TYPE != '';
- For Oracle, run query:
SELECT a.ALARM_ID, a.NAME, a.ENTITY_ID, a.ENTITY_TYPE, b.OBJECT_TYPE, b.OBJECT_PATH FROM VPX_ALARM a JOIN VPX_ALARM_EXPRESSION b ON a.ALARM_ID=b.ALARM_ID WHERE a.ALARM_ID is not null AND OBJECT_TYPE is not null;
- Make a note of all the values reported in the
ENTITY_ID
column. - Use this query to get the description about the values in
ENTITY_ID
reported in the previous step.
SELECT * FROM VPX_ENTITY where ID = XXXXX
where XXXXX
is the Entity ID identified in the first step above. This needs to be repeated for each unique ENTITY_ID.
- Identify an
ENTITY_ID
that does not exist in the VPX_ENTITY
table, and note its ALARM_ID
. - Once the
ALARM_ID
is identified, run these commands to remove it:
DELETE from VPX_ALARM_ACTION where ALARM_ID = XX
DELETE from VPX_ALARM_EXPRESSION where ALARM_ID = XX
DELETE from VPX_ALARM where ALARM_ID = XX
where XX
is the ALARM_ID
identified in step #3.
Note: The DELETE
statement removes all alarms, whether they are default or customized.
- Create any necessary default alarms. For more information, see How to create default alarms when upgrading to vCenter Server 4.0 (1010399).
To correct any DRS rules associated with invalid virtual machines:
- Run this query to find any invalid virtual machine ID and the associated rule ID:
select ruleVms.* from(select id as ruleId, cast( substring(cast(RULES_INFO as xml).value('declare default element namespace "urn:vim25"; (/obj/ClusterRuleInfo/vm)[1]','varchar(20)'),4,10) as int) as vmid from VPX_COMPUTE_RESOURCE) as ruleVms
where not exists (select 1 from VPX_ENTITY e where e.ID = ruleVms.vmid)
and ruleVms.vmid is not NULL
For example, you see a query result similar to: - Get the rule info from the appropriate table:
select rules_info from VPX_COMPUTE_RESOURCE where id = 49
Sample query returned is similar to:
<obj xmlns:xsd="</SPAN> http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xmlns="urn:vim25" versionId="5.0" xsi:type="ArrayOfClusterRuleInfo"><ClusterRuleInfo xsi:type="ClusterAntiAffinityRuleSpec"><key>1</key><enabled>true</enabled><name>FFX-DCs</name><userCreated>true</userCreated> <vm type="VirtualMachine" xsi:type="ManagedObjectReference">vm-34</vm><vm type="VirtualMachine" xsi:type="ManagedObjectReference">vm-27</vm></ClusterRuleInfo></obj>
- Rewrite the query results from Step 2, removing only the invalid virtual machine ID (the XML content in Red) and then update the DRS rule using this query:
update VPX_COMPUTE_RESOURCE
set RULES_INFO='<obj xmlns:xsd="</SPAN> http://www.w3.org/2001/XMLSchema " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xmlns="urn:vim25" versionId="5.0" xsi:type="ArrayOfClusterRuleInfo"><ClusterRuleInfo xsi:type="ClusterAntiAffinityRuleSpec"><key>1</key><enabled>true</enabled><name>FFX-DCs</name><userCreated>true</userCreated><vm type="VirtualMachine" xsi:type="ManagedObjectReference">vm-27</vm></ClusterRuleInfo></obj>'
where ID = 49
- Repeat Steps 2 and 3 for each row if multiple virtual machines are returned by Step 1.
After both DRS rules and Alarms have are corrected, vCenter Server should start successfully.