nxdbmgr - NetXMS utility for database operations has built-in mechanism for database migration.
nxdbmgr migrate <source>
where source is the name of netxms configuration file that points to the database you are migrating from. There's a number of options that allow to skip DCI data, etc and it's possible to migrate DCI data afterwards after starting NetXMS with the new database.
There's an outdated wiki post on that, it does not list all possible options: https://wiki.netxms.org/wiki/How_to_migrate_to_another_database