# Can't migrate from OrientDB to PG

**URL:** <https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110>\
**Category:** Sonatype Nexus Repository\
**Tags:** nexus-repository\
**Created:** [August 25, 2024, 12:08pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110 "2024-08-25T12:08:33Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafal.kedziorski](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rafal.kedziorski/32/2056_2.png) [@rafal.kedziorski](https://community.sonatype.com/u/rafal.kedziorski)\
**Post date:** [August 25, 2024, 12:08pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/1 "2024-08-25T12:08:34Z")

</div>

Hi,

I try to migrate my Nexus t3.70.1.x o 3.71.x. But first I have to migrate my OrienDB to PG16.

I did all the stuff described in [Migrating to a New Database](https://help.sonatype.com/en/migrating-to-a-new-database.html#migrating-from-postgresql-to-h2)

And when I start the migration

> java -Xmx10G -Xms10G -XX:+UseG1GC -XX:MaxDirectMemorySize=12G   
> –add-exports java.base/sun.nio.ch=ALL-UNNAMED -jar nexus-db-migrator-\*.jar   
> –migration\_type=postgres   
> –db\_url=“jdbc:postgresql://pg16.db.server:5432/nexus?user=nexus&password=xxx”

I get this

> 12:02:11 [main] WARN c.s.n.d.migrator.MigratorApplication - Please ensure any Nexus Repository instance has been gracefully shut down before proceeding.  
> 12:02:11 [main] INFO c.s.n.d.migrator.MigratorApplication - Do you want to continue [y/n]?  
> y  
> 12:02:13 [main] INFO c.s.n.d.migrator.MigratorApplication - --content\_migration parameter is absent. Setting it to true.  
> 12:02:13 [main] INFO c.s.n.d.migrator.MigratorApplication - Force parameter wasn’t found. Setting it to false by default.  
> 12:02:13 [main] INFO c.s.n.d.migrator.MigratorApplication - ------------------------------------------------------------  
> 12:02:13 [main] INFO c.s.n.d.migrator.MigratorApplication - Java version: Eclipse Adoptium 17.0.12  
> 12:02:13 [main] INFO c.s.n.d.migrator.MigratorApplication - JVM arguments: -Xmx10G -Xms10G -XX:+UseG1GC -XX:MaxDirectMemorySize=12G --add-exports=java.base/sun.nio.ch=ALL-UNNAMED  
> 12:02:13 [main] INFO c.s.n.d.migrator.MigratorApplication - Migrator arguments: --logging.level.com.sonatype=DEBUG --migration\_type=postgres --db\_url=jdbc:postgresql://xxx:5432/nexus?user=nexus&password=\*\*\*\* --content\_migration=true --export\_json=false --force=false  
> 12:02:13 [main] INFO c.s.n.d.migrator.MigratorApplication - ------------------------------------------------------------  
> 12:02:14 [main] INFO c.s.n.d.migrator.MigratorApplication - Starting MigratorApplication v3.71.0-01 using Java 17.0.12 on nexus with PID 2524 (/nexus/nexus-db-migrator-3.71.0-01.jar started by nexus in /nexus)  
> 12:02:14 [main] DEBUG c.s.n.d.migrator.MigratorApplication - Running with Spring Boot v3.71.0-01, Spring v3.71.0-01  
> 12:02:14 [main] INFO c.s.n.d.migrator.MigratorApplication - No active profile set, falling back to 1 default profile: “default”  
> 12:02:17 [main] INFO o.s.b.c.r.s.JobRepositoryFactoryBean - No database type set, using meta data indicating: POSTGRES  
> 12:02:17 [main] INFO c.s.n.d.migrator.MigratorApplication - Started MigratorApplication in 3.939 seconds (JVM running for 6.676)  
> 12:02:17 [main] INFO o.s.b.a.b.JobLauncherApplicationRunner - Running default command line with: [–logging.level.com.sonatype=DEBUG, --migration\_type=postgres, --db\_url=jdbc:postgresql://192.168.178.30:5432/nexus?user=nexus&password=nexus, --content\_migration=true, --export\_json=false, --force=false]  
> 12:02:17 [main] INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener -
> 
> Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.  
> 12:02:17 [main] ERROR o.s.boot.SpringApplication - Application run failed  
> java.lang.IllegalStateException: Failed to execute ApplicationRunner  
> at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776)  
> at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:763)  
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)  
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)  
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)  
> at com.sonatype.nexus.db.migrator.MigratorApplication.main(MigratorApplication.java:117)  
> Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT JOB\_INSTANCE\_ID, JOB\_NAME from BATCH\_JOB\_INSTANCE where JOB\_NAME = ? and JOB\_KEY = ?]; nested exception is org.postgresql.util.PSQLException: FEHLER: Relation »batch\_job\_instance« existiert nicht  
> Position: 39  
> at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239)  
> at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)  
> at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1541)  
> at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:667)  
> at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:713)  
> at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:744)  
> at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:757)  
> at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:815)  
> at org.springframework.batch.core.repository.dao.JdbcJobInstanceDao.getJobInstance(JdbcJobInstanceDao.java:151)  
> at org.springframework.batch.core.repository.support.SimpleJobRepository.isJobInstanceExists(SimpleJobRepository.java:93)  
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)  
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> at java.base/java.lang.reflect.Method.invoke(Method.java:569)  
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)  
> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)  
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)  
> at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)  
> at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)  
> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)  
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)  
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)  
> at jdk.proxy2/jdk.proxy2.$Proxy55.isJobInstanceExists(Unknown Source)  
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)  
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> at java.base/java.lang.reflect.Method.invoke(Method.java:569)  
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)  
> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)  
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)  
> at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:128)  
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)  
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)  
> at jdk.proxy2/jdk.proxy2.$Proxy55.isJobInstanceExists(Unknown Source)  
> at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.getNextJobParameters(JobLauncherApplicationRunner.java:206)  
> at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.execute(JobLauncherApplicationRunner.java:198)  
> at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.executeLocalJobs(JobLauncherApplicationRunner.java:173)  
> at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.launchJobFromProperties(JobLauncherApplicationRunner.java:160)  
> at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.run(JobLauncherApplicationRunner.java:155)  
> at com.sonatype.nexus.db.migrator.config.MigratorJobLauncherApplicationRunner.run(MigratorJobLauncherApplicationRunner.java:38)  
> at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:773)  
> … 5 common frames omitted  
> Caused by: org.postgresql.util.PSQLException: FEHLER: Relation »batch\_job\_instance« existiert nicht  
> Position: 39  
> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)  
> at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)  
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)  
> at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)  
> at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)  
> at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)  
> at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:134)  
> at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)  
> at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)  
> at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:722)  
> at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:651)

