How to backup&restore metabase(questions,dashbords) based on MS Sqlserver

Dear all,

I am working on metabase on my local PC , I needs to transfer to customer’s server. Project based on MS SQL server. I can not find the detailed procedure to backup & restore metabase project. Plz help me.

Many Thanks !!!

@jinwang.du

Only the Enterprise Edition has a function for easy partial migration called Serialization.

If you want to mess around with moving different parts via metadata, then you should migrate away from the default H2 database, which I guess you are using:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html
But it is easy to make mistakes and corrupt your metadata, so it’s not recommended.
I would highly recommend that you copy the entire database and make adjustments on the production.

Another way is by using the API
https://github.com/metabase/metabase/wiki/Using-the-REST-API
https://github.com/metabase/metabase/blob/master/docs/api-documentation.md

There’s also a third-party project, which uses the API, but it hasn’t been updated for a year, so it does not work with the latest versions of Metabase:
https://github.com/elevate/elevate.metabase.tools

Dear flamer,

I prefer to make a full copy of database, and full restore on another server. How can I do that? Plz tell me the procedure.
I navigate to the directory where you started Metabase from and find the file named ‘metabase.db.mv.db’, I shut down metabase, copy to destination server and shutdown it, replace, and startup metabase on destination server. It seems restore not work.

Thanks ! :slight_smile:

@jinwang.du
Again, I can not recommend that you use H2.
If you use H2 on local and production, then you simply copy the file.
I don’t know how you’re running your production instance, so you might need to make adjustments to your environment variables if the file is located somewhere else:
https://www.metabase.com/docs/latest/operations-guide/configuring-application-database.html

Dear flamber,

In my case, I used MS SQL during installation. I do not know if it is H2 by default.

Thx ! :slight_smile:

@jinwang.du
Okay, I think you are misunderstanding the difference between the internal Metabase application database, where all Metabase’s data is stored, and whatever database you are querying.
You can only use either H2, MySQL/MariaDB or Postgres as the application database.
If you don’t know, then you are using H2. And I would not recommend that you use that in production.

But as a test, then you simply copy the metabase.db.mv.db file from your local instance to the production instance (while Metabase is not running) and start Metabase.

Dear flamber,
I find 2 metabase.db.mv.db one is same path with metabase.jar, the other is under C:\user\administrator path. witch one is correct one?

@jinwang.du
You cannot have two files named the same in the same directory. No OS allows that.
Remember to set the current working directory - or set the environment variable as described in the documentation (note that Windows uses set ... instead of export ...)
https://www.metabase.com/docs/latest/operations-guide/configuring-application-database.html