VMware Cloud Community
peaj
Contributor
Contributor

Upgrade of SQL database from 2 to 3 fails

I try to upgrade Virtual Center from 2.0 to 2.5. The upgrade fails under SQL upgrade. The SQL database is on a dedicated SQL DB server. I am using SA credentials. The VCDatabaseUpgrade.log is attached.

Here is the error lines from the log. It seems that DROP VIEW VPXV_HIST_STAT is the problem:

INSERT INTO VPX_PRIV_ROLE VALUES ('VirtualMachine.State.CreateSnapshot', 7)

INSERT INTO VPX_PRIV_ROLE VALUES ('VirtualMachine.State.RemoveSnapshot', 7)

drop view VPXV_HIST_STAT

Error: Failed to execute SQL procedure. Got exception: ERROR [ODBC SQL Server Driver][SQL Server]Cannot use DROP VIEW with 'VPXV_HIST_STAT' because 'VPXV_HIST_STAT' is a table. Use DROP TABLE.

Error: Failed to execute command: drop view VPXV_HIST_STAT

Error: Aborting upgrade because of an exception. Exception details: ERROR [ODBC SQL Server Driver][SQL Server]Cannot use DROP VIEW with 'VPXV_HIST_STAT' because 'VPXV_HIST_STAT' is a table. Use DROP TABLE.

Info: Stopping progress monitor

Info: Cleaning Up Database

Info: Rolling back database from version 3 to version 2

Info: Rolling back database from version 3 to version 2

Info: Running Upgrade-v2-to-v3\T-SQL\upd_undo_mssql.sql

if exists (select 1 from sysobjects where id = object_id('VPXV_HIST_STAT') and type = 'V') drop view VPXV_HIST_STAT

create view VPXV_HIST_STAT as select SAMPLE_TIME, SAMPLE_INTERVAL, NAME as STAT_NAME, GROUP_NAME as STAT_GROUP, ENTITY_ID, DEVICE_ID, STAT_VALUE from VPX_HIST_STAT hs, VPX_SAMPLE sa, VPX_STAT_DEF sd where hs.SAMPLE_ID = sa.ID and hs.STAT_ID = sd.ID

delete from vpx_sequence where name in ('VPX_INVENTORY_SEQ')

0 Kudos
3 Replies
HyperSprite
Enthusiast
Enthusiast

Did you add SA or was your DB always using SA?

Have you run the 2.5 DB upgrade more than once?

0 Kudos
peaj
Contributor
Contributor

Hello

I added SA when the first upgrade failed. Yes, I have tried the upgrade several time.

By the way, I have made a support request about this. The answer from support is that the database have been corrupt:

Its seems that the Database as got corrupted, it appears that VPXV_HIST_STAT is a table and should be a view, there is already an object named 'VPX_INVT_REP' in the database. This is preventing the rollback script from working properly.

There are two options that should assist in resolving the issue.

1a. Restore the Backup Database ,

1b. Run VCDatabaseUpgrade.exe from Virtual Center to upgrade database, this can be found in C:\Program Files\VMware\Infrastructure\VirtualCenter Server\dbupgrade

2a. Manually go into the database and remove VPXV_HIST_STAT table and recreate it as a view.

2b. Manually go into the database and remove duplicate VPX_INVT_REP

Option 1, would be the safer and recommended option, as option 2 can lead to further complications in the database.

0 Kudos
HyperSprite
Enthusiast
Enthusiast

Was the authentication different from your old 2.0.x install?

How did it fail the first time?

This KB describes how to do an upgrade reinstall.http://kb.vmware.com/kb/1003610

Follow all of the steps and read the KBs attached and you should be good to go.

0 Kudos