error.

Looks like the tables are not created.

Best Regards,  
Rafal

---

<div class="post-metadata">

**Author:** ![rafal.kedziorski](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rafal.kedziorski/32/2056_2.png) [@rafal.kedziorski](https://community.sonatype.com/u/rafal.kedziorski)\
**Post date:** [August 25, 2024, 12:13pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/2 "2024-08-25T12:13:08Z")

</div>

I used the wrong migrator version. But with nexus-db-migrator-3.70.1-03.jar I get the same error.

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.  
12:11:37 [main] ERROR o.s.boot.SpringApplication - Application run failed  
java.lang.IllegalStateException: Failed to execute ApplicationRunner

…

Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT JOB\_INSTANCE\_ID, JOB\_NAME from BATCH\_JOB\_INSTANCE where JOB\_NAME = ? and JOB\_KEY = ?]; nested exception is org.postgresql.util.PSQLException: FEHLER: Relation »batch\_job\_instance« existiert nicht  
Position: 39

…

Caused by: org.postgresql.util.PSQLException: FEHLER: Relation »batch\_job\_instance« existiert nicht  
Position: 39

Best Regards,  
Rafal

---

<div class="post-metadata">

**Author:** ![rafal.kedziorski](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rafal.kedziorski/32/2056_2.png) [@rafal.kedziorski](https://community.sonatype.com/u/rafal.kedziorski)\
**Post date:** [August 25, 2024, 12:36pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/3 "2024-08-25T12:36:16Z")

</div>

Now I try migrato to H2.

And I get this error:

> 12:33:11 [main] INFO c.s.n.d.m.validator.PathValidator - Validating Orient directory contains .bak files: /nexus  
> 12:33:11 [main] INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener -
> 
> Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.  
> 12:33:11 [main] ERROR o.s.boot.SpringApplication - Application run failed  
> java.lang.IllegalStateException: Failed to execute ApplicationRunner  
> at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776)  
> at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:763)  
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)  
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)  
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)  
> at com.sonatype.nexus.db.migrator.MigratorApplication.main(MigratorApplication.java:117)  
> Caused by: com.sonatype.nexus.db.migrator.exception.InvalidMigrationFilesException: The migration files in /nexus do not match the expected requirements: No backup files (\*.bak) found.

