Problem creating mnesia table

Hakan Mattsson <>
Fri Aug 20 10:07:33 CEST 2004


On Thu, 19 Aug 2004, Eric Merritt wrote:

EM> I am having a bit of a problem  creating a  disc_copies  of a mnesia
EM> table. Every time  I try to run the following I  get back a
EM> {aborted,{}}
EM> 
EM> However, according to  every example  I can find this is correct.
EM> 
EM>  Table_def = [{attributes,  Field_list},
EM> 		 {disc_copies, [node()]}]
EM> 
EM>  mnesia:create_table(Name, Table_def)

Is your Mnesia configured to be disk resident?

In order to be able to create disc_copies and disc_only_copies the
schema must be stored on disk. New disk resident databases are
created with mnesia:create_schema/1. Already existing databases
are converted node by node with mnesia:change_table_copy_type/3:

  % erl
  Erlang (BEAM) emulator version 5.3 [source] [threads:0]

  Eshell V5.3  (abort with ^G)
  1> mnesia:start().
  ok
  2> mnesia:create_table(foo,[{disc_copies, [node()]}]).
  {aborted,{}}
  3> mnesia:table_info(schema, storage_type).
  ram_copies
  4>
  4> mnesia:change_table_copy_type(schema, node(), disc_copies).
  {atomic,ok}
  5>
  5> mnesia:table_info(schema, storage_type).
  disc_copies
  6> mnesia:create_table(foo,[{disc_copies, [node()]}]).
  {atomic,ok}

/Håkan




More information about the erlang-questions mailing list