Skip to content

chrisfrommann/db-cloud-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Database cloud backups

This script creates a backup of a local database to a cloud backend. It assumes:

  1. Your DB is not in the cloud (otherwise just use e.g. RDS with automatic backups)
  2. Your destination bucket already exists and you have permissions to write to it
  3. You are either running this script on the DB server or can SSH to that machine

Dependencies

Ensure you have the following installed

  1. GNU parallel
  2. AWS command line tools and/or (to install on macOS brew install awscli)
  3. Azure command line tools (to install on macOS: brew install azure-cli)

For Oracle:

Grab the Instant Client Tools & SQLPlus packages from Oracle, which includes expdp and sqlplus

On macOS:

brew tap InstantClientTap/instantclient
brew install instantclient-tools
brew install instantclient-sqlplus

And update your path to include the expdp and sqlplus binaries (run brew info instantclient-tools and brew install instantclient-sqlplus to see where they lives)

For PostgreSQL:

Install PostgreSQL client libraries

On macOS:

brew install libpq

See here for updating your path.

Setup & running

  1. Copy backup.conf.sample to backup.conf and modify settings as appropriate
  2. Then run
    ./backup.sh -c backup.conf
    

Linting

Run make lint

To automatically patch, run e.g. shellcheck -f diff backup.sh | patch

About

Backup a local database to cloud storage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published