how to list databases ?

Francesco Cesarini (Erlang Consulting) <>
Wed Feb 22 13:02:04 CET 2006

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 :-) ). 

>-----Original Message-----
>From: chandru [mailto:]
>Sent: Wednesday, February 22, 2006 10:33 AM
>To: 'Michal Slaski'
>Cc: 'Marcin Kuczera', 
>Subject: Re: how to list databases ?
>On 21/02/06, Michal Slaski <> wrote:
>> On 16/02/06, Marcin Kuczera wrote:
>> > I am trying to get a databases list and list of keys.
>> >
>> > What I mean is, I have a command:
>> > mnesia:read({Db, DBKey}).my node is Ericsson's SGSN 5.5I want to get
>> > measurement counters which are probably kept in mnesia,but I have no idea
>> > what kind of Db and DBKey's values.Is there any method to list them ?
>> If you can connect to the node's shell then this code should list you
>> all mnesia tables and keys:
>> %% get all mnesia tables
>> ListOfTables = mnesia:system_info(tables),
>> %% get all keys for each table
>> ListOfKeys =
>> [{Table, mnesia:dirty_all_keys(Table)} ||
>> Table <- ListOfTables,
>> Table /= schema ],
>Use this with a bit of caution! On a node with tables with lots of
>entries you might end up with the node running out of memory!
>Marcin, you are probably better off sticking to the procedures laid
>out by E///. If by mistake you bring the node down, you might be in a
>bit of trouble :-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list