Skip to main content

Backup

Creates a backup of a BadgerDB database to a file. Supports both live backups (database is open) and offline backups (database is closed).

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

  • Database Id - The unique identifier of an open database for live backups. Used when the database is currently in use.
  • Database Folder - The path to the database folder for offline backups. Used when the database is not currently open.
  • Backup File Path - The path where the backup file will be saved (e.g., "C:\backups\mydb-backup.bak").
info

You must provide either Database Id (for live backup) or Database Folder (for offline backup), but not both.

How It Works

The Backup node creates a complete snapshot of the database that can later be restored using the Restore node.

Live Backup (Database Id provided)

When executed with a Database Id, the node:

  1. Retrieves the open database instance
  2. Creates a backup file at the specified path
  3. Uses a buffered writer for efficient backup
  4. Performs a full backup including all data and versions
  5. Flushes and syncs the backup to disk

Offline Backup (Database Folder provided)

When executed with a Database Folder, the node:

  1. Opens the database in read-only mode
  2. Creates a backup file at the specified path
  3. Performs a full backup
  4. Closes the database after backup completes

Examples

Example 1: Live Backup During Automation

Backup an open database without closing it:

1. Open
Database Folder: C:\RPA\databases\customers
Storage: Disk
→ db_id

2. Set multiple values...
Database Id: {{db_id}}

3. Backup (Live)
Database Id: {{db_id}}
Database Folder: (empty)
Backup File Path: C:\backups\customers-{{timestamp}}.bak

4. Close
Database Id: {{db_id}}

Example 2: Offline Backup

Backup a closed database:

Backup (Offline)
Database Id: (empty)
Database Folder: C:\RPA\databases\customers
Backup File Path: C:\backups\customers-offline.bak

Example 3: Scheduled Daily Backup

Create daily backups with timestamps:

1. Get Current Date
→ current_date (format: YYYY-MM-DD)

2. Backup
Database Id: {{db_id}}
Backup File Path: C:\backups\db-backup-{{current_date}}.bak

Example 4: Backup Before Major Operation

Backup before making significant changes:

1. Open Database
→ db_id

2. Backup (Safety)
Database Id: {{db_id}}
Backup File Path: C:\backups\before-migration.bak

3. Perform Migration
Database Id: {{db_id}}
(risky operations...)

4. Backup (After)
Database Id: {{db_id}}
Backup File Path: C:\backups\after-migration.bak

5. Close
Database Id: {{db_id}}

Example 5: Automated Backup Rotation

Keep last 7 daily backups:

1. Get Day of Week
→ day_num (0-6)

2. Backup
Database Id: {{db_id}}
Backup File Path: C:\backups\db-day-{{day_num}}.bak

Tips for Effective Use

  • Use Live Backups when the database is actively being used
  • Use Offline Backups when the database is not in use
  • Include Timestamps in backup filenames for version tracking
  • Store Backups Separately from the database folder
  • Verify Backup Size after creation to ensure completeness
  • Test Restore Process regularly to ensure backups are valid
  • Automate Backups with scheduled flows
  • Keep Multiple Versions for point-in-time recovery

Common Errors and Solutions

Error: "Both database folder and db ID cannot be empty"

Solution: Provide either Database Id or Database Folder.

Correct (Live Backup):
Database Id: {{db_id}}
Database Folder: (empty)

Correct (Offline Backup):
Database Id: (empty)
Database Folder: C:\RPA\databases\mydb

Error: "backup file path cannot be empty"

Solution: Provide a valid file path for the backup.

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

Error: "database folder does not exist"

Solution: Ensure the database folder path is correct for offline backups.

Check the path:
Database Folder: C:\RPA\databases\mydb (must exist)

Error: Permission Denied

Solution: Ensure the automation has write permissions to the backup location.

  • Choose a backup location with write access
  • Run the automation with appropriate permissions
  • Create the backup folder manually if needed

Error: Disk Space

Solution: Ensure sufficient disk space for the backup file.

  • Backup files can be as large as the database
  • Check available disk space before backing up
  • Use compression or cleanup old backups

Backup File Format

  • Format: BadgerDB native backup format
  • Compression: Not compressed (consider using file compression after backup)
  • Portability: Can be restored to any platform (Windows, Linux, macOS)
  • Version: Includes all data versions stored in the database
  • Size: Approximately the size of the database directory

Backup vs. Export

Backup Node

  • Creates a complete database snapshot
  • Native BadgerDB format
  • Can be restored fully with Restore node
  • Preserves all metadata and versions
  • Fast backup and restore
  • Binary format

Export Node

  • Creates human-readable CSV file
  • Key-value pairs only
  • Cannot be directly restored
  • Useful for data analysis and migration
  • Slower for large datasets
  • Text format

Use Backup for disaster recovery and database migration. Use Export for data analysis, reporting, or migration to other systems.

Backup Strategies

Strategy 1: Full Daily Backups

Backup every day at midnight:
Backup File Path: C:\backups\db-{{YYYY-MM-DD}}.bak
Retention: Keep 30 days

Strategy 2: Hourly Backups During Business Hours

Backup every hour during work hours:
Backup File Path: C:\backups\db-{{YYYY-MM-DD-HH}}.bak
Retention: Keep last 24 hours

Strategy 3: Before/After Major Operations

Backup before risky operations:
Backup File Path: C:\backups\before-{{operation}}-{{timestamp}}.bak
Backup File Path: C:\backups\after-{{operation}}-{{timestamp}}.bak

Strategy 4: Rotating Weekly Backups

Keep one backup per day of week:
Backup File Path: C:\backups\db-{{day_name}}.bak
Result: 7 backups, always have last week

Performance Considerations

  • Backup Duration - Depends on database size and disk speed
  • Buffer Size - Uses 64MB buffer for efficient I/O
  • Live Backup Impact - Minimal performance impact on running database
  • Disk I/O - Sequential writes are optimized
  • CPU Usage - Low CPU usage during backup

Best Practices

  • Regular Schedule - Automate backups on a regular schedule
  • Test Restores - Periodically test backup restoration
  • Off-Site Storage - Copy backups to separate location or cloud storage
  • Retention Policy - Define how long to keep backups
  • Naming Convention - Use consistent, descriptive backup filenames
  • Monitor Backups - Alert on backup failures
  • Document Process - Document backup and restore procedures
  • Version Control - Keep multiple backup versions

Backup Checklist

Before deploying to production:

  • Backup schedule defined
  • Backup location has sufficient space
  • Backup permissions configured
  • Restore process tested
  • Backup monitoring in place
  • Off-site backup configured
  • Retention policy defined
  • Recovery time objective (RTO) defined
  • Restore - Restores a database from a backup file
  • Export - Exports data to CSV format
  • Open - Opens a database (use Database Id for live backups)
  • Close - Closes a database (must be closed for offline backups)