Neural LogDocumentation
Administration

Neural Log Database Backup and Recovery

How to back up and restore Neural Log databases and managed media with local operator scripts and rehearsal tools.

Neural Log provides local operator scripts for database backup, isolated restore rehearsal, and managed media recovery. These scripts target the local SQL Server Express instance and never modify running application data during recovery.

Before you start#

  • You need a Windows account with SQL Server administrative rights.
  • Run tools from the project root using PowerShell 7.
  • Keep backups accessible only to the intended operators.

Back up a database#

Use tools/Backup-NeuralLogDatabase.ps1 with an explicit NeuralLog_ database name.

./tools/Backup-NeuralLogDatabase.ps1 -Database NeuralLog_Dev

This creates a uniquely named full COPY_ONLY backup that:

  • Uses CHECKSUM and STOP_ON_ERROR.
  • Refuses to overwrite earlier files.
  • Runs RESTORE VERIFYONLY after backup.

The private manifest under .local/backups records the backup identity, version, verification, and complete before/after source SHA-256 fingerprints.

Restore to a rehearsal clone#

Use tools/Restore-NeuralLogRehearsal.ps1 with the backup manifest path.

./tools/Restore-NeuralLogRehearsal.ps1 -ManifestPath <absolute-manifest-path>

Add -Execute to create a new GUID-named NeuralLog_RestoreVerification_... database. The tool:

  • Checks the backup header and identity.
  • Maps data and log files to new local filenames.
  • Restores with checksums and never uses REPLACE.
  • Makes the clone read-only and restricted.
  • Runs DBCC CHECKDB and verifies schema and data fingerprints.

No application connection string is changed. The original database remains untouched.

Back up managed media#

Use tools/Backup-NeuralLogMedia.ps1 to copy registered managed files alongside the database backup.

./tools/Backup-NeuralLogMedia.ps1 -SqlBackupManifest <manifest> -StorageRoot <absolute-managed-root>

The script verifies:

  • The original SQL header/checksum identity through the read-only restore planner.
  • Complete ManagedFile table hash matching the backup snapshot.
  • Each copied file matches its recorded length and SHA-256.

Restore managed media rehearsal#

Use tools/Restore-NeuralLogMediaRehearsal.ps1 with the matching SQL restore receipt.

./tools/Restore-NeuralLogMediaRehearsal.ps1 -ManifestPath <media-manifest> -SqlRestoreReceipt <sql-receipt>

Add -Execute and optionally the plan's GUID -TargetName to restore files into a new .local/media-recovery/<guid>/files directory. The tool verifies:

  • The clone's full fingerprint and read-only state.
  • Every manifest record matches the clone's catalog.

Lost-response recovery for users#

A database or media restore is not a way to recover an uncertain financial posting. If a financial posting appears to hang or the browser disconnects before the result is shown, the posting may already be saved.

  • Preserve the original request context. Do not refresh, re-create or re-enter the payment or invoice as a retry.
  • Use a retained-receipt or retry action only where the guide for that specific workflow documents it. Reopening a screen does not by itself restore the original request identity.
  • If the result cannot be confirmed, work with your administrator to establish whether the original posting was saved before attempting another posting.

For the standard payment workflow, see Payments.

Scope and boundaries#

These scripts are local operator commands, not remote APIs. They do not cover:

  • External legacy files or configuration/secrets.
  • Off-machine retention or production cutover.
  • Automatic cleanup or deletion of orphaned files.

Perform backups during a quiet maintenance window.