Initial version of db mgmt scripts in nynja_oam app
Created by: uwiger
See issue #301
Based on branch uw-rebar3-otp21-development (pr #299)
Added nynja_oam app to collect O&M utility code.
Three scripts, to be used as extensions to the bin/server start script.
bin/server db_install_fallback FILE
Used to load a mnesia fallback into e.g. a local build. The script starts a clean node (i.e. using -boot start_clean), loads mnesia tables, then installs the fallback. If this goes well, mnesia is stopped and restarted. The tables are loaded, and then the node is shut down.
Since both the original database and the resulting database are loaded completely, running this command may take some time.
bin/server db_snapshot FILE
Used in order to be able to quickly reset the database e.g. between test runs. A clean node is started, mnesia is started and tables are loaded. After this, transaction logs are dumped, mnesia is stopped, and a compressed tar file of the mnesia directory is created.
Since table loading is done, running this command on a large database may take some time.
bin/server db_restore SNAPSHOT
With a snapshot file created using db_snapshot above, a clean node is started, the mnesia directory is deleted and re-created from the snapshot archive. A simple check is done to ensure that the snapshot file is indeed a readable tar file, and that it contains a directory matching the mnesia directory name.
This command is reasonably fast even on a fairly large database.