Created
October 28, 2013 13:01
-
-
Save mjbommar/7196424 to your computer and use it in GitHub Desktop.
Shell script around run_addm.sql to run an ADDM report and archive it on S3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Settings; ideally, you might be using Wallets | |
# or '/ as sysdba' and not need to drop your password in here. | |
ADDM_PATH=/home/oracle/scripts/addm/ | |
ORACLE_USER=system | |
ORACLE_PASSWORD=tiger | |
ORACLE_TARGET=ORCL | |
S3_URI=s3://data.mycompany.com/oracle/addm/ORCL/ | |
# Source Oracle environment variables, which should be in bash_profile | |
source ~/.bash_profile | |
# Change path and get some runtime vars | |
cd $ADDM_PATH | |
TIMESTAMP="`date +%Y%m%d`" | |
sqlplus $ORACLE_USER/$ORACLE_PASSWORD@$ORACLE_TARGET @run_addm | |
# Move | |
mv addm.txt addm-$TIMESTAMP.txt | |
# Upload to S3 | |
s3cmd put addm-$TIMESTAMP.txt $S3_URI | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment