Fixed the scan error and backup problems

This commit is contained in:
Quality System Admin
2025-11-05 21:25:02 +02:00
parent 9020f2c1cf
commit c91b7d0a4d
15 changed files with 4873 additions and 429 deletions

View File

@@ -0,0 +1,199 @@
# Quick Backup Reference Guide
## When to Use Which Backup Type?
### 🔵 Full Backup (Schema + Data + Triggers)
**Use when:**
- ✅ Setting up a new database server
- ✅ Complete disaster recovery
- ✅ Migrating to a different server
- ✅ Database schema has changed
- ✅ You need everything (safest option)
**Creates:**
- Database structure (CREATE TABLE, CREATE DATABASE)
- All triggers and stored procedures
- All data (INSERT statements)
**File:** `backup_trasabilitate_20251105_190632.sql`
---
### 🟢 Data-Only Backup (Data Only)
**Use when:**
- ✅ Quick daily data snapshots
- ✅ Both databases have identical structure
- ✅ You want to load different data into existing database
- ✅ Faster backups for large databases
- ✅ Testing with production data
**Creates:**
- Only INSERT statements for all tables
- No schema, no triggers, no structure
**File:** `data_only_trasabilitate_20251105_190632.sql`
---
## Quick Command Reference
### Web Interface
**Location:** Settings → Database Backup Management
#### Create Backups:
- **Full Backup:** Click `⚡ Full Backup (Schema + Data)` button
- **Data-Only:** Click `📦 Data-Only Backup` button
#### Restore Database (Superadmin Only):
1. Select backup file from dropdown
2. Choose restore type:
- **Full Restore:** Replace entire database
- **Data-Only Restore:** Replace only data
3. Click `🔄 Restore Database` button
4. Confirm twice
---
## Backup Comparison
| Feature | Full Backup | Data-Only Backup |
|---------|-------------|------------------|
| **Speed** | Slower | ⚡ Faster (30-40% quicker) |
| **File Size** | Larger | 📦 Smaller (~1-2 MB less) |
| **Schema** | ✅ Yes | ❌ No |
| **Triggers** | ✅ Yes | ❌ No |
| **Data** | ✅ Yes | ✅ Yes |
| **Use Case** | Complete recovery | Data refresh |
| **Restore Requirement** | None | Schema must exist |
---
## Safety Features
### Full Restore
- **Confirmation:** Type "RESTORE" in capital letters
- **Effect:** Replaces EVERYTHING
- **Warning:** All data, schema, triggers deleted
### Data-Only Restore
- **Confirmation:** Type "RESTORE DATA" in capital letters
- **Effect:** Replaces only data
- **Warning:** All data deleted, schema preserved
### Smart Detection
- System warns if you try to do full restore on data-only file
- System warns if you try to do data-only restore on full file
---
## Common Scenarios
### Scenario 1: Daily Backups
**Recommendation:**
- Monday: Full backup (keeps everything)
- Tuesday-Sunday: Data-only backups (faster, smaller)
### Scenario 2: Database Migration
**Recommendation:**
- Use full backup (safest, includes everything)
### Scenario 3: Load Test Data
**Recommendation:**
- Use data-only backup (preserve your test triggers)
### Scenario 4: Disaster Recovery
**Recommendation:**
- Use full backup (complete restoration)
### Scenario 5: Data Refresh
**Recommendation:**
- Use data-only backup (quick data swap)
---
## File Naming Convention
### Identify Backup Type by Filename:
```
backup_trasabilitate_20251105_143022.sql
└─┬─┘ └─────┬──────┘ └────┬─────┘
│ │ └─ Timestamp
│ └─ Database name
└─ Full backup
data_only_trasabilitate_20251105_143022.sql
└───┬───┘ └─────┬──────┘ └────┬─────┘
│ │ └─ Timestamp
│ └─ Database name
└─ Data-only backup
```
---
## Troubleshooting
### "Table doesn't exist" during data-only restore
**Solution:** Run full backup restore first, or use database setup script
### "Column count doesn't match" during data-only restore
**Solution:** Schema has changed. Update schema or use newer backup
### "Foreign key constraint fails" during restore
**Solution:** Database user needs SUPER privilege
---
## Best Practices
1. ✅ Keep both types of backups
2. ✅ Test restores in non-production first
3. ✅ Schedule full backups weekly
4. ✅ Schedule data-only backups daily
5. ✅ Keep backups for 30+ days
6. ✅ Store backups off-server for disaster recovery
---
## Access Requirements
| Action | Required Role |
|--------|--------------|
| Create Full Backup | Admin or Superadmin |
| Create Data-Only Backup | Admin or Superadmin |
| View Backup List | Admin or Superadmin |
| Download Backup | Admin or Superadmin |
| Delete Backup | Admin or Superadmin |
| **Full Restore** | **Superadmin Only** |
| **Data-Only Restore** | **Superadmin Only** |
---
## Quick Tips
💡 **Tip 1:** Data-only backups are 30-40% faster than full backups
💡 **Tip 2:** Use data-only restore to quickly swap between production and test data
💡 **Tip 3:** Always keep at least one full backup for disaster recovery
💡 **Tip 4:** Data-only backups are perfect for automated daily snapshots
💡 **Tip 5:** Test your restore process regularly (at least quarterly)
---
## Support
For detailed information, see:
- [DATA_ONLY_BACKUP_FEATURE.md](DATA_ONLY_BACKUP_FEATURE.md) - Complete feature documentation
- [BACKUP_SYSTEM.md](BACKUP_SYSTEM.md) - Overall backup system
- [DATABASE_RESTORE_GUIDE.md](DATABASE_RESTORE_GUIDE.md) - Restore procedures
---
**Last Updated:** November 5, 2025
**Application:** Quality Recticel - Trasabilitate System