13 - Backup & Recovery
Why Backups Matter
Plain text
┌─────────────────────────────────────────────────────────────┐
│ Real-World Data Loss Scenarios │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. Accidental DELETE without WHERE │
│ DELETE FROM users; -- Oops, no WHERE! │
│ 100,000 users gone in 1 second │
│ │
│ 2. DROP TABLE in production │
│ DROP TABLE orders; -- Wrong terminal! │
│ Table structure + all data gone │
│ │
│ 3. Ransomware/Malware │
│ Database encrypted by attacker │
│ Must restore from clean backup │
│ │
│ 4. Hardware failure │
│ Disk corruption, RAID failure │
│ Primary and replica affected │
│ │
│ 5. Application bug │
│ Bug updates wrong rows │
│ Data corruption spread over days │
│ │
│ 6. Natural disaster │
│ Data center flood/fire │
│ Need off-site backup │
│ │
│ Recovery Time Objective (RTO): How fast to recover? │
│ Recovery Point Objective (RPO): How much data loss? │
│ │
└─────────────────────────────────────────────────────────────┘