NetXMS Support Forum

English Support => General Support => Topic started by: ChrisSR on February 05, 2026, 02:51:49 PM

Title: Upgrade to 6.0.0 - Database upgrade fails
Post by: ChrisSR on February 05, 2026, 02:51:49 PM
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
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: ChrisSR on February 05, 2026, 03:20:31 PM
Sorry, just realized I'm on 5.2.6, not 5.2.8.
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Victor Kirhenshtein on February 05, 2026, 03:20:47 PM
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.
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: dreamscape on February 06, 2026, 02:36:17 PM
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>
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: ChrisSR on February 06, 2026, 03:19:15 PM
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
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Victor Kirhenshtein on February 06, 2026, 06:46:17 PM
I'm looking into it. We expect to have patch release 6.0.1 with improved DB upgrade on Monday.
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: SmEed on February 09, 2026, 03:04:15 PM
Hello Victor.

Unfortunately, the same problem here.

Best Regards!
Leo
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: twparker on February 09, 2026, 07:45:30 PM
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!
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Victor Kirhenshtein on February 09, 2026, 11:33:00 PM
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.
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: SmEed on February 10, 2026, 08:18:00 AM
It looks good. Thanks a lot and best regards from KTM. ;)
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: dreamscape on February 10, 2026, 10:55:09 AM
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?


Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Filipp Sudanov on February 10, 2026, 12:16:24 PM
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
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: dreamscape on February 10, 2026, 01:42:57 PM
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)
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Filipp Sudanov on February 10, 2026, 01:57:28 PM
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)
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: dreamscape on February 10, 2026, 04:08:54 PM
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)
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: twparker on February 10, 2026, 04:52:14 PM
I can see that the database upgrade is happening in the background, but the netxms-server service won't start.

"Your database has format version 60.7, but server is compiled for version 60.32"
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Filipp Sudanov on February 10, 2026, 06:51:20 PM
Quote from: twparker on February 10, 2026, 04:52:14 PMI can see that the database upgrade is happening in the background, but the netxms-server service won't start.
"Your database has format version 60.7, but server is compiled for version 60.32"
Are you still in upgrade to 6.0.0, or you've restarted upgrade to 6.0.1?

...happening in the background - is it nxdbmgr background-upgrade running? If so, you need for it to finish and then run nxdbmgr upgrade again - it will upgrade schema further. This step could be a background one in 5.2, but when upgrading to 6.0 we need it to complete prior to subsequent db upgrade steps.
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: twparker on February 10, 2026, 07:05:03 PM
I saw the database upgrade start when I used apt get upgrade. I thought that the server could then be started while that was running, but I suppose not.
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: dlauwers on February 12, 2026, 02:21:17 AM
Hi,

Did all the updates/upgrades to be on 6.01, rebooted, bus till

NetXMS Database Manager Version 6.0.1 Build 6.0-469-g5e68d5db1d

Upgrading database...
Upgrading from version 60.7 to 60.8
SQL query failed (25P02 ERROR:  current transaction is aborted, commands ignored until end of transaction block):
CREATE TABLE tdata_16066 (item_id integer not null,tdata_timestamp bigint not null,tdata_value text null, PRIMARY KEY(item_id,tdata_timestamp))
Rolling back last stage due to upgrade errors...
Database upgrade failed

On Debian 13
PostgreSQL 17.7

Any fixes or workarrounds ?

Thanks
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: twparker on February 12, 2026, 05:14:12 PM
I am receiving similar errors, but I believe I caused my own problems by running the commands that Victor posted earlier.

QuoteDROP 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
);

Is my database irrevocably damaged?
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Filipp Sudanov on February 13, 2026, 02:29:45 PM
dlauwers, twparker
can you run
nxdbmgr -t upgrade

This is to see what exactly it's doing there
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: twparker on February 13, 2026, 06:33:31 PM
Getting a lot of text - here's a snippet

QuoteDROP TABLE tdata_8505
>>> RELEASE SAVEPOINT nxdbmgr_1771000353984
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_0'
>>> CREATE TABLE tdata_8505 (item_id integer not null,tdata_timestamp bigint not null,tdata_value text null, PRIMARY KEY(item_id,tdata_timestamp))
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_1'
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_2'
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_3'
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_4'
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_5'
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_6'
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_7'
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_8'
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_9'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_0'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_1'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_2'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_3'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_4'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_5'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_6'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_7'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_8'
>>> SELECT var_value FROM metadata WHERE var_name='TDataIndexCreationCommand_9'
>>> SELECT COUNT(*) FROM idata_74790
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: twparker on February 13, 2026, 06:48:56 PM
This appears more relevant


