how to list databases ?

Michal Slaski <>
Tue Feb 21 16:50:51 CET 2006


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 ],

	%% ListOfKeys is a list of tuples
	%% with table name and table keys
	io:format("~p~n",[ListOfKeys]).

You can also try running tv:start() and then go to menu View -> Mnesia Tables.

--
Michal Slaski
www.erlang-consulting.com



More information about the erlang-questions mailing list