Skip to main content

Restore

Restores a BadgerDB database from a backup file created by the Backup node.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Restore File Path - The path to the backup file to restore from (created by Backup node).
  • Database Folder - The path to the target database folder where data will be restored. This folder must exist but must not contain an existing database.

How It Works

The Restore node recreates a database from a backup file, loading all data into the specified database folder.

When executed, the node:

  1. Validates that the restore file exists
  2. Validates that the database folder exists
  3. Checks that the database folder doesn't already contain a database
  4. Opens a new database at the target location
  5. Loads data from the backup file
  6. Closes the database after restoration completes
warning

The Restore node will fail if a database already exists in the target folder. This prevents accidental data loss.

Examples

Example 1: Restore Database

Restore a database from a backup file:

Restore
Restore File Path: C:\backups\customers-2025-12-23.bak
Database Folder: C:\RPA\databases\customers-restored

Example 2: Disaster Recovery

Recover from database corruption:

1. Create Restore Folder
Folder Path: C:\RPA\databases\customers-recovery

2. Restore
Restore File Path: C:\backups\customers-latest.bak
Database Folder: C:\RPA\databases\customers-recovery

3. Open Restored Database
Database Folder: C:\RPA\databases\customers-recovery
→ db_id

4. Verify Data
Get (test key retrieval)

Example 3: Clone Database for Testing

Create a test copy from production backup:

1. Backup Production
Database Id: {{prod_db_id}}
Backup File Path: C:\backups\prod-snapshot.bak

2. Restore to Test Environment
Restore File Path: C:\backups\prod-snapshot.bak
Database Folder: C:\RPA\databases\test-env

3. Open Test Database
Database Folder: C:\RPA\databases\test-env
→ test_db_id

4. Run Tests on Test Database

Example 4: Restore Point-in-Time Backup

Restore a specific backup version:

1. Select Backup File
File: C:\backups\db-2025-12-20.bak

2. Restore
Restore File Path: C:\backups\db-2025-12-20.bak
Database Folder: C:\RPA\databases\restored-dec-20

Example 5: Migration to New Location

Move database to a new location:

1. Backup Current Database
Database Id: {{db_id}}
Backup File Path: C:\temp\migration.bak

2. Close Current Database
Database Id: {{db_id}}

3. Create New Location
Folder: D:\NewLocation\databases\mydb

4. Restore to New Location
Restore File Path: C:\temp\migration.bak
Database Folder: D:\NewLocation\databases\mydb

5. Open at New Location
Database Folder: D:\NewLocation\databases\mydb
→ new_db_id

Tips for Effective Use

  • Create Destination Folder First - Ensure the target folder exists before restoring
  • Folder Must Be Empty - The database folder must not contain an existing database
  • Verify Backup File - Ensure the backup file is complete and not corrupted
  • Test Restores Regularly - Practice restoration to verify backup integrity
  • Use Unique Folder Names - Restore to a different folder to avoid conflicts
  • Check Disk Space - Ensure sufficient space for the restored database
  • Keep Original Backup - Restoration doesn't delete the backup file

Common Errors and Solutions

Error: "database folder cannot be empty"

Solution: Provide a valid path to the target database folder.

Correct:
Database Folder: C:\RPA\databases\restored-db

Error: "database folder does not exist"

Solution: Create the target folder before running Restore.

1. Create Folder
Path: C:\RPA\databases\restored-db

2. Restore
Database Folder: C:\RPA\databases\restored-db

Error: "database restore file path cannot be empty"

Solution: Provide the path to a valid backup file.

Correct:
Restore File Path: C:\backups\mydb.bak

Error: "database restore file not found"

Solution: Ensure the backup file exists at the specified path.

Verify:
- Check file path is correct
- Ensure backup file wasn't moved or deleted
- Check file permissions

Error: "Cannot restore to an already existing database"

Solution: The target folder already contains a database. Either:

  • Use a different folder
  • Delete the existing database files
  • Rename the existing database folder
Option 1 - Use Different Folder:
Database Folder: C:\RPA\databases\restored-db-2

Option 2 - Delete Existing Database:
1. Delete folder contents
2. Run Restore

Option 3 - Rename Existing:
1. Rename C:\RPA\databases\mydb to mydb-old
2. Create new C:\RPA\databases\mydb
3. Run Restore

Error: Corrupted Backup File

Solution: The backup file is corrupted or incomplete.

  • Use a different backup file
  • Verify backup file size and integrity
  • Re-create the backup from the source database

Error: Permission Denied

Solution: Ensure proper file system permissions.

  • Check read permission on backup file
  • Check write permission on database folder
  • Run with appropriate user privileges

Restore Process Details

What Gets Restored

  • All key-value pairs
  • All data versions
  • Metadata and database settings
  • Complete database state at backup time

What Doesn't Get Restored

  • In-memory databases (can't be backed up)
  • Open connections or transactions
  • Runtime state

Restoration Scenarios

Scenario 1: Disaster Recovery

Problem: Production database corrupted Solution:

1. Identify latest valid backup
2. Create new database folder
3. Restore from backup
4. Verify data integrity
5. Switch to restored database

Scenario 2: Accidental Data Loss

Problem: Critical data was deleted Solution:

1. Find backup before deletion
2. Restore to temporary location
3. Extract needed data
4. Import into production database

Scenario 3: Testing New Features

Problem: Need production-like test data Solution:

1. Backup production database
2. Restore to test environment
3. Anonymize sensitive data
4. Run tests

Scenario 4: Database Migration

Problem: Moving to new server Solution:

1. Backup on old server
2. Transfer backup file
3. Restore on new server
4. Verify and switch over

Performance Considerations

  • Restore Duration - Depends on backup file size and disk speed
  • Disk I/O - Sequential reads and writes
  • Memory Usage - Controlled by max pending writes (256)
  • CPU Usage - Low during restoration
  • No Downtime - Can restore to new location without affecting current database

Best Practices

  • Test Restore Process - Regularly test that backups can be restored
  • Verify After Restore - Check data integrity after restoration
  • Document Procedures - Maintain restore procedure documentation
  • Automate Testing - Create automated restore tests
  • Keep Multiple Backups - Don't rely on a single backup file
  • Secure Backup Files - Protect backup files from unauthorized access
  • Monitor Restore Time - Track how long restoration takes for capacity planning
  • Off-Site Backups - Store backups in separate physical location

Restoration Checklist

When performing a restore:

  • Identify correct backup file
  • Verify backup file integrity
  • Create target database folder
  • Ensure sufficient disk space
  • Check folder permissions
  • Stop any processes using target folder
  • Run Restore node
  • Verify restoration completed
  • Open and test restored database
  • Verify critical data exists
  • Document restore operation

Recovery Time Objective (RTO)

Plan your restoration strategy based on acceptable downtime:

  • RTO < 5 minutes: Use live backups, keep hot standby
  • RTO < 1 hour: Hourly backups, automated restore process
  • RTO < 24 hours: Daily backups, manual restore process
  • RTO > 24 hours: Weekly backups, documented procedures
  • Backup - Creates backup files for restoration
  • Open - Opens the restored database
  • Export - Alternative for data migration (CSV format)
  • Close - Close databases before backup/restore operations