I have had problems importing metadata after updating the version of Dhis2

No habia tenido durante un año de actualizaciones constantes de las diferentes versiones de dhis2 problema alguno para hacer la exportación e importación de los metadados desde una computadora o servidor, a otra. Ahora con la Versión, resulta que algo tan rutinario como exportar o importar los metadatos, solamente me permite importar las unidades organizativas, pero no permite la importación de cualquier otro grupos de metadados como los set de opciones, los elementos de datos, los programas, las variables, etc. En ese sentido lo que tuve que hacer como opción final fue clonar un disco duro donde tenia la instancia de dhis2 funcionando para poder recuperar y seguir trabajando en el proyecto.

During a year of constant updates of the different versions of dhis2, I had not had any problem exporting and importing the metadata from one computer or server to another. Now with Version, it turns out that something as routine as exporting or importing metadata only allows me to import organizational units, but does not allow the import of any other groups of metadata such as option sets, data elements, programs, variables, etc. In that sense, what I had to do as a final option was clone a hard drive where I had the dhis2 instance running so I could recover and continue working on the project.
Captura desde 2024-07-07 01-10-09
Captura desde 2024-07-07 01-14-34
Captura desde 2024-07-07 01-16-32
Captura desde 2024-07-07 01-18-00
Captura desde 2024-07-07 01-18-58
Captura desde 2024-07-07 01-21-17

in no way does it allow me to import and update the metadata

@dhis2-backend
@dhis2-test-qa
@dhis2-analytics
@dhis2-platform
@dhis2-tracker

Can someone help me with this, many days have passed and the import process is not working




Hi @alexander_carrasquel

There’s an issue which only appears in the video recording you shared. It is a known import issue with the metadata. In the docs, it is mentioned as follows:

The issue is related to sortOrder of options in an optionSet included in the package not matching the sortOrder of same options in the instance/server. 2. Duplicate key value violates unique constraint Symptoms: import fails with no errors. Please check the dhis.log in your server/instance. If you see the following error:

  • ERROR 2021-07-15 10:12:20,272 ERROR: duplicate key value violates unique constraint “uk_myox13mr8r27oxl7ts33ntpd5” Detail: Key (uid)=(YYtAbckt77l) already exists. (SqlExceptionHelper.java [taskScheduler-23]) * ERROR 2021-07-15 10:12:20,303 javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement

(source)

I appreciate your answer, however, I was able in recent days to solve the problem. Install an older version of dhis2, specifically DHIS2 version 39.5.0. Then how do I create a GeoJSON type attribute within the organizational units? First I imported the metadata of said attribute, then I proceeded to import the organizational units, the option sets, the data elements, the programs with their respective variables and program rules, indicators, dashboards, etc., import everything with the Skip sharing and access settings option and regardless of the users with their user groups, I left the users for last. Everything was consecutively accepting the import and also then I imported the users and carried out the import process again only with the update option. It was the way in which I was able to restore a significant amount of metadata. As a second option that I later tried and it worked, I created a file using the pg_dump command and that way I was also able to backup and then restore the entire database. I will do this entire procedure with more recent versions of dhis2 to check if the export and import of the metadata is executed satisfactorily.

2 Likes

Thank you for sharing the solution with all these details. I’m happy to see you were able to solve the problem. I hope it works for later versions as well. Did you figure out the actual reason behind the first error and why it happened?

Thanks!