Database Backup Restore

aj-geddes/useful-ai-prompts/skills/database-backup-restore

作者 aj-geddes3f5182cfd739无许可证355 个星标收录于 2026年10月8日更新于 2026年10月8日仓库7个月前更新

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

包含脚本DevOps & Cloud
AI 生成的概览

指导数据库备份与恢复策略,涵盖 PostgreSQL 和 MySQL 的全量、增量及二进制日志备份。

功能
该技能提供实施数据库备份与灾难恢复策略的参考指南,涵盖全量、增量、差异及二进制日志备份、保留策略、恢复测试和恢复目标(RTO/RPO),并包含 PostgreSQL 和 MySQL 的专用恢复指南。它还附带一个架构校验脚本和一个迁移 SQL 模板。
适用场景
适用于设置备份自动化、规划灾难恢复、测试恢复流程、制定保留策略,或准备时间点恢复与合规审计要求的场景。
运行要求
需要数据库工具(如 pg_dump 和 MySQL 工具)以及对目标数据库服务器的访问凭据。附带可执行 shell 脚本(scripts/validate-schema.sh)和一个 SQL 迁移模板。

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

来源与署名

来源:aj-geddes/useful-ai-prompts位于skills/database-backup-restore提交3f5182c

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架