# 02-Open_Nvram

> This sample opens, inserts records and performs transactions on a database in non-volatile memory. The application demonstrates how to store then recover an in-memory database from a saved image in a simulated non-volatile RAM memory environment. The database open is informed about a “warm start” by setting flag `db_params.mode_mask |= MCO_DB_OPEN_EXISTING`. This sample must be started twice. The first time it creates and initializes a new database, then stores an image file nvram.img in function `transfer_money()`, then simulates a crash. On the second start the sample allocates memory and restores the database from the image file. Then it opens the database again with flag `MCO_DB_OPEN_EXISTING` and recalculates the data to check consistency of the restored database.

### How to Run

> See instructions here on how to build this and other samples on your development platform. Once built, the sample can be run from the `\target\bin` directory:

>         02_open_nvram

> But it is more instructive to run it in your development environment debugger, stepping through the code.

> Related Topics