Tablespace Usage

# That script will check free space on all Oracle databases and send email
# Click on tbsp_size to see tbsp_size.sql script
#
. /home/oracle/ora.env
cd /app/scripts

check_local()
{
export ORACLE_SID=$1
sqlplus /nolog <<EOF
connect / as sysdba
@tbsp_size
exit
EOF
}
check_remote()
{
export ORACLE_SID=$1
sqlplus /nolog <<EOF
connect $2/$3@$1
@tbsp_size
exit
EOF
}

# Examples of usage
check_local your_oracle_sid   # put here your SID
check_local one_more_local_sid  # and may be an other one
check_remote remote_sid remote_login remote_password  # and here sid login password for a remote database

for i in `ls tbsp_size_*txt`
do
  cat $i >> tbsp_size.txt
done
rm -f tbsp_size_*txt

MAIL_SUBJECT="Oracle database status report"
EMAIL_LIST="address@domain.com"
cat tbsp_size.txt | mail -s "$MAIL_SUBJECT" -e "$EMAIL_LIST"