how to list databases ?

chandru <>
Wed Feb 22 11:33:39 CET 2006


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

cheers
Chandru



More information about the erlang-questions mailing list