<div dir="ltr">You do can convert live database, but there are some limitation, and you could lose some of your data. You will lose all data which is not yet transferred from log file. If you don't want to risk losing data, you may open DECISION_TAB.LOG and LATEST.LOG with <span class="code">disc_log module</span> and convert them as well. They contain many different types of records though.<div><br><div>This method is for disk-only-copy tables only. I think there could be problems with disk-copy tables, as ets dumps contain node information too. But maybe not.<div><br></div><div>So</div><div>You need to stop mnesia, and open file schema.DAT with dets:open_file(). It contains records of type {schema, SchemaName, ParamsList}.</div><div><br></div><div>ParamsList is a proplist. Node name (node_name()) contains in {ram_copies,[node_name()]}, {disc_copies, [node_name()]}, {disc_only_copies, [node_name()]}, {version, {Version, {node_name(), TimeStamp}}} and {cookie, {TimeStamp, node_name()}}. {cookie, ..} and {version, ..} could contain an empty list as value as well.</div><div>You need to iterate records in this table, change nodename() from old to current node name (or just change any to current node name if you have single-node database) and insert them back.</div><div>Then close the dets file, delete two files - DECISION_TAB.LOG and LATEST.LOG, and start mnesia again.</div><div><br></div><div>This could be done in auto mode on each restart, if you're brave one. Just stop mnesia, open scheme.DAT, check if all record have current node, and if some have different node name do the conversion.</div><div><br><br>понедельник, 23 сентября 2013 г., 10:58:34 UTC+4 пользователь Yash Ganthe написал:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Hi,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">On a node named node1@localhost I created an Mnesia schema using:</p>
<p class="MsoNormal">mnesia:create_schema([node()])<wbr>.</p>
<p class="MsoNormal">and created a table using:</p>
<p class="MsoNormal">mnesia:create_table(tab1, [{disc_copies, [node()]}, {attributes, record_info(fields, tab1)}]).</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">The mnesia directory was set to "mnesia_node1". The directory was created and the DB files were created inside it.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Once the node was stopped, the DB files still exist in the directory. I hoped to re-use the DB as the mnesia DB for another node, node2.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">So I started the other node using:</p>
<p class="MsoNormal">erl -name node2 -mnesia dir "mnesia_node1".</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">On node2 when I start mnesia and do a tv:start(), I see the tab1 listed in the schema. However, it shows no records. I was expecting Mnesia to use the directory as the location of all DB files.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Is there something I have missed?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks,</p>
<p class="MsoNormal">Yash</p>
</div>
<p>DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
</p>
</div>
</blockquote></div></div></div></div>