[erlang-questions] Reusing mnesia schema on different nodes

Dan Gudmundsson <>
Mon Oct 17 11:50:38 CEST 2016


Note that this "hack" will only work if you are using a single node system.

If you have several nodes you should take a backup, traverse and change the
nodename in that backup, install it on all nodes and restart all nodes from
backup. see mnesia install_fallback.

Or  you wipe the mnesia dir on the moved node, and use mnesia:change_config
to connect to the other nodes,
use mnesia:change_table_copy_type on schema to disc and use
mnesia:add_table_copy(Tab, ...) on the other tabs
you want a local copy.

Then you use mnesia:del_table_copy(schema, OldNameName) ..

/Dan



On Sat, Oct 15, 2016 at 3:16 PM Kenneth Lakin <>
wrote:

> On 10/15/2016 04:09 AM, ARUN P wrote:
> > but i have a doubt, since the dets operations are not transactional in
> > the middle editing schema.DAT file, if my application gets restart...
>
> Based on Szoboszlay's earlier email to you it sounds like you'll be
> doing the search and replace on the Mnesia schema file while Mnesia is
> stopped.
>
> From his message: [0]
>
> "Before starting Mnesia open the schema.DCD or schema.DAT file
> (depending on the storage type of your schema). It will be either a
> disk_log or a dets file, containing {schema, Tab, Opts} entries. Among
> the options you will find the node(s) where the table shall exist.
> Simply change the old node name to the new node name there, and save the
> new schema under its original file name. Then you can start Mnesia and
> all your data will be there."
>
> So, as long as Mnesia is not started on the node, then -AFAIK- nothing
> will be writing to the Mnesia schema file.
>
> [0] http://erlang.org/pipermail/erlang-questions/2016-October/090601.html
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161017/65ad9027/attachment.html>


More information about the erlang-questions mailing list