From 7e2406b7caf4f36859c37916a7f8b5ade292c882 Mon Sep 17 00:00:00 2001 From: Jim Schaff Date: Wed, 30 Aug 2023 22:59:00 -0400 Subject: [PATCH] updated Oracle backup scripts --- docker/database/backup_scripts/README.md | 9 ++++++++- docker/database/backup_scripts/archivedb.sh | 6 +++++- .../database/backup_scripts/move_files_to_vcellhome.sh | 9 +++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 docker/database/backup_scripts/move_files_to_vcellhome.sh diff --git a/docker/database/backup_scripts/README.md b/docker/database/backup_scripts/README.md index 9110da55e4..7548c08caa 100644 --- a/docker/database/backup_scripts/README.md +++ b/docker/database/backup_scripts/README.md @@ -1 +1,8 @@ -run ./archivedb.sh as root or with sudo to generate a dump in /data/backup \ No newline at end of file +## Nightly Oracle database backups + +### Data Pump dump to /data/backup +cron job runs `archivedb.sh` every 1:00am as `root` + +### Compress and Archive to ~vcell/database_backups +cron job runs `move_files_to_vcellhome.sh` every 9:00pm as `vcell` + diff --git a/docker/database/backup_scripts/archivedb.sh b/docker/database/backup_scripts/archivedb.sh index 4c59f8dd80..25542cba63 100644 --- a/docker/database/backup_scripts/archivedb.sh +++ b/docker/database/backup_scripts/archivedb.sh @@ -3,5 +3,9 @@ # run export of oracle 19c database running in the container named 'oracle-database' using the Data Pump 'expdp' command sudo docker exec -it oracle-database /opt/oracle/backup/scripts/run.sh 2>&1 | tee -a ../archivedb_$(date +%Y_%m_%d_%H_%M_%S).log +# change permission so that vcell can move them +chmod 666 /data/backup/*.log +chmod 666 /data/backup/*.dmp + # copy move dump file to remote storage -echo "move dump files to remote storage - not yet mounted - do this manually" +echo "move dump files to remote storage - not yet mounted - do this manually" \ No newline at end of file diff --git a/docker/database/backup_scripts/move_files_to_vcellhome.sh b/docker/database/backup_scripts/move_files_to_vcellhome.sh new file mode 100644 index 0000000000..6224f5fbd5 --- /dev/null +++ b/docker/database/backup_scripts/move_files_to_vcellhome.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# compress all *.dmp files in /data/backup +cd /data/backup || echo "failed to cd to /data/backup" || exit 1 +gzip *.dmp + +# move +mv /data/backup/*.log ~vcell/database_backups +mv /data/backup/*.dmp.gz ~vcell/database_backups