Why doesn't backup/restore work for me?

Sergey Samokhin <>
Mon Jun 1 21:50:24 CEST 2009


Hello.

After mnesia:restore/2 has been applied, I don't see the records
restored from backup made by mnesia:backup/1 (which is supposed to
create complete backup of all the table if I don't make a mistake).

I must have missed something significant, but I don't see what exactly.

Here is example:

%%%%%%%%%%%%
test() ->
    mnesia:start(),

    mnesia:create_table(foo, []),
    [mnesia:dirty_write({foo, N, -N}) || N <- lists:seq(1, 100)],
    io:format("# ~p records inserted~n", [mnesia:table_info(foo, size)]),

    mnesia:backup(backup_file),

    mnesia:clear_table(foo),

    mnesia:restore(backup_file, []),

    io:format("# ~p records restored~n", [mnesia:table_info(foo, size)]).
%%%%%%%%%%%%

Results:

1> test:test().
# 100 records inserted
# 0 records restored

Thanks.

-- 
Sergey Samokhin


More information about the erlang-questions mailing list