Database Backup Restore

by aj-geddes3f5182cfd739No license355 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 7 months ago

Implement backup and restore strategies for disaster recovery. Use when creating backup plans, testing restore procedures, or setting up automated backups.

Includes scriptsDevOps & Cloud
AI-generated overview

Guides database backup and restore strategies, including full, incremental, and binary log backups for PostgreSQL and MySQL.

What it does
This skill provides reference guidance for implementing database backup and disaster recovery strategies. It covers full, incremental, differential, and binary log backups, retention policies, restore testing, and recovery objectives (RTO/RPO), with dedicated restore guides for PostgreSQL and MySQL. It also ships a schema validation script and a migration SQL template.
When to use it
Use it when setting up backup automation, planning disaster recovery, testing restore procedures, defining retention policies, or preparing for point-in-time recovery and compliance requirements.
Requirements
Requires database tooling such as pg_dump and MySQL utilities, plus access credentials to the target database servers. It ships an executable shell script (scripts/validate-schema.sh) and a SQL migration template.

Database Backup & Restore

Table of Contents

Overview

Implement comprehensive backup and disaster recovery strategies. Covers backup types, retention policies, restore testing, and recovery time objectives (RTO/RPO).

When to Use

  • Backup automation setup
  • Disaster recovery planning
  • Recovery testing procedures
  • Backup retention policies
  • Point-in-time recovery (PITR)
  • Cross-region backup replication
  • Compliance and audit requirements

Quick Start

pg_dump - Text Format:

bash
# Simple full backuppg_dump -h localhost -U postgres -F p database_name > backup.sql
# With compressionpg_dump -h localhost -U postgres -F p database_name | gzip > backup.sql.gz
# Backup with verbose outputpg_dump -h localhost -U postgres -F p -v database_name > backup.sql 2>&1
# Exclude specific tablespg_dump -h localhost -U postgres database_name \  --exclude-table=temp_* --exclude-table=logs > backup.sql

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Full Database Backup [blocked]Full Database Backup
Incremental & Differential Backups [blocked]Incremental & Differential Backups
Full Database Backup [blocked]Full Database Backup
Binary Log Backups [blocked]Binary Log Backups
PostgreSQL Restore [blocked]PostgreSQL Restore
MySQL Restore [blocked]MySQL Restore

Best Practices

✅ DO

  • Follow established patterns and conventions
  • Write clean, maintainable code
  • Add appropriate documentation
  • Test thoroughly before deploying

❌ DON'T

  • Skip testing or validation
  • Ignore error handling
  • Hard-code configuration values

Source and attribution

Source:aj-geddes/useful-ai-promptsinskills/database-backup-restoreat commit3f5182c

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal