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 從公開儲存庫中收錄這些內容。

檢舉或申請下架