>>> RELEASE SAVEPOINT nxdbmgr_1771000399839
>>> SELECT var_value FROM metadata WHERE var_name='IDataTableCreationCommand'
>>> CREATE TABLE idata_46970 (item_id integer not null,idata_timestamp bigint not null,idata_value varchar(255) null,raw_value varchar(255) null, PRIMARY KEY(item_id,idata_timestamp))
SQL query failed (25P02 ERROR:  current transaction is aborted, commands ignored until end of transaction block):
CREATE TABLE idata_46970 (item_id integer not null,idata_timestamp bigint not null,idata_value varchar(255) null,raw_value varchar(255) null, PRIMARY KEY(item_id,idata_timestamp))
Rolling back last stage due to upgrade errors...
Database upgrade failed
>>> SELECT var_value FROM metadata WHERE var_name='PendingOnlineUpgrades'

Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Filipp Sudanov on February 15, 2026, 08:41:47 PM
There was some query just before CREATE TABLE idata_46970 which failed.
60.7 to 60.8 handles idata/tdata tables, doing this:

  1. Check if idata_<id> exists
  2. If the table is empty → DROP it
  3. If the table is not empty → RENAME it to idata_v5_<id>
  4. Create a new idata_<id> table using CreateIDataTable(id)

Pls check, do you have
idata_46970
idata_v5_46970
tables in the DB?

If idata_46970 is there, pls show output of
\d idata_46970
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: dlauwers on February 16, 2026, 12:26:29 PM
Quote from: Filipp Sudanov on February 13, 2026, 02:29:45 PMdlauwers, twparker
can you run
nxdbmgr -t upgrade

This is to see what exactly it's doing there

Hi, this is the result

It is "working on" Create Table tdata_16066 for about 5 minutes and then it fails

>>> SELECT COUNT(*) FROM idata_16066
>>> SAVEPOINT nxdbmgr_1771234999753
>>> DROP TABLE idata_16066
>>> RELEASE SAVEPOINT nxdbmgr_1771234999753
>>> SELECT var_value FROM metadata WHERE var_name='IDataTableCreationCommand'
>>> CREATE TABLE idata_16066 (item_id integer not null,idata_timestamp bigint not null,idata_value varchar(255) null,raw_value varchar(255) null, PRIMARY KEY(item_id,idata_timestamp))
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_0'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_1'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_2'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_3'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_4'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_5'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_6'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_7'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_8'
>>> SELECT var_value FROM metadata WHERE var_name='IDataIndexCreationCommand_9'
>>> SELECT COUNT(*) FROM tdata_16066
>>> SAVEPOINT nxdbmgr_1771234999765
>>> DROP TABLE tdata_16066
>>> RELEASE SAVEPOINT nxdbmgr_1771234999765
>>> SELECT var_value FROM metadata WHERE var_name='TDataTableCreationCommand_0'
>>> CREATE TABLE tdata_16066 (item_id integer not null,tdata_timestamp bigint not null,tdata_value text null, PRIMARY KEY(item_id,tdata_timestamp))
SQL query failed (25P02 ERROR:  current transaction is aborted, commands ignored until end of transaction block):
CREATE TABLE tdata_16066 (item_id integer not null,tdata_timestamp bigint not null,tdata_value text null, PRIMARY KEY(item_id,tdata_timestamp))
Rolling back last stage due to upgrade errors...
Database upgrade failed
>>> SELECT var_value FROM metadata WHERE var_name='PendingOnlineUpgrades'
:$
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Alex Kirhenshtein on February 16, 2026, 12:27:30 PM
Check Postgres's log - good chance you run out of shared memory
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: dlauwers on February 16, 2026, 12:33:07 PM
Seems that the table is empty ?

postgres psql -d netxms -c "SELECT * FROM idata_16066 LIMIT 10;"
[sudo] password for xxxxxx:
 item_id | idata_timestamp | idata_value | raw_value
---------+-----------------+-------------+-----------
(0 rows)

Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: dlauwers on February 16, 2026, 01:00:14 PM
Quote from: Alex Kirhenshtein on February 16, 2026, 12:27:30 PMCheck Postgres's log - good chance you run out of shared memory

YES !!

I have increased the shared memory, and now no error

sudo nxdbmgr upgrade

NetXMS Database Manager Version 6.0.2 Build 6.0-504-g549db2d3a0



Upgrading database...

Core database schema is up to date

Database upgrade succeeded
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: twparker on February 16, 2026, 09:05:32 PM
I had to increase my shared memory and increase max transaction locks, but I am also back in business.  :D
Title: Re: Upgrade to 6.0.0 - Database upgrade fails
Post by: Alex Kirhenshtein on February 16, 2026, 09:06:14 PM
In general I always recommend to start with https://pgtune.leopard.in.ua, when using Postgres