I add 60 seconds wait to be on the safe side.
$ cat ebs_volume_snapshot.sh
#!/bin/bash
SCRIPT_HOME=/u01/app/oracle/scripts
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
sqlplus -S / as sysdba << ABC1
alter database begin backup;
exit;
ABC1
$SCRIPT_HOME/ec2-automate-backup.sh -v "vol-11ba0c5d vol-3cba0c70" -k 3 -c $SCRIPT_HOME/cron-primer.sh
sleep 60
sqlplus -S / as sysdba << ABC2
alter database end backup;
exit;
ABC2
$ cat cron-primer.sh
#!/bin/bash -
# EC2_HOME required for EC2 API Tools
export EC2_HOME=/opt/aws/apitools/ec2
# JAVA_HOME required for EC2 API Tools
export JAVA_HOME=/usr/lib/jvm/jre
export PATH=/bin:/opt/aws/bin/
export AWS_ACCESS_KEY=XXXXXXXXXXXXX
export AWS_SECRET_KEY=YYYYYYYYYYYYYYYYYYYYYY
You can find the ec2-automate-backup script here.
No comments:
Post a Comment