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.
NOTE: Backup of remote databases is not supported in Community Edition, but only in Enterprise Edition. If you're using the Enterprise Edition look at Remote Backup.
backup database <output-file> [-compressionLevel=<compressionLevel>] [-bufferSize=<bufferSize>]
Where:
orientdb> connect plocal:../databases/mydatabase admin admin
orientdb> backup database /backups/mydb.zip
Backuping current database to: database mydb.zip...
Backup executed in 0,52 seconds
Backup can be executed in Java and any language on top of the JVM by using the method backup() against the database instance:
db.backup(out, options, callable, listener, compressionLevel, bufferSize);
Where:
Example:
ODatabaseDocumentTx db = new ODatabaseDocumentTx("plocal:/temp/mydb");
db.open("admin", "admin");
try{
OCommandOutputListener listener = new OCommandOutputListener() {
@Override
public void onMessage(String iText) {
System.out.print(iText);
}
};
OutputStream out = new FileOutputStream("/temp/mydb.zip");
db.backup(out,null,null,listener,9,2048);
} finally {
db.close();
}