How can I recover collections from unattainable container?

Greetings

I created new docker container that uses our previous MySQL database (one we were using before had unfinished H2 migrations resulting with 502 and 503 errors, UI was unattainable). But got complaints that Our Analytics collection is empty.

I already tried java -jar /app/metabase.jar migrate release-locks and java -cp /app/metabase.jar org.h2.tools.Recover on old container/H2 to get metabase.db.mv.db and metabase.db.h2.sql but I failed retrieve collections from these.

Any tips? I can provide more about my setup, logs and taken steps if needed

Could you please give more context by providing logs?

Thanks

This is example set of logs I get after starting damaged container:

2026-01-26 14:01:09,000 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. :unlocked:

For more information, see

2026-01-26 14:01:10,103 WARN db.env :: WARNING: Using Metabase with an H2 application database is not recommended for production deployments. For production deployments, we highly recommend using Postgres, MySQL, or MariaDB instead. If you decide to continue to use H2, please be sure to back up the database file regularly. For more information, see

2026-01-26 14:01:17,599 INFO driver.impl :: Registered abstract driver :sql :delivery_truck:

2026-01-26 14:01:17,646 INFO driver.impl :: Registered abstract driver :sql-jdbc (parents: [:sql]) :delivery_truck:

2026-01-26 14:01:17,657 INFO metabase.util :: Load driver :sql-jdbc took 18.5 ms

