Проблема миграции БД с MySQL в PostgreSQL
-
Добрый день,
Столкнулся с проблемой не выполняется миграция данных с базы MySQL в PostgreSQL выдает ошибку (полный лог во вложении):Migrating table nodes SQL query failed (22P02 ОШИБКА: неверное значение для целого числа: ""): INSERT INTO nodes (id,primary_name,primary_ip,node_flags,runtime_flags,snmp_version,snmp_port,community,usm_auth_password,usm_priv_password,usm_methods,snmp_oid,auth_method,secret,agent_port,status_poll_type,agent_version,platform_name,poller_node_id,zone_guid,proxy_node,snmp_proxy,icmp_proxy,required_polls,uname,use_ifxtable,snmp_sys_name,snmp_sys_contact,snmp_sys_location,bridge_base_addr,down_since,boot_time,driver_name,rack_image_front,rack_position,rack_height,rack_id,agent_cache_mode,last_agent_comm_time,syslog_msg_count,snmp_trap_count,chassis_id,node_type,node_subtype,ssh_login,ssh_password,ssh_proxy,port_rows,port_numbering_scheme,agent_comp_mode,tunnel_id,lldp_id,fail_time_snmp,fail_time_agent,rack_orientation,rack_image_rear) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ... Database migration failed.Версии программ:
NetXMS Database Manager Version 2.2.4 Build 9506 (2.2.4) mysql Ver 14.14 Distrib 5.5.53, for debian-linux-gnu (x86_64) using readline 6.3 psql (PostgreSQL) 10.3 (Debian 10.3-1.pgdg80+1)Миграцию выполняю по инструкции https://wiki.netxms.org/wiki/How_to_migrate_to_another_database
Кто что посоветует?
-
Разобрался в причине ошибки
Некоторые узлы в таблице nodes в полях port_rows, port_numbering_scheme имеют значение NULL, но как я в момент миграции для этих полей значения заменяются на "" на что и ругается затем PostgreSQL так как "" - это строка, а указанные поля типа число
в моем случае помогло проставить в MySQL вместо null значение например -1:
update netxms.nodes set port_numbering_scheme = -1 where port_numbering_scheme is null; update netxms.nodes set port_rows = -1 where port_rows is null;Выполнил
nxdbmgr migrate /etc/netxmsd.conf.oldа затем в PostgreSQL вернул null обратно:
update nodes set port_numbering_scheme = null where port_numbering_scheme = -1; update nodes set port_rows = null where port_rows = -1;Просьба к разработчика: исправьте данный баг
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login