database-backup-restore
Skill3 starsChanged 11 months agoApache-2.0View on GitHub
Set up database backup and restore procedures. Use when the user needs to implement backup strategies, create restore scripts, or manage database snapshots.
In this repository100 other files it gives its agents.
- accessibility-checkerSkill
- analytics-trackerSkill
- api-contract-testerSkill
- api-documentation-generatorSkill
- api-rate-limiterSkill
- appstore-screenshot-resizerSkill
- architecture-documenterSkill
- authentication-implementerSkill
- aws-resource-provisionerSkill
- browser-extension-builderSkill
- caching-implementerSkill
- changelog-generatorSkill
- chart-generatorSkill
- ci-pipeline-debuggerSkill
- cli-tool-builderSkill
- code-documenterSkill
- code-explainerSkill
- code-migration-helperSkill
- code-refactorerSkill
- code-reviewerSkill
- color-palette-generatorSkill
- comment-generatorSkill
- contributing-guide-writerSkill
- cron-job-schedulerSkill
- css-animatorSkill
- csv-processorSkill
- data-aggregatorSkill
- database-migration-generatorSkill
- database-query-optimizerSkill
- data-transformerSkill
- data-validatorSkill
- date-time-helperSkill
- debug-helperSkill
- dependency-updaterSkill
- dependency-vulnerability-checkerSkill
- discord-bot-builderSkill
- docker-compose-builderSkill
- dockerfile-generatorSkill
- e2e-test-builderSkill
- email-template-builderSkill
- env-setupSkill
- error-handlerSkill
- error-message-writerSkill
- error-response-handlerSkill
- etl-pipeline-builderSkill
- file-organizerSkill
- form-builderSkill
- git-commit-messageSkill
- github-actions-builderSkill
- gitignore-generatorSkill
- graphql-schema-builderSkill
- icon-system-builderSkill
- input-validatorSkill
- integration-test-builderSkill
- jsdoc-generatorSkill
- json-schema-generatorSkill
- kubernetes-manifest-generatorSkill
- license-chooserSkill
- linter-fixerSkill
- load-testerSkill
- The first 60 shown.
The file
Files
Database Backup & Restore
Implement reliable database backup and recovery procedures.
PostgreSQL
Backup
# Full database dump
pg_dump -h localhost -U postgres -d mydb -F c -f backup.dump
# Specific tables
pg_dump -h localhost -U postgres -d mydb -t users -t orders -F c -f partial.dump
# SQL format (plain text)
pg_dump -h localhost -U postgres -d mydb > backup.sql
# All databases
pg_dumpall -h localhost -U postgres > all_databases.sql
# With compression
pg_dump -h localhost -U postgres -d mydb | gzip > backup.sql.gzRestore
# Restore custom format
pg_restore -h localhost -U postgres -d mydb -c backup.dump
# Restore SQL format
psql -h localhost -U postgres -d mydb < backup.sql
# Create new database from backup
createdb -h localhost -U postgres mydb_restored
pg_restore -h localhost -U postgres -d mydb_restored backup.dumpMySQL
Backup
# Single database
mysqldump -u root -p mydb > backup.sql
# All databases
mysqldump -u root -p --all-databases > all_databases.sql
# With compression
mysqldump -u root -p mydb | gzip > backup.sql.gzRestore
mysql -u root -p mydb < backup.sql
gunzip < backup.sql.gz | mysql -u root -p mydbAutomated Backup Script
#!/bin/bash
set -euo pipefail
DB_NAME="mydb"
BACKUP_DIR="/backups"
RETENTION_DAYS=30
DATE=$(date +%Y%m%d_%H%M%S)
# Create backup
pg_dump -h localhost -U postgres -d "$DB_NAME" -F c \
-f "$BACKUP_DIR/${DB_NAME}_${DATE}.dump"
# Upload to S3
aws s3 cp "$BACKUP_DIR/${DB_NAME}_${DATE}.dump" \
"s3://my-backups/${DB_NAME}/${DATE}.dump"
# Clean old backups
find "$BACKUP_DIR" -name "*.dump" -mtime +$RETENTION_DAYS -delete
echo "Backup completed: ${DB_NAME}_${DATE}.dump"Cron Schedule
# Daily at 2 AM
0 2 * * * /scripts/backup.sh >> /var/log/backup.log 2>&1Point-in-Time Recovery (PostgreSQL)
# Enable WAL archiving in postgresql.conf
wal_level = replica
archive_mode = on
archive_command = 'cp %p /archive/%f'
# Restore to specific time
pg_restore --target-time="2024-01-15 10:30:00"Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

