# Backup and Restore the User Database

To protect against unexpected errors like hard disk failure it is wise to periodically backup your user database. CodeSnip has a tool to help with this: it can write your complete user database to a single file that you can archive safely. CodeSnip can recreate the user database from such backup files if necessary.

Note that backups do not include the main DelphiDabbler Snippets Database. This is because you can just download a fresh copy of it from the internet if you need to replace it. Use the Database | Install or Update DelphiDabbler Snippets Database menu option to do that.

## How to create a backup

To perform the backup just select the Database | Backup User Database menu option. This displays a file dialogue box where you specify a file to use for the backup. It is up to you how to name the file. Including the date of the backup may be a good idea.

You can save the file to a USB drive or portable hard drive or put it something like a Dropbox or Google Drive folder.

## How to restore a backup

Should the worst happen and you loose your user defined database you can recreate it from your latest backup.

To do this use the Database | Restore Backup menu option. This displays a file dialogue box where you can navigate to your chosen backup file. Select the file and click OK to restore the backup.

If the backup file is valid it will replace any existing user database and then the whole database will be reloaded. All existing tabs in the user interface will be closed. When the database has finished reloading a new tab will open with a message informing that the database has been updated.