Back to Blog
Tutorials
Backups
PostgreSQL
Disaster Recovery

The Ultimate Guide to Odoo Backups

M
Michael Rodriguez
Database Administrator
November 22, 2025
6 min read

# Why Backups Matter

Data loss is not a question of "if" but "when". A comprehensive backup strategy is your insurance policy.

## The Problem with pg_dump

While `pg_dump` is simple, it has limitations:

- **Downtime**: Large databases can take hours to dump
- **No point-in-time recovery**: You can only restore to the exact moment of the dump
- **Storage intensive**: Full dumps consume significant space

## Implementing WAL Archiving

PostgreSQL's Write-Ahead Logging (WAL) enables continuous archiving and point-in-time recovery.

```sql
-- Enable WAL archiving in postgresql.conf
wal_level = replica
archive_mode = on
archive_command = 'cp %p /mnt/backup/wal/%f'
```

## Automated Backup Script

```bash
#!/bin/bash
# backup-odoo.sh

BACKUP_DIR="/mnt/backup/odoo"
DATE=$(date +%Y%m%d_%H%M%S)
DB_NAME="odoo_production"

# Create base backup
pg_basebackup -D "$BACKUP_DIR/base_$DATE" -Ft -z -P

# Upload to S3
aws s3 sync "$BACKUP_DIR" s3://my-odoo-backups/

# Cleanup old backups (keep last 7 days)
find "$BACKUP_DIR" -type d -mtime +7 -exec rm -rf {} +
```

## Testing Your Backups

**Critical**: Untested backups are worthless. Schedule monthly restore tests.

```bash
# Restore test procedure
1. Spin up test server
2. Restore from backup
3. Verify data integrity
4. Document recovery time
```

## Conclusion

A robust backup strategy combines:
- Daily full backups
- Continuous WAL archiving
- Off-site storage (S3, GCS)
- Regular restore testing

Share this article

The Ultimate Guide to Odoo Backups | Sendan Cloud Blog