Migrating H2 to Postgres

Update

Fixed with java -jar metabase.jar load-from-h2 metabase.db/metabase.db


I'm also running into this issue and I followed the exact same steps:

(1) I have a backup of the database in my local computer.

(2) Exported:

export MB_DB_TYPE=postgres
export MB_DB_DBNAME=metabase
export MB_DB_PORT=5432
export MB_DB_USER=postgres
export MB_DB_PASS=123
export MB_DB_HOST=host
export MB_DB_FILE=metabase.db

I tried with:

  • java -jar metabase.jar load-from-h2
  • java -jar metabase.jar load-from-h2 metabase.db

But I'm seeing a couple of errors/info/warnings:

2022-08-12 02:13:07,195 INFO cmd.copy :: Set up h2 source database and run migrations... 
2022-08-12 02:13:07,198 INFO db.setup :: Verifying h2 Database Connection ...
2022-08-12 02:13:07,242 ERROR cmd.copy :: [FAIL]
clojure.lang.ExceptionInfo: ERROR Set up h2 source database and run migrations...: Unable to connect to Metabase h2 DB. {}
Caused by: org.h2.jdbc.JdbcSQLException: Database "/Users/ivor/Desktop/metabase-migration/metabase.db" not found [90013-197]

17

Complete logs: .log ยท GitHub

As well as running (which is the same thing):

java -DMB_DB_TYPE=postgres -DMB_DB_CONNECTION_URI="jdbc:postgresql://<redacted>" -jar metabase.jar load-from-h2 metabase.db

With same results.

Note that I am running this command on my computer with 9GB of RAM available, not in EC2.