Hi,<div><br></div><div>Should it be possible to make a backup of tables in mnesia if you just have ram_copies ?</div><div><br></div><div>The documentation at <a href="http://www.erlang.org/doc/man/mnesia.html#backup-1">http://www.erlang.org/doc/man/mnesia.html#backup-1</a> does not seem to imply that there is any such limitation.</div>
<div><br></div><div>However when I examine the backup file created from mnesia:backup/1 it does not seem to have any table data.</div><div><br></div><div>I use this simple test to check the backup. It will fail with {aborted,{no_exists,bup_rec,all}}.</div>
<div><br></div><div><br></div><div><div>-record(bup_rec, {key, val}).</div></div><div><br></div><div><div>test_cannot_restore_backup() -></div><div> Node = node(),</div><div> mnesia:lkill(),</div><div> ok = mnesia:delete_schema([Node]),</div>
<div> mnesia:start(),</div><div> mnesia:wait_for_tables([schema], infinity),</div><div><br></div><div> OldBup = "old.BUP",</div><div> file:delete(OldBup),</div><div><br></div><div> CreateList = [{ram_copies, [Node]},</div>
<div> {attributes, record_info(fields, bup_rec)}],</div><div> {atomic, ok} = mnesia:create_table(bup_rec, CreateList),</div><div> mnesia:wait_for_tables([bup_rec], infinity),</div><div> OldRecs = [#bup_rec{key = I, val = I * I} || I <- lists:seq(1, 10)],</div>
<div> lists:foreach(fun(R) -> ok = mnesia:dirty_write(R) end, OldRecs),</div><div><br></div><div> mnesia:backup(OldBup),</div><div><br></div><div> mnesia:stop(),</div><div> ok = mnesia:delete_schema([Node]),</div>
<div> mnesia:start(),</div><div> mnesia:wait_for_tables([schema], infinity),</div><div><br></div><div> mnesia:restore(OldBup, [{default_op, recreate_tables}]),</div><div> ok = mnesia:table_info(bup_rec, all).</div>
</div><div><br></div><div><br></div><div>I would like to know if I am doing the backup wrong, or if this is something which is not supported.</div><div><br></div><div>Thanks</div><div>Philip</div>