Skip to content

Backup & Recovery

Backup & Recovery

Protect your institution’s data with regular backups and learn how to restore when needed.

Time Required: 15 minutes Module: Core (Database Administration) User Role: System Administrator


Table of Contents

  1. Backup Overview
  2. Creating Backups
  3. Automated Backups
  4. Restoring from Backup
  5. Backup Best Practices
  6. Troubleshooting

Backup Overview

What Gets Backed Up

ComponentIncludedDescription
DatabaseYesAll records, settings, configurations
File StoreYesUploaded documents, images, attachments
Custom CodeOptionalCustom modules (if applicable)

Backup Types

TypeUse CaseSize
Full Backup (with filestore)Complete system recoveryLarge
Database OnlyData recoveryMedium
IncrementalFrequent backupsSmall

Creating Backups

Method 1: Database Manager (Web Interface)

  1. Navigate to /web/database/manager in your browser
  2. Enter the master password
  3. Click Backup next to your database
  4. Select backup format:
    • ZIP (with filestore) - Complete backup
    • pg_dump - Database only
  5. Click Backup
  6. Download the backup file

Method 2: Command Line

For PostgreSQL database backup:

Terminal window
# Full database backup
pg_dump -U odoo -F c -b -v -f backup_$(date +%Y%m%d).dump dbname
# With compression
pg_dump -U odoo dbname | gzip > backup_$(date +%Y%m%d).sql.gz

Method 3: Odoo CLI

Terminal window
# Using odoo-bin
./odoo-bin -d dbname --backup /path/to/backup.zip

Backup Naming Convention

Use consistent naming for easy identification:

openeducat_YYYY-MM-DD_HH-MM.zip

Example: openeducat_2026-01-06_14-30.zip


Automated Backups

Setting Up Scheduled Backups

Using Cron

Create a backup script:

#!/bin/bash
BACKUP_DIR="/var/backups/openeducat"
DB_NAME="openeducat"
DATE=$(date +%Y-%m-%d_%H-%M)
# Create backup
pg_dump -U odoo -F c $DB_NAME > $BACKUP_DIR/db_$DATE.dump
# Copy filestore
tar -czf $BACKUP_DIR/filestore_$DATE.tar.gz /var/lib/odoo/filestore/$DB_NAME
# Remove backups older than 30 days
find $BACKUP_DIR -type f -mtime +30 -delete

Schedule with crontab:

# Daily backup at 2 AM
0 2 * * * /path/to/backup_script.sh

Backup Retention Policy

Backup TypeFrequencyRetention
DailyEvery day7 days
WeeklyEvery Sunday4 weeks
Monthly1st of month12 months
YearlyJanuary 1st5 years

Cloud Backup Options

ProviderIntegration
AWS S3s3cmd, aws-cli
Google Cloudgsutil
Azure Blobazcopy
Dropboxrclone

Restoring from Backup

Method 1: Database Manager (Web Interface)

  1. Navigate to /web/database/manager
  2. Enter the master password
  3. Click Restore Database
  4. Fill in the form:
FieldDescription
Master PasswordDatabase master password
FileUpload backup ZIP file
Database NameName for restored database
NeutralizeCheck to disable external integrations
  1. Click Restore

Method 2: Command Line

For PostgreSQL restore:

Terminal window
# Stop Odoo service first
sudo systemctl stop odoo
# Restore database
pg_restore -U odoo -d dbname -v backup.dump
# Or for SQL backups
psql -U odoo dbname < backup.sql
# Restore filestore
tar -xzf filestore_backup.tar.gz -C /var/lib/odoo/filestore/
# Start Odoo service
sudo systemctl start odoo

Post-Restore Steps

  1. Verify data integrity - Check key records exist
  2. Test login - Ensure user accounts work
  3. Check attachments - Verify uploaded files are accessible
  4. Review scheduled actions - Disable if running in test environment
  5. Update external integrations - If restored to different server

Backup Best Practices

Storage Guidelines

RecommendationDetails
Multiple locationsStore backups on different servers/cloud
EncryptionEncrypt sensitive backup files
Access controlRestrict who can access backups
Regular testingVerify backups can be restored monthly

Pre-Backup Checklist

  • Sufficient disk space available
  • Database not in heavy use (if possible)
  • Previous backup completed successfully
  • Backup location accessible

Security Considerations

PracticeImplementation
Encrypt backupsUse GPG or similar encryption
Secure transferUse SFTP/SCP for remote copies
Access loggingTrack who accesses backup files
Separate credentialsUse different passwords for backups

Disaster Recovery Plan

  1. Document procedures - Written recovery steps
  2. Assign responsibilities - Who handles recovery
  3. Test quarterly - Perform full recovery test
  4. Update contacts - Emergency contact list
  5. Review regularly - Update plan as systems change

Troubleshooting

Backup fails to complete

Possible causes:

  • Insufficient disk space
  • Database connection issues
  • Permission problems

Solutions:

  1. Check available disk space: df -h
  2. Verify database credentials
  3. Check file permissions on backup directory

Restore fails with error

Common errors:

ErrorSolution
”Database exists”Drop existing database or use new name
”Permission denied”Check PostgreSQL user permissions
”Invalid backup format”Verify backup file is not corrupted
”Version mismatch”Ensure PostgreSQL versions match

Filestore not restored

Symptoms: Database works but images/attachments missing

Solution:

  1. Verify filestore was included in backup
  2. Check filestore path configuration
  3. Restore filestore separately if needed
  4. Verify file permissions (odoo user must own files)

Large backup performance

For large databases:

  1. Use parallel dump: pg_dump -j 4 (4 parallel jobs)
  2. Compress during backup
  3. Schedule during low-usage hours
  4. Consider incremental backups


Last updated: January 2026