The error message is not specific. Which backup files?

I did this:

- The utility will use the backup files (e.g., component-.bak, config-.bak, security-.bak) for migration.

I follow all the rules for PG or H2 migration. Sorry, but somethig is here wrong.

---

<div class="post-metadata">

**Author:** ![rafal.kedziorski](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rafal.kedziorski/32/2056_2.png) [@rafal.kedziorski](https://community.sonatype.com/u/rafal.kedziorski)\
**Post date:** [August 25, 2024, 12:51pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/4 "2024-08-25T12:51:24Z")

</div>

Finally I could migrate to H2. But the documentation is very very bad. It looks like no one tested it before.

I give up for the PG migration.

---

<div class="post-metadata">

**Author:** ![s.schmidt](https://avatars.discourse-cdn.com/v4/letter/s/ee59a6/32.png) [@s.schmidt](https://community.sonatype.com/u/s.schmidt)\
**Post date:** [August 26, 2024, 6:31am UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/5 "2024-08-26T06:31:55Z")

</div>

Hey Rafal, this “only” works if you dont have 3rd Party-Plugins from the community installed. Because if you move to PG, all 3rd Party is disabled sadly, thats why we can move right now.

---

<div class="post-metadata">

**Author:** ![rafal.kedziorski](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rafal.kedziorski/32/2056_2.png) [@rafal.kedziorski](https://community.sonatype.com/u/rafal.kedziorski)\
**Post date:** [August 26, 2024, 8:16am UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/6 "2024-08-26T08:16:54Z")

</div>

I have only pure Nexus running without any special 3rd Party.

But now I migrated to H2. And it’s ok for me.

Regards,  
Rafal

---

<div class="post-metadata">

**Author:** ![chrkuznos](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@chrkuznos](https://community.sonatype.com/u/chrkuznos)\
**Post date:** [August 26, 2024, 1:36pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/7 "2024-08-26T13:36:08Z")

</div>

@rafal.kedziorski how did you overcome the missing bak files? did you execute any command to produce bak files? if yes could you please explain  
thank you

---

<div class="post-metadata">

**Author:** ![rafal.kedziorski](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rafal.kedziorski/32/2056_2.png) [@rafal.kedziorski](https://community.sonatype.com/u/rafal.kedziorski)\
**Post date:** [August 26, 2024, 1:50pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/8 "2024-08-26T13:50:37Z")

</div>

I added the OrientDB backup task in my Nexus. I started it manualy and than I made a copy into the folder with the migration jar. And than the migration to H2 works.

I didn’t find any info in the migrations page how the BAK files should be created. Why?

---

<div class="post-metadata">

**Author:** ![rafal.kedziorski](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rafal.kedziorski/32/2056_2.png) [@rafal.kedziorski](https://community.sonatype.com/u/rafal.kedziorski)\
**Post date:** [August 26, 2024, 1:56pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/9 "2024-08-26T13:56:57Z")

</div>

> [@rafal.kedziorski](#):
>
> Caused by: org.postgresql.util.PSQLException: FEHLER: Relation »batch\_job\_instance« existiert nicht  
> Position: 39

Is this

Caused by: org.postgresql.util.PSQLException: FEHLER: Relation »batch\_job\_instance« existiert nicht  
Position: 39

the reason for 3rd party? I do’t think so.

---

<div class="post-metadata">

**Author:** ![john.burrows](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@john.burrows](https://community.sonatype.com/u/john.burrows)\
**Post date:** [August 26, 2024, 2:18pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/10 "2024-08-26T14:18:03Z")

</div>

@rafal.kedziorski  
We ran into issues with migration as well from OrientDB to PostgreSQL.

What we found was that the DB Migrator does not support Java 17, so we had to migrate the OrientDB to PostgreSQL using Java 11, then upgrade to Java 17 afterwards. So, you have to ensure that you are on Java 11 (or earlier) when migrating.

If this does not pertain to you, I apologize

John

---

<div class="post-metadata">

**Author:** ![rafal.kedziorski](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rafal.kedziorski/32/2056_2.png) [@rafal.kedziorski](https://community.sonatype.com/u/rafal.kedziorski)\
**Post date:** [August 28, 2024, 2:04pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/11 "2024-08-28T14:04:14Z")

</div>

Thx for the Info. I made a backup of my VM nbefore the Upgrade. I cat try this again.

But this shows how broken the procedure is.

---

<div class="post-metadata">

**Author:** ![d.remke](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/d.remke/32/3680_2.png) [@d.remke](https://community.sonatype.com/u/d.remke)\
**Post date:** [April 4, 2025, 9:07am UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/12 "2025-04-04T09:07:27Z")

</div>

I have the same problem. When I start the migration from h2 to Postgresql with Java 11, I get the message:

Java Runtime only recognises class file versions up to 55.0

With java 17:

Caused by: org.postgresql.util.PSQLException: ERROR: Relation ‘batch\_job\_instance’ does not exist

What can I do?

---

<div class="post-metadata">

**Author:** ![rseddon](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rseddon/32/341_2.png) [@rseddon](https://community.sonatype.com/u/rseddon)\
**Post date:** [April 4, 2025, 2:29pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/13 "2025-04-04T14:29:33Z")

</div>

The ‘batch\_job\_instance” error generally indicates the database user does not have the correct permissions. As documented in [Migrating to a New Database](https://help.sonatype.com/en/migrating-to-a-new-database.html#migration-environment-prerequisite-requirements-162010), the DB user must be the owner of the DB:

> The database user used must be the owner of the database (check the Owner column of “\l” output in the “psql” console).
> 
> A command like the following could be used to create a user and a database owned by that user:
> 
> ```auto
> CREATE USER <username> WITH PASSWORD '<password>';
> CREATE DATABASE <db-name> WITH OWNER <username> ENCODING 'UTF8';
> 
> ```

---

<div class="post-metadata">

**Author:** ![Martin\_Tovmassian](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@Martin\_Tovmassian](https://community.sonatype.com/u/Martin_Tovmassian)\
**Post date:** [November 10, 2025, 8:42pm UTC](https://community.sonatype.com/t/cant-migrate-from-orientdb-to-pg/13110/14 "2025-11-10T20:42:16Z")

</div>

Faced the same kind of error - i.e. `Caused by: org.postgresql.util.PSQLException: ERROR: relation "batch_job_instance" does not exist` - while migrating a Nexus v3.86.0-08 database from H2 to Postgresql with the utility _nexus-db-migrator-3.86.0-08.jar_.

This [stackoverflow post](https://stackoverflow.com/questions/65631547/spring-batch-postgres-error-relation-batch-job-instance-does-not-exist) gave me a really good hint. I was able to troubleshoot the migration by adding `spring.batch.initialize-schema=ALWAYS` into an _application.properties_ placed in the same directory as the utility.
