OrientDB Manual

Backup & Restore

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.

When to use backup and when export?

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.

Backup database

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


  • dburl: database URL
  • user: database user allowed to run the backup
  • password: database password for the specified user
  • destination: destination file path (use .zip as extension) where the backup is created
  • type: optional backup type, supported types are:
    • default, locks the database during the backup
    • lvm, uses LVM copy-on-write snapshot to execute in background

Example of backup against a database open with "plocal":

./backup.sh plocal:../database/testdb admin admin /dest/folder/backup.zip

Non-Blocking Backup

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:

Using the console

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

Restore database

Use the console to restore a database. Example:

orientdb> restore database /backups/mydb.zip
Restore executed in 6,33 seconds

See also