# Backup and restore

The script creates a new temporary directory containing source, backup and restored SQLite databases. Two synthetic orders are committed before backup. A third is committed afterwards. Restoring the backup produces the original two rows and total300; the third order is absent. The integrity check reports ok. This combination demonstrates why a readable file and a successful integrity check do not establish that every business event was recovered.

The recovery cutoff defines which committed events are available. Discuss what missing the third order means for customer communication, reconciliation and business continuity. Recovery-point and recovery-time objectives are business requirements to be agreed and tested; this fixture supplies no timed recovery guarantee. A daily backup policy may be unsuitable if the organisation cannot tolerate a day of missing work.

Run the fixture and inspect both restored row content and integrity output. The script confines writes to newly created temporary files and removes them afterwards. It does not alter your existing databases. This teaching cleanup is intentional and means the files are not retained as a real backup. It demonstrates SQLite backup and restoration to a separate target, not encryption, off-site copies or enterprise disaster recovery.

IT tests the procedure; business owners verify recovered meaning and acceptable loss; finance reconciles missing commitments. Foundation: explain the cutoff. Undergraduate: reproduce expected rows. Postgraduate: design a recovery validation checklist. Research: propose a study of recovery readiness with defined outcomes. Submit content evidence, missing-event explanation and a recovery decision memo. Never equate the test count or integrity result with production resilience.

## Task evidence

1. Predict which order is absent after restore.

Response:

2. Run the temporary recovery fixture and scenario tests.

Response:

3. Compare row content, total and integrity output.

Response:

4. Specify recovery objectives and business reconciliation evidence.

Response:

## Expected guidance

Restored rows O1=100,O2=200,total300;integrity ok;post-backup O3 absent despite source count3.

https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.backup
