H2 Database - Backup

H2 Database - Backup

BACKUP is a command used to back up a database to a separate .zip file. Objects are not locked, and when a backup is performed, the transaction log is also copied. Administrator rights are required to run this command.


Following is the general syntax of the backup command.

BACKUP TO fileNameString;


In this example, let's take a backup of the current database into a backup.zip file . Use the following command for the same.

BACKUP TO 'backup.zip' ;

By running the above command, you will get a backup.zip file on your local file system.