VMware VirtualCenter Server service fails and reports the error: FK_COMP_RES_VSAN_REF_HOST
search cancel

VMware VirtualCenter Server service fails and reports the error: FK_COMP_RES_VSAN_REF_HOST

book

Article ID: 309878

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Symptoms:
  • VMware VirtualCenter Server service fails
  • In the vpxd.log file, RowLock errors on the database, you see entries similar to:
mem> YYYY-MM-DD TIME .779+10:00 [06764 error 'commonvpxCommon' opID=1F335118-000004FA-55] [Vpxd_HandleVmRootError] Received unrecoverable VmRootError. Generating minidump ...
mem> YYYY-MM-DD TIME .779+10:00 [06764 error 'Default' opID=1F335118-000004FA-55] An unrecoverable problem has occurred, stopping the VMware VirtualCenter service. Error: Error[VdbODBCError] (-1) "ODBC error: (23000) - [Microsoft][SQL Server Native Client 10.0][SQL Server]The INSERT statement conflicted with the FOREIGN KEY constraint "FK_COMP_RES_VSAN_REF_HOST". The conflict occurred in database "VIM_VCDB", table "dbo.VPX_HOST", column 'ID'." is returned when executing SQL statement "INSERT INTO VPX_COMPUTE_RESOURCE_VSAN_HOST WITH (ROWLOCK) (COMP_RES_ID, HOST_ID, NODE_UUID, CLUSTER_UUID, AUTOCLAIM_STORAGE, ENABLED) VALUES (?, ?, ?, ?, ?, ?)"
mem> YYYY-MM-DD TIME .809+10:00 [06764 verbose 'commonvpxCommon' opID=1F335118-000004FA-55] Backtrace:
mem> -->
mem> YYYY-MM-DD TIME .116+10:00 [06764 panic 'Default' opID=1F335118-000004FA-55] (Log recursion level 2) Unrecoverable VmRootError. Panic!


Environment

VMware vCenter Server 5.1.x
VMware vCenter Server 6.0.x
VMware vCenter Server 5.0.x
VMware vCenter Server 5.5.x

Cause

This issue occurs because the SQL Server is unstable due to growing too large and stale entries.

Resolution

To resolve this issue, truncate the vCenter Server event records.

To truncate the vCenter Server event records:
  1. Stop the VMware VirtualCenter Server service. For more information, see Stopping, starting, or restarting VMware vCenter Server services (1003895).

    Note: This procedure modifies the database. Ensure to take a backup of the database before proceeding.

  2. Run these queries on the vCenter Server database in the sequence specified:
alter table VPX_EVENT_ARG drop constraint FK_VPX_EVENT_ARG_REF_EVENT, FK_VPX_EVENT_ARG_REF_ENTITY alter table VPX_ENTITY_LAST_EVENT drop constraint FK_VPX_LAST_EVENT_EVENT

truncate table VPX_TASK

truncate table VPX_ENTITY_LAST_EVENT

truncate table VPX_EVENT

truncate table VPX_EVENT_ARG

alter table VPX_EVENT_ARG add constraint FK_VPX_EVENT_ARG_REF_EVENT foreign key(EVENT_ID) references VPX_EVENT (EVENT_ID) on delete cascade, constraint FK_VPX_EVENT_ARG_REF_ENTITY foreign key (OBJ_TYPE) references VPX_OBJECT_TYPE (ID)

alter table VPX_ENTITY_LAST_EVENT add constraint FK_VPX_LAST_EVENT_EVENT foreign key(LAST_EVENT_ID) references VPX_EVENT (EVENT_ID) on delete cascade
Shrink Database

For more information on purging old data and setting retention policies, see Purging old data from the database used by VMware vCenter Server (1025914).

Additional Information

Purging old data from the database used by vCenter Server
VMware VirtualCenter Server 服务失败并报告以下错误: FK_COMP_RES_VSAN_REF_HOST
VMware VirtualCenter Server サービスが失敗し、次のエラーが報告される: FK_COMP_RES_vSAN_REF_HOST