H2 Database - Backup



BACKUP is the command used to take database backup into a separate .zip file. Objects are not locked, and when it takes backup the transaction log is also copied. Admin rights are required to execute this command.

Syntax

Following is the generic syntax of the Backup command.

BACKUP TO fileNameString;

Example

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

BACKUP TO 'backup.zip';

On executing the above command, you will get the backup.zip file in your local file system.

Advertisements