Tuesday, August 20, 2013

Upgrading from vCenter Server 4.1 to 5.0 fails with the Error: Exception Thrown while executing SQL script

Upgrading from vCenter Server 4.1 to 5.0 fails with the below error.
"Exception Thrown while executing SQL script"

In the %temp%\VCDatabaseUpgrade.txt log file, you see entries similar to:

[8/18/2013 5:55:27 AM] Error: Failed to execute command: if exists(select 1 from information_schema.columns
 where TABLE_NAME='VPX_HIST_STAT1'
 AND COLUMN_NAME='TIME_ID'
 AND DATA_TYPE='numeric')
 ALTER TABLE VPX_HIST_STAT1 ALTER COLUMN TIME_ID BIGINT NOT NULL;
[8/18/2013 5:55:27 AM] Got exception: ERROR [42000] [Microsoft][SQL Server Native Client 10.0][SQL Server]The index 'X_VPX_HIST_STAT1' is dependent on column 'TIME_ID'.
ERROR [42000] [Microsoft][SQL Server Native Client 10.0][SQL Server]ALTER TABLE ALTER COLUMN TIME_ID failed because one or more objects access this column.
[8/18/2013 5:55:27 AM] Error while upgrading: ERROR [42000] [Microsoft][SQL Server Native Client 10.0][SQL Server]The index 'X_VPX_HIST_STAT1' is dependent on column 'TIME_ID'.
ERROR [42000] [Microsoft][SQL Server Native Client 10.0][SQL Server]ALTER TABLE ALTER COLUMN TIME_ID failed because one or more objects access this column.
[8/18/2013 5:55:27 AM] Info: Exiting Upgrade Wizard
[8/18/2013 5:55:29 AM] Successfully run: alter database [VCDB] set recovery SIMPLE



This issue is documented in the VMware KB - 2011533

However the steps provided do not work since the resolution steps in the KB talk about dropping the index named 'INDX_TIME_ID'. In my case, the index was 'X_VPX_HIST_STAT1' and therefore I had to alter the commands accordingly.

DROP INDEX VPX_HIST_STAT1.X_VPX_HIST_STAT1

And most IMPORTANTLY, perform the steps mentioned in the above KB, after you restore the vCenter Database from a backup.
If you were to perform the steps on the same DB on which the upgrade failed, you will run into the issue mentioned in VMware kb 2020504

No comments:

Post a Comment