#!/bin/bash
# oracle credentials
set oracle env variablbles
# Email details
TO= mail id
subject =" report"
#get tablespace details
sqlplus -S / as sysdba << EOF > /tmp/tablespace_details.html
SET MARKUP HTML ON
SET FEEBACKUP OFF
SET VERIFY OFF
SET UNDERLINE OFF
SET TRIMSPOOL ON
SET LINESIZE 200
SET LONG 50000
----SQL QUERY
EOF
#get email content
body=$(cat /tmp/tablespace_details.html)
#send email
export CONTENT_TYPE=text/html
echo -e "TO:$TO\nSubject: $SUBJECT\nContent-Type:$CONTENT_TYPE\n\n$body" | /usr/sbin/sendmail -t
#clearnup
rm /tmp/tablespace_details.html
No comments:
Post a Comment