<html><P>Another way of getting all the keys is using ets:tab2list(TableName) as mnesia uses ets tables. But as Chandru says, be careful if you are doing it in a live network, as the result is stored in the shell history. The more times you do it, the more memory you consume and you might end up running out of memory (Been there, done it, not sure anyone noticed :-) ). <BR></P>
<P>Francesco<BR>--<BR><A href="http://www.erlang-consulting.com">http://www.erlang-consulting.com</A><BR>>-----Original Message-----<BR>>From: chandru [mailto:chandrashekhar.mullaparthi@gmail.com]<BR>>Sent: Wednesday, February 22, 2006 10:33 AM<BR>>To: 'Michal Slaski'<BR>>Cc: 'Marcin Kuczera', erlang-questions@erlang.org<BR>>Subject: Re: how to list databases ?<BR>><BR>>On 21/02/06, Michal Slaski <michal@erlang-consulting.com> wrote:<BR>>> On 16/02/06, Marcin Kuczera wrote:<BR>>> > I am trying to get a databases list and list of keys.<BR>>> ><BR>>> > What I mean is, I have a command:<BR>>> > mnesia:read({Db, DBKey}).my node is Ericsson's SGSN 5.5I want to get<BR>>> > measurement counters which are probably kept in mnesia,but I have no idea<BR>>> > what kind of Db and DBKey's values.Is there any method to list them ?<BR>>><BR>>> If you can connect to the node's shell then this code should list you<BR>>> all mnesia tables and keys:<BR>>><BR>>> %% get all mnesia tables<BR>>> ListOfTables = mnesia:system_info(tables),<BR>>><BR>>> %% get all keys for each table<BR>>> ListOfKeys =<BR>>> [{Table, mnesia:dirty_all_keys(Table)} ||<BR>>> Table <- ListOfTables,<BR>>> Table /= schema ],<BR>>><BR>><BR>>Use this with a bit of caution! On a node with tables with lots of<BR>>entries you might end up with the node running out of memory!<BR>><BR>>Marcin, you are probably better off sticking to the procedures laid<BR>>out by E///. If by mistake you bring the node down, you might be in a<BR>>bit of trouble :-)<BR>><BR>>cheers<BR>>Chandru<BR>></P></html>