# Backing up and restoring databases

Derby provides a way to back up a database while it is either offline or online. You can also restore a full backup from a specified location.

To back up a database, you can do any of the following:

- Shut down the database and use operating system commands to copy it to a backup location, as described in Offline backups.
- Leave the database running and call one of four system backup procedures to copy it to a backup location, as described in Using the backup procedures to perform an online backup.
- Leave the database running, but call a system procedure to freeze the database, use operating system commands to copy it to a backup location, then call a system procedure to unfreeze the database, as described in Using operating system commands with the freeze and unfreeze system procedures to perform an online backup.

To restore a database from a backup copy, you must use one of three connection URL attributes:

- `restoreFrom=path`, described in Restoring a database from a backup copy
- `createFrom=path`, described in Creating a database from a backup copy
- `rollForwardRecoveryFrom=path`, described in Roll-forward recovery

- Backing up a database
  You can back up a database either offline (when it is shut down) or online (when it is running).
- Restoring a database from a backup copy
  To restore a database by using a full backup from a specified location, specify the restoreFrom=path attribute in the boot-time connection URL.
- Creating a database from a backup copy
  To create a database from a full backup copy at a specified location, specify the createFrom=path attribute in the boot-time connection URL.
- Roll-forward recovery
  Derby supports roll-forward recovery to restore a damaged database to the most recent state before a failure occurred.

Parent topic: Part Two: Derby Administration Guide
Related concepts
Maintaining database integrity
Checking database consistency
Importing and exporting data
Replicating databases
Logging on a separate device
Obtaining locking information
Reclaiming unused space