2026-01-26 14:01:17,658 INFO driver.impl :: Registered driver :h2 (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:17,956 INFO driver.impl :: Registered driver :mysql (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:18,033 INFO driver.impl :: Registered driver :postgres (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:21,262 INFO metabase.core ::

Metabase v0.50.18 (c323ffc)

Copyright © 2026 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.

2026-01-26 14:01:21,277 INFO metabase.core :: Starting Metabase in STANDALONE mode

2026-01-26 14:01:21,345 INFO metabase.server :: Launching Embedded Jetty Webserver with config:

{:port 3000, :host "0.0.0.0"}

2026-01-26 14:01:21,425 INFO metabase.core :: Starting Metabase version v0.50.18 (c323ffc) ...

2026-01-26 14:01:21,430 INFO metabase.core :: System info:

{"file.encoding" "UTF-8",

"java.runtime.name" "OpenJDK Runtime Environment",

"java.runtime.version" "11.0.24+8",

"java.vendor" "Eclipse Adoptium",

"java.vendor.url" "https://adoptium.net/",

"java.version" "11.0.24",

"java.vm.name" "OpenJDK 64-Bit Server VM",

"java.vm.version" "11.0.24+8",

"os.name" "Linux",

"os.version" "4.18.0-553.64.1.el8_10.x86_64",

"user.language" "en",

"user.timezone" "GMT"}

2026-01-26 14:01:21,433 INFO metabase.plugins :: Loading plugins in /plugins...

2026-01-26 14:01:22,186 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :bigquery-cloud-sdk...

2026-01-26 14:01:22,187 INFO driver.impl :: Registered driver :bigquery-cloud-sdk (parents: [:sql]) :delivery_truck:

2026-01-26 14:01:22,206 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :mongo...

2026-01-26 14:01:22,207 INFO driver.impl :: Registered driver :mongo :delivery_truck:

2026-01-26 14:01:22,227 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :redshift...

2026-01-26 14:01:22,228 INFO driver.impl :: Registered driver :redshift (parents: [:postgres]) :delivery_truck:

2026-01-26 14:01:22,258 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :athena...

2026-01-26 14:01:22,259 INFO driver.impl :: Registered driver :athena (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:22,292 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sqlserver...

2026-01-26 14:01:22,292 INFO driver.impl :: Registered driver :sqlserver (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:22,362 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :snowflake...

2026-01-26 14:01:22,362 INFO driver.impl :: Registered driver :snowflake (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:22,371 INFO plugins.dependencies :: Metabase cannot initialize plugin Metabase Oracle Driver due to required dependencies. Metabase requires the Oracle JDBCdriver in order to connect to Oracle databases, but we can't ship it as part of Metabase due to licensing restrictions. See for more details.

2026-01-26 14:01:22,386 INFO plugins.dependencies :: Metabase Oracle Driver dependency {:class oracle.jdbc.OracleDriver} satisfied? false

2026-01-26 14:01:22,387 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase Oracle Driver"]

2026-01-26 14:01:22,396 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :druid-jdbc...

2026-01-26 14:01:22,396 INFO driver.impl :: Registered driver :druid-jdbc (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:22,408 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :hive-like...

2026-01-26 14:01:22,409 INFO driver.impl :: Registered abstract driver :hive-like (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:22,409 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sparksql...

2026-01-26 14:01:22,410 INFO driver.impl :: Registered driver :sparksql (parents: [:hive-like]) :delivery_truck:

2026-01-26 14:01:22,414 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sqlite...

2026-01-26 14:01:22,414 INFO driver.impl :: Registered driver :sqlite (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:22,424 INFO plugins.dependencies :: Metabase cannot initialize plugin Metabase Vertica Driver due to required dependencies. Metabase requires the Vertica JDBC driver in order to connect to Vertica databases, but we can't ship it as part of Metabase due to licensing restrictions. See for more details.

2026-01-26 14:01:22,425 INFO plugins.dependencies :: Metabase Vertica Driver dependency {:class com.vertica.jdbc.Driver} satisfied? false

2026-01-26 14:01:22,425 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase Oracle Driver" "Metabase Vertica Driver"]

2026-01-26 14:01:22,437 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :druid...

2026-01-26 14:01:22,437 INFO driver.impl :: Registered driver :druid :delivery_truck:

2026-01-26 14:01:22,465 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :presto-jdbc...

2026-01-26 14:01:22,466 INFO driver.impl :: Registered driver :presto-jdbc (parents: [:sql-jdbc]) :delivery_truck:

2026-01-26 14:01:22,486 INFO metabase.core :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute...

2026-01-26 14:01:22,489 INFO db.setup :: Verifying h2 Database Connection ...

2026-01-26 14:01:23,709 INFO db.setup :: Successfully verified H2 2.1.214 (2022-06-13) application database connection. :white_check_mark:

2026-01-26 14:01:23,709 INFO db.setup :: Checking if a database downgrade is required...

2026-01-26 14:01:25,112 INFO db.setup :: Running Database Migrations...

2026-01-26 14:01:25,112 INFO db.setup :: Setting up Liquibase...

2026-01-26 14:01:25,342 INFO db.liquibase :: Updating liquibase table to reflect consolidated changeset filenames

2026-01-26 14:01:27,359 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@4efd4781: Database has migration lock; cannot run migrations. Youcan force-release these locks by running `java -jar metabase.jar migrate release-locks`.

2026-01-26 14:01:29,364 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@4efd4781: Database has migration lock; cannot run migrations. Youcan force-release these locks by running `java -jar metabase.jar migrate release-locks`.

2026-01-26 14:01:31,370 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@4efd4781: Database has migration lock; cannot run migrations. Youcan force-release these locks by running `java -jar metabase.jar migrate release-locks`.

2026-01-26 14:01:33,377 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@4efd4781: Database has migration lock; cannot run migrations. Youcan force-release these locks by running `java -jar metabase.jar migrate release-locks`.

2026-01-26 14:01:35,383 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@4efd4781: Database has migration lock; cannot run migrations. Youcan force-release these locks by running `java -jar metabase.jar migrate release-locks`.

2026-01-26 14:01:37,393 ERROR metabase.core :: Metabase Initialization FAILED

liquibase.exception.LockException: Database has migration lock; cannot run migrations. You can force-release these locks by running `java -jar metabase.jar migrate release-locks`.

    at metabase.db.liquibase$wait_for_migration_lock$fn__44585.invoke(liquibase.clj:222)

    at metabase.util.jvm$do_with_auto_retries.invokeStatic(jvm.clj:176)

    at metabase.util.jvm$do_with_auto_retries.invoke(jvm.clj:165)

    at metabase.util.jvm$do_with_auto_retries.invokeStatic(jvm.clj:183)

    at metabase.util.jvm$do_with_auto_retries.invoke(jvm.clj:165)

    at metabase.util.jvm$do_with_auto_retries.invokeStatic(jvm.clj:183)

    at metabase.util.jvm$do_with_auto_retries.invoke(jvm.clj:165)

    at metabase.util.jvm$do_with_auto_retries.invokeStatic(jvm.clj:183)

    at metabase.util.jvm$do_with_auto_retries.invoke(jvm.clj:165)

    at metabase.util.jvm$do_with_auto_retries.invokeStatic(jvm.clj:183)

    at metabase.util.jvm$do_with_auto_retries.invoke(jvm.clj:165)

    at metabase.util.jvm$do_with_auto_retries.invokeStatic(jvm.clj:183)

    at metabase.util.jvm$do_with_auto_retries.invoke(jvm.clj:165)

    at metabase.db.liquibase$wait_for_migration_lock.invokeStatic(liquibase.clj:216)

    at metabase.db.liquibase$wait_for_migration_lock.invoke(liquibase.clj:211)

    at metabase.db.liquibase$run_in_scope_locked$reify__44620.run(liquibase.clj:322)

    at liquibase.Scope.lambda$child$0(Scope.java:186)

    at liquibase.Scope.child(Scope.java:195)

    at liquibase.Scope.child(Scope.java:185)

    at liquibase.Scope.child(Scope.java:164)

    at metabase.db.liquibase$run_in_scope_locked.invokeStatic(liquibase.clj:318)

    at metabase.db.liquibase$run_in_scope_locked.invoke(liquibase.clj:301)

    at metabase.db.liquibase$consolidate_liquibase_changesets_BANG\_.invokeStatic(liquibase.clj:453)

    at metabase.db.liquibase$consolidate_liquibase_changesets_BANG\_.invoke(liquibase.clj:432)

    at metabase.db.setup$migrate_BANG\_$fn__53560.invoke(setup.clj:80)

    at metabase.db.liquibase$do_with_liquibase$f_STAR___44561.invoke(liquibase.clj:140)

    at metabase.db.liquibase$do_with_liquibase.invokeStatic(liquibase.clj:143)

    at metabase.db.liquibase$do_with_liquibase.invoke(liquibase.clj:131)

    at metabase.db.setup$migrate_BANG\_.invokeStatic(setup.clj:73)

    at metabase.db.setup$migrate_BANG\_.doInvoke(setup.clj:55)

    at clojure.lang.RestFn.invoke(RestFn.java:425)

    at metabase.db.setup$run_schema_migrations_BANG\_.invokeStatic(setup.clj:149)

    at metabase.db.setup$run_schema_migrations_BANG\_.invoke(setup.clj:144)

    at metabase.db.setup$setup_db_BANG\_$fn__53588$fn__53589.invoke(setup.clj:167)

    at metabase.util.jvm$do_with_us_locale.invokeStatic(jvm.clj:239)

    at metabase.util.jvm$do_with_us_locale.invoke(jvm.clj:225)

    at metabase.db.setup$setup_db_BANG\_$fn__53588.invoke(setup.clj:161)

    at metabase.db.setup$setup_db_BANG\_.invokeStatic(setup.clj:160)

    at metabase.db.setup$setup_db_BANG\_.invoke(setup.clj:153)

    at metabase.db$setup_db_BANG\_$fn__53613.invoke(db.clj:86)

    at metabase.db$setup_db_BANG\_.invokeStatic(db.clj:81)

    at metabase.db$setup_db_BANG\_.doInvoke(db.clj:68)

    at clojure.lang.RestFn.invoke(RestFn.java:421)

    at metabase.core$init_BANG__STAR\_.invokeStatic(core.clj:117)

    at metabase.core$init_BANG__STAR\_.invoke(core.clj:98)

    at metabase.core$init_BANG\_.invokeStatic(core.clj:170)

    at metabase.core$init_BANG\_.invoke(core.clj:165)

    at metabase.core$start_normally.invokeStatic(core.clj:182)

    at metabase.core$start_normally.invoke(core.clj:176)

    at metabase.core$entrypoint.invokeStatic(core.clj:215)

    at metabase.core$entrypoint.doInvoke(core.clj:209)

    at clojure.lang.RestFn.invoke(RestFn.java:397)

    at clojure.lang.AFn.applyToHelper(AFn.java:152)

    at clojure.lang.RestFn.applyTo(RestFn.java:132)

    at clojure.lang.Var.applyTo(Var.java:705)

    at clojure.core$apply.invokeStatic(core.clj:667)

    at clojure.core$apply.invoke(core.clj:662)

    at metabase.bootstrap$\_main.invokeStatic(bootstrap.clj:31)

    at metabase.bootstrap$\_main.doInvoke(bootstrap.clj:28)

    at clojure.lang.RestFn.invoke(RestFn.java:397)

    at clojure.lang.AFn.applyToHelper(AFn.java:152)

    at clojure.lang.RestFn.applyTo(RestFn.java:132)

    at metabase.bootstrap.main(Unknown Source)

2026-01-26 14:01:37,408 INFO metabase.core :: Metabase Shutting Down ...

2026-01-26 14:01:37,410 INFO metabase.server :: Shutting Down Embedded Jetty Webserver

2026-01-26 14:01:37,420 WARN db.liquibase :: ()

2026-01-26 14:01:37,421 INFO metabase.core :: Metabase Shutdown COMPLETE

Warning: environ value jdk-11.0.24+8 for key :java-version has been overwritten with 11.0.24

2026-01-26 14:01:47,660 INFO metabase.util :: Maximum memory available to JVM: 1.9 GB

Thanks. The logs show Metabase fails to start due to a stale migration lock.

Stop the container first and run , migrate release-locks;

where should i run migrate release-locks; ? i already tried with docker exec

Download the jar corresponding to your metabase application version here: Releases · metabase/metabase · GitHub

then run it independently from the container.

Don’t forget to stop the container before running release-locks

what do you exactly mean by then run it independently from the container ? i cannot run java command migrate release-locks on bash even after wget ``https://downloads.metabase.com/v0.50.18/metabase.jar i tried few different ways but none restored my container

What error do you get when running directly on bash?

May be you don’t have java installed

If you quoted the exact command you ran for unlocking the migration lock, you are missing a mandatory command-line option and the migration attempt likely failed.

As per the docs, you must run this exactly, from the directory where metabase is launched from (i.e., metabase.db.mv.db is in the current directory):

java --add-opens java.base/java.nio=ALL-UNNAMED -jar metabase.jar migrate release-locks

Make sure you set the environment up the same as with the standard launch. I think docker exec takes care of this for you, but make extra sure, in case you have set things like MB_DB_CONNECTION_URI and MB_ENCRYPTION_SECRET_KEY that would impact database access.

Please run the above command and post the output.

1 Like

Thank you for this response

Unfortunately, my logs still tell me that Database has migration lock and initialization failed

This is what I did with outcomes (metabase3 is name of problematic container):

docker exec -it metabase3 sh

/ # cd /metabase.db

/metabase.db # ls -lh

total 54M

-rw-r--r-- 1 metabase metabase 26M Jan 26 11:34 metabase.db.h2.sql

-rw-r--r-- 1 metabase metabase 9.0M Jan 29 13:31 metabase.db.mv.db

-rw-r--r-- 1 metabase metabase 1.9M Jan 26 11:34 metabase.db.mv.txt

-rw-r--r-- 1 metabase metabase 562K Jan 29 13:23 metabase.db.trace.db

/metabase.db # java --add-opens java.base/java.nio=ALL-UNNAMED \

> -jar /app/metabase.jar migrate release-locks

Warning: environ value jdk-11.0.24+8 for key :java-version has been overwritten with 11.0.24

2026-01-29 13:31:36,175 INFO metabase.util :: Maximum memory available to JVM: 1.9 GB

2026-01-29 13:31:41,361 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. :unlocked:

For more information, see Redirecting


2026-01-29 13:31:42,651 WARN db.env :: WARNING: Using Metabase with an H2 application database is not recommended for production deployments. For production deployments, we highly recommend using Postgres, MySQL, or MariaDB instead. If you decide to continue to use H2, please be sure to back up the database file regularly. For more information, see Redirecting


2026-01-29 13:31:51,949 INFO driver.impl :: Registered abstract driver :sql :delivery_truck:

2026-01-29 13:31:52,004 INFO driver.impl :: Registered abstract driver :sql-jdbc (parents: [:sql]) :delivery_truck:

2026-01-29 13:31:52,016 INFO metabase.util :: Load driver :sql-jdbc took 21.8 ms

2026-01-29 13:31:52,017 INFO driver.impl :: Registered driver :h2 (parents: [:sql-jdbc]) :delivery_truck:

2026-01-29 13:31:52,295 INFO driver.impl :: Registered driver :mysql (parents: [:sql-jdbc]) :delivery_truck:

2026-01-29 13:31:52,348 INFO driver.impl :: Registered driver :postgres (parents: [:sql-jdbc]) :delivery_truck:

2026-01-29 13:31:55,284 INFO metabase.core ::

Metabase v0.50.18 (c323ffc)

Copyright © 2026 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.

That’s all the log you get? It just crashes after printing the version banner?

Yes, that was all after I used that command you sent, but overall when I use docker exec to enter shell or bash it happens that it exits itself after some time, maybe it happened then too.

I tried to do these same steps again few minutes ago and log is just that:

docker exec -it metabase3 sh
/ # cd /metabase.db
/metabase.db # java --add-opens java.base/java.nio=ALL-UNNAMED -jar /app/metabase.jar migrate release-locks
Warning: environ value jdk-11.0.24+8 for key :java-version has been overwritten with 11.0.24
2026-02-02 08:23:10,044 INFO metabase.util :: Maximum memory available to JVM: 1.9 GB
2026-02-02 08:23:13,915 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. :unlocked:
For more information, see Redirecting

2026-02-02 08:23:15,072 WARN db.env :: WARNING: Using Metabase with an H2 application database is not recommended for production deployments. For production deployments, we highly recommend using Postgres, MySQL, or MariaDB instead. If you decide to continue to use H2, please be sure to back up the database file regularly. For more information, see Redirecting


I checked what ‘normal’ container log registered at the same time (docker logs --tail 500 metabase3):

2026-02-02 08:23:01,101 INFO db.setup :: Successfully verified H2 2.1.214 (2022-06-13) application database connection. :white_check_mark:
2026-02-02 08:23:01,103 INFO db.setup :: Checking if a database downgrade is required...
2026-02-02 08:23:03,677 INFO db.setup :: Running Database Migrations...
2026-02-02 08:23:03,678 INFO db.setup :: Setting up Liquibase...
2026-02-02 08:23:04,045 INFO db.liquibase :: Updating liquibase table to reflect consolidated changeset filenames
2026-02-02 08:23:06,070 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@3d8a6cd1: Database has migration lock; cannot runmigrations. You can force-release these locks by running java -jar metabase.jar migrate release-locks.
2026-02-02 08:23:08,081 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@3d8a6cd1: Database has migration lock; cannot runmigrations. You can force-release these locks by running java -jar metabase.jar migrate release-locks.
2026-02-02 08:23:10,099 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@3d8a6cd1: Database has migration lock; cannot runmigrations. You can force-release these locks by running java -jar metabase.jar migrate release-locks.
2026-02-02 08:23:12,105 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@3d8a6cd1: Database has migration lock; cannot runmigrations. You can force-release these locks by running java -jar metabase.jar migrate release-locks.
2026-02-02 08:23:14,112 WARN util.jvm :: auto-retry metabase.db.liquibase$wait_for_migration_lock$fn__44585@3d8a6cd1: Database has migration lock; cannot runmigrations. You can force-release these locks by running java -jar metabase.jar migrate release-locks.
2026-02-02 08:23:16,124 ERROR metabase.core :: Metabase Initialization FAILED
liquibase.exception.LockException: Database has migration lock; cannot run migrations. You can force-release these locks by running java -jar metabase.jar migrate release-locks.

2026-02-02 08:23:16,139 INFO metabase.core :: Metabase Shutting Down ...
2026-02-02 08:23:16,141 INFO metabase.server :: Shutting Down Embedded Jetty Webserver
2026-02-02 08:23:16,183 WARN db.liquibase :: ()
2026-02-02 08:23:16,185 INFO metabase.core :: Metabase Shutdown COMPLETE
Warning: environ value jdk-11.0.24+8 for key :java-version has been overwritten with 11.0.24