OrientDB supports backup and restore operations like any RDBMS.
Backup executes a complete backup against the currently opened database. The backup file is compressed using the ZIP algorithm. To restore the database use the Restore Database command. Backup is much faster than Export Database. Look also to Export Database and Import Database commands. Backup can be done automatically by enabling the Automatic-Backup Server plugin.
Backup does a consistent copy of database, all further write operations are locked waiting to finish it. The database is in read-only mode during backup operation. If you need an read/write database during backup setup a distributed cluster of nodes.
Export, instead, doesn't lock the database and allow concurrent writes during the export process. This means the exported database could have changes executed during the export.
Starting from v1.7.8, OrientDB comes with the script "backup.sh" under the "bin" directory. This script executes the backup by using the console. Syntax:
./backup.sh <dburl> <user> <password> <destination> [<type>]
Where:
Example of backup against a database open with "plocal":
./backup.sh plocal:../database/testdb admin admin /dest/folder/backup.zip
backup.sh script supports non-blocking backup if the OS supports LVM). Example:
./backup.sh plocal:../database/testdb admin admin /dest/folder/backup.zip lvm
Same example like before, but against a remote database hosted on localhost:
./backup.sh remote:localhost/testdb root rootpwd /dest/folder/backup.zip lvm
For more information about LVM) and Copy On Write (COS) look at:
You can also use the console to execute a backup. Below the same backup like before, but using the console.
orientdb> connect plocal:../database/testdb admin admin
orientdb> backup database /dest/folder/backup.zip
Backup executed in 0,52 seconds
Use the console to restore a database. Example:
orientdb> restore database /backups/mydb.zip
Restore executed in 6,33 seconds