Database Backup & Recovery: Disaster Recovery Guide | Nife Docs

Understand automatic backups, recovery options, and disaster recovery strategies.


Automatic Backups#

What's Included#

All managed databases include automatic backups:

Backup Coverage:

  • โœ… All data
  • โœ… All schemas
  • โœ… Configuration
  • โœ… User accounts
  • โœ… Indexes

Backup Frequency:

  • Daily backups at 00:00 UTC
  • Weekly full backup
  • Monthly long-term archive

Automatic Backup Features:

  • No configuration needed
  • Runs during low-traffic times
  • Encrypted backups
  • Geo-redundant storage
  • Automated retention

Backup Retention#

How long backups are kept:

Backup TypeRetentionKeep Up To
Daily7 days7 backups
Weekly30 days4 backups
Monthly1 year12 backups
ManualAs long as neededUnlimited

Automatic Cleanup:

  • Old backups deleted automatically
  • Compliant with retention policy
  • Can extend retention if needed

Point-in-Time Recovery (PITR)#

What is PITR?#

Restore database to any point in the last 7 days:

Available Granularity:

  • Minute-level precision
  • Any time within 7-day window
  • Before data was corrupted
  • Before accidental deletion
  • Before bad code deployment

How PITR Works:

  1. Takes daily full backup
  2. Keeps transaction logs
  3. Can replay transactions
  4. Reconstruct any point in time

Using PITR#

Scenario: Accidental Data Delete

2024-01-15 14:00 - Someone deletes important data
2024-01-15 14:05 - You realize the mistake
2024-01-15 14:10 - Use PITR to restore to 13:50
Result: Data is recovered

How to use:

  1. Go to Backups
  2. Click Point-in-Time Recovery
  3. Select the timestamp you want
  4. Confirm recovery
  5. New database created
  6. Switch applications to new database

Available timestamps:

  • All points in last 7 days
  • Timezone selection available
  • Minute-level precision

Recovery Scenarios#

Scenario 1: Corrupted Data#

Problem:

Application bug caused data corruption
Thousands of records affected
Happened 2 hours ago

Recovery:

  1. Identify when corruption started (14:30)
  2. Use PITR to restore to 13:00
  3. Export data from restored database
  4. Verify data integrity
  5. Re-import clean data
  6. Fix application bug
  7. Deploy fix

Time to recover: 30 minutes to 2 hours

Scenario 2: Accidental Deletion#

Problem:

User accidentally deleted customer records
200 records lost
Backup available from same day

Recovery:

  1. Create backup of current database (for safety)
  2. Use Point-in-Time Recovery
  3. Restore to before deletion (yesterday 23:00)
  4. Export deleted records
  5. Import into current database
  6. Verify restored data

Time to recover: 15-30 minutes

Scenario 3: Ransomware/Intrusion#

Problem:

Ransomware encrypted database
All data inaccessible
Happened 12 hours ago

Recovery:

  1. Isolate affected database
  2. Shut down affected application
  3. Restore from backup before infection
  4. Verify no malware in restored data
  5. Change all credentials
  6. Re-deploy applications
  7. Monitor for re-infection

Time to recover: 1-4 hours depending on size

Scenario 4: Failed Migration#

Problem:

Migration to new version failed
Data corrupted
Need to rollback

Recovery:

  1. Backup current corrupted database
  2. Restore from pre-migration backup
  3. Investigate what went wrong
  4. Fix migration process
  5. Retry with fixes

Time to recover: 30 minutes to 2 hours


Manual Backups#

Creating Manual Backups#

Create on-demand backups anytime:

When to create:

  • Before major changes
  • Before code deployments
  • Before version upgrades
  • Before scaling operations
  • Before configuration changes
  • Quarterly for compliance

How to create:

  1. Go to Backups tab
  2. Click Create Manual Backup
  3. Add optional description
  4. Confirm

Time to complete: 5-60 minutes depending on size

Manual Backup Naming#

Use descriptive names:

Good names:

  • pre-upgrade-16.1
  • before-migration-20240115
  • quarterly-backup-q1-2024
  • before-schema-change

Bad names:

  • backup1
  • backup_old
  • temp

Naming tips:

  • Include purpose
  • Include date/version
  • Make it searchable
  • Document reason

Managing Manual Backups#

View all backups:

  1. Go to Backups tab
  2. See all automatic and manual
  3. Filter by type
  4. Sort by date

Restore from manual:

  1. Click Restore on backup
  2. Choose: new database or replace
  3. Confirm

Delete manual:

  1. Click Delete on backup
  2. Confirm deletion
  3. Cannot be undone

Backup Exports#

Why Export Backups?#

Use cases:

  • Long-term archival (keep beyond 1 year)
  • Off-site disaster recovery
  • Migration to different system
  • Compliance requirements
  • Data analysis outside database

Export Options#

PostgreSQL/MySQL Export:

