Upgrade to 6.0.0 - Database upgrade fails

Started by ChrisSR, February 05, 2026, 02:51:49 PM

Previous topic - Next topic

ChrisSR

Had a previous install of 5.2.8 on Windows. Installation of 6.0.0 went smoothly, no issues presented. Upon trying to connect with the new client, found that netxms core service not running. Tried running "nxdbmgr upgrade" but get the following error:

PS C:\NetXMS\bin> .\nxdbmgr upgrade
NetXMS Database Manager Version 6.0.0 Build 6.0-444-gb145606172

Upgrading database...
Upgrading from version 60.7 to 60.8
SQL query failed ([Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The object 'PK__idata__410D428BF41FA2F0' is dependent on column 'idata_timestamp'.):
ALTER TABLE idata ALTER COLUMN idata_timestamp bigint
Rolling back last stage due to upgrade errors...
Database upgrade failed

ChrisSR

Sorry, just realized I'm on 5.2.6, not 5.2.8.

Victor Kirhenshtein

I will fix upgrade procedure. In the meantime, you can drop and re-create tables idata and tdata (they should be empty as they normally not used in MS SQL setup, so just to make upgrade procedure work):

DROP TABLE idata;
CREATE TABLE idata
(
   item_id integer not null,
   idata_timestamp integer not null,
   idata_value varchar(255) null,
   raw_value varchar(255) null
);
DROP TABLE tdata;
CREATE TABLE tdata
(
   item_id integer not null,
   tdata_timestamp integer not null,
   tdata_value varchar(max) null
);

and then re-run nxdbmgr upgrade.

dreamscape

Hi Victor,

Talked to you yesterday on Telegram and you directed me to this post, I've try this now but it failing to upgrade, see attached, any ideas please?

Thanks.

C:\NetXMS\bin>nxdbmgr check
NetXMS Database Manager Version 6.0.0 Build 6.0-444-gb145606172

Checking database (excluding collected data):
Your database has format version 60.7, this tool is compiled for version 60.30.
Use "upgrade" command to upgrade your database first.
Database check aborted

C:\NetXMS\bin>nxdbmgr upgrade
NetXMS Database Manager Version 6.0.0 Build 6.0-444-gb145606172

Upgrading database...
Upgrading from version 60.7 to 60.8
Converting table idata_100
SQL query failed ([Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Cannot define PRIMARY KEY constraint on nullable column in table 'idata_100'.):
ALTER TABLE idata_100 ADD CONSTRAINT pk_idata_100 PRIMARY KEY (item_id,idata_timestamp)
Converting table tdata_100
SQL query failed ([Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Cannot define PRIMARY KEY constraint on nullable column in table 'tdata_100'.):
....
.....
ALTER TABLE tdata_446 ADD CONSTRAINT pk_tdata_446 PRIMARY KEY (item_id,tdata_timestamp)
Converting table idata_450
SQL query failed ([Microsoft][ODBC Driver 18 for SQL Server][SQL Server]The transaction log for database 'NETXMS' is full due to 'ACTIVE_TRANSACTION' and the holdup lsn is (106450:128624:1).):
UPDATE idata_450 SET idata_timestamp = idata_timestamp * 1000
Rolling back last stage due to upgrade errors...
Database upgrade failed

C:\NetXMS\bin>

ChrisSR

Unfortunately I hit the same yesterday as Dreamscape. I tried marking the transaction log as unlimited size growth, but then I ran out of disk space (I have over 100GB free). I copied all the lines I saw and filtered out just the SQL commands and ran them manually, and on "UPDATE idata_1088 SET idata_timestamp = idata_timestamp * 1000" I get an error of "Arithmetic overflow error converting expression to data type int."

Ignoring that last error, running the upgrade command again gives me:

PS C:\netxms\bin> .\nxdbmgr.exe upgrade
NetXMS Database Manager Version 6.0.0 Build 6.0-444-gb145606172

INFO: Server module WEBAPI skipped
Upgrading database...
Upgrading from version 60.7 to 60.8
SQL query failed ([Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The object 'PK__idata__410D428BF41FA2F0' is dependent on column 'idata_timestamp'.):
ALTER TABLE idata ALTER COLUMN idata_timestamp bigint
Rolling back last stage due to upgrade errors...
Database upgrade failed

Victor Kirhenshtein

I'm looking into it. We expect to have patch release 6.0.1 with improved DB upgrade on Monday.

SmEed

Hello Victor.

Unfortunately, the same problem here.

Best Regards!
Leo

twparker

Hello,

I am running into a similar issue on a Ubuntu installation where the database has taken multiple days to upgrade showing that it is converting idata and tdata tables, but never completing.

Thanks in advance!

Victor Kirhenshtein

Just published version 6.0.1 that should address database upgrade issue. Now it does not convert data immediately, but do this in background while server is running, in chunks by 24 hors, so you should gradually get your collected data back, starting from most recent.

SmEed

It looks good. Thanks a lot and best regards from KTM. ;)

dreamscape

#10
Thanks for the update, I'm still having issues with my one though.....

I restored the db back to the version 5.2.8 before i updated to 6.0.0

I've then run the new version 6.0.1 but the core service will not start, log file says:

2026.02.10 08:47:19.444 *E* [db] Your database has format version 52.23, but server is compiled for version 60.32

If i then try 'nxdbmgr check' i get:

C:\NetXMS\bin>nxdbmgr check
NetXMS Database Manager Version 6.0.1 Build 6.0-469-g5e68d5db1d

Error loading configuration file


Any ideas please?



Filipp Sudanov

Quote from: dreamscape on February 10, 2026, 10:55:09 AMC:\NetXMS\bin>nxdbmgr check
NetXMS Database Manager Version 6.0.1 Build 6.0-469-g5e68d5db1d

Error loading configuration file
Make sure you run this in cmd session started with administrator rights - looks like there's access right issue to the server config file.

Message Your database has format version 52.23, but server is compiled for version 60.32 means that nxdbmgr upgraded did not happen (first part of format version is basically netxms version, so 52.23 means that database format is for 5.2.x).

nxdbmgr check will tell that db version is old, so try running nxdbmgr upgrade

dreamscape

Thanks for the quick reply, yes, school boy error, it was admin cmd access.

currently sat at:

2026.02.10 11:35:45.590 *I* [dc.v5migrate       ] Migrating recent data from v5 tables (106 idata, 3 tdata)

Filipp Sudanov

yes, that's background migration, server reads collected data both from non-migrated and migrated tables, so everything should work even during migration.
Would be interesting to know how long it takes on your system and how big it is (sh st output - number of nodes, dci count, size of the DB)

dreamscape

Finished in about 15 minutes, db is around 8GB, not sure how many nodes

2026.02.10 11:35:45.590 *I* [dc.v5migrate       ] Migrating recent data from v5 tables (106 idata, 3 tdata)
2026.02.10 11:50:21.154 *I* [dc.v5migrate       ] Recent v5 data migration completed (109 tables migrated)