DATETIME=`date +%Y%m%d%H%M`
HNAME=$(hostname)
for r in $(ps -eaf | grep pmon | egrep -v 'grep|ASM1|APX1' | cut -d '_' -f3)
do
export ORAENV_ASK=NO
export ORACLE_SID=$r
export HTML_FILE=Rapport_$HNAME_${ORACLE_SID}_${DATETIME}.html
. oraenv -s > /dev/null
echo "
Rapport
" > ${HTML_FILE}
# sqlplus -s "/ as sysdba" @rapport_html.sql >> ${HTML_FILE}
for f in sql/*.sql
do
# sqlplus -s "/ as sysdba" @$f >> ${HTML_FILE}
sed '1 s/^/SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP OFF\n/' $f | sqlplus / as sysdba
done
sed -i 's/$/
/g' ${HTML_FILE}
echo Rapport dans le fichier html : ${HTML_FILE}
done