-- Exported as SQL dump
-- Can restore anywhere
-- Portable across systems
-- Includes DDL and DML

MongoDB Export:

-- Exported as JSON/BSON
-- Document structure preserved
-- Can import to another MongoDB
-- Large file sizes

Redis Export:

-- Exported as RDB dump
-- Binary format
-- Can restore to another Redis
-- Preserves all data types

How to Export#

  1. Go to Backups
  2. Click Export on backup
  3. Select format (SQL, JSON, etc.)
  4. Download starts
  5. File saved to your computer

File sizes:

  • Small database: 1-100 MB
  • Medium database: 100 MB - 1 GB
  • Large database: 1-10 GB+
  • Download may take time

Importing Exported Backups#

PostgreSQL:

psql -h hostname -U root -d postgres < backup.sql

MySQL:

mysql -h hostname -u root -p database < backup.sql

MongoDB:

mongorestore --archive=backup.archive

Disaster Recovery Plan#

Planning for Disasters#

Consider these risks:

  • Data corruption
  • Accidental deletion
  • Hardware failure
  • Regional outage
  • Security breach
  • Application bug

Recovery Time Objectives (RTO)#

How fast can you recover?

ScenarioTarget Time
Corruption15 minutes
Deletion30 minutes
Failed upgrade1 hour
Regional outage4 hours
Complete loss24 hours

Our capabilities:

  • PITR: 15 minutes (7-day window)
  • From backup: 30 minutes
  • From manual export: 1-4 hours

Recovery Point Objective (RPO)#

How much data can you lose?

Our options:

  • Daily: Lose at most 1 day of data
  • Point-in-time: Lose at most minutes of data
  • Real-time replica: Lose zero data

Disaster Recovery Strategy#

Recommended approach:

  1. Daily Backups (automatic)

    • Included with service
    • Retain 7 days
    • Geo-redundant
  2. Point-in-Time Recovery

    • Available 7 days
    • Minute-level precision
    • No setup needed
  3. Manual Backups (monthly)

    • Created before major changes
    • Stored separately
    • Documented location
  4. Exported Backups (quarterly)

    • SQL/JSON export
    • Stored off-site
    • Long-term archive
  5. Read Replicas (optional)

    • Different region
    • Always in sync
    • Instant failover

Testing Recovery#

Regular Testing#

Test quarterly:

  1. Create manual backup
  2. Restore to test database
  3. Verify data integrity
  4. Test application connects
  5. Validate all data present
  6. Document results

Test Procedures#

Unit Test Recovery:

# Restore from backup
# Verify table counts
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM orders;
# Spot check data
SELECT * FROM users LIMIT 10;
# Verify recent data
SELECT * FROM orders
WHERE created_at > NOW() - INTERVAL '1 day';

Integration Test:

  1. Restore backup to new database
  2. Update connection string
  3. Start application
  4. Run smoke tests
  5. Check all features work
  6. Verify data consistency

Load Test:

  1. Restore to test database
  2. Run performance tests
  3. Check query speed
  4. Monitor resource usage
  5. Document results

Backup Best Practices#

1. Verify Backups Work#

  • Test restoration quarterly
  • Document procedures
  • Time the recovery process
  • Train team on recovery

2. Keep Multiple Copies#

  • Automatic daily
  • Manual monthly
  • Exported quarterly
  • Off-site storage

3. Retention Policy#

  • Keep daily 7 days
  • Keep weekly 30 days
  • Keep monthly 1 year
  • Archive as needed

4. Document Everything#

  • Backup schedule
  • Retention policy
  • Recovery procedures
  • Contact information

5. Encryption#

  • Backups encrypted at rest
  • Encrypted in transit
  • Store encryption keys securely
  • Document key location

6. Regular Testing#

  • Test recovery quarterly
  • Update procedures
  • Train new team members
  • Time your recovery

7. Monitor Backups#

  • Verify daily backups complete
  • Check backup size trends
  • Monitor storage usage
  • Alert on failures

Compliance & Regulations#

GDPR Requirements#

  • Right to be forgotten: Delete on request
  • Data portability: Export data
  • Breach notification: 72 hours
  • Data residency: Keep in EU

Our support:

  • Export data on request
  • Geo-redundant backups in EU
  • Encryption at rest
  • Access logs for audit

HIPAA Requirements#

  • Encrypted backups
  • Access control
  • Audit logs
  • Disaster recovery

Our support:

  • AES-256 encryption
  • Role-based access
  • Comprehensive logging
  • Backup redundancy

Other Regulations#

  • SOC 2: Audit reports available
  • ISO 27001: Certification available
  • PCI-DSS: Payment data protection
  • Industry-specific: Consult compliance team

Next Steps#

  1. Managing Databases - Scaling and monitoring
  2. Best Practices - Optimization tips
  3. Troubleshooting - Common issues

Support#

Questions about backups?