File System Level Backup

Aside from the SQL dumps, one can also take the database server out of production using the following commands. Be careful in using shutdown(), because there may be users running transactions. This can be seen using the sys.sessions table or the system monitor.

sql>select sessionid, username, idle, login from sys.sessions;
| sessionid | username | idle  | login                      |
|         0 | monetdb  | null  | 2021-11-12 14:22:06.000000 |
sql> call sys.shutdown(10);

Next we execute in a terminal

shell> monetdb lock demo
shell> monetdb stop demo

The lock step is necessary to prevent monetdbd from automatically restarting the database "demo" upon receiving another client connection request. After the database has been securely stopped, we can create a copy of the database directory (including all subdirectories) in the dbfarm and put it aside in a safe place. You may want to use a archiver (e.g. tar) and compression program (gzip, 7-zip) to reduce the size of the copied directory. Alternatively, incremental file-system dumps can be used to reduce the time and storage space for a recovery point. Finally, the database is released for production again using:

shell>monetdb release demo