#!/bin/bash
#
# hourly - execute scripts each hour
#

# Go to directory where this script is placed
cd `dirname $0`


# -----
# Set environment
. ./oracle_env
if [ $? -ne 0 ] ; then
  echo
  echo "Error: Cannot source Oracle's environment script './oracle_env'"
  echo
  exit 1
fi

# -----
# Take a database performance snapshot

./ora_statspack SNAPSHOT


# -----
# Backup the redo log and archived redo logs
# (The parameter must match a parameter in the ORARMAN section in the configuration file!)

# Wait for up to 10 minutes (600 seconds) before starting the rman backup
WAITFOR=$(( $RANDOM % 600 ))
sleep $WAITFOR

./orarman REDOLOGS


# -----
# Custom Section
#
# Create an executable script 'hourly_custom' for your special purposes.

[ -x ./hourly_custom ] && ./hourly_custom


