ora_compilation.sh

#!/bin/bash
# --------------------------
# Verification de la syntaxe
# --------------------------
if [ $# -ne 1 ]
then
 echo "=================================================="
 echo "ERREUR : Nombre d'arguments incorrects !"
 syntaxe
 echo "=================================================="
 exit 1
fi
# --------------------------
# Verification des arguments
# --------------------------
w_instance=$1
v_res=`grep "${w_instance}" /etc/oratab | wc -l`
v_res=`expr ${v_res}`
if [ ${v_res} -eq 0 ]
then
 echo "=================================================="
 echo "ERREUR : Base de donnees [${w_instance}] inexistante !"
 syntaxe
 echo "=================================================="
 exit 1
fi
echo "SID=${w_instance}"
export ORACLE_SID=${w_instance}
ls /soft/oracle/db102/rdbms/admin/utlrp.sql
err_fic=$?
if [ "${err_fic}" != "0" ]
then
 echo Fichier absent.
 exit ${err_fic}
fi
export ORACLE_SID=$1
echo "recompile tous les objets invalides" ${ORACLE_SID}
sqlplus /nolog <<EOF
 connect / as sysdba
 WHENEVER SQLERROR EXIT SQL.SQLCODE
 SELECT owner#,name,status,ctime,mtime,stime FROM obj$ WHERE status IN (4, 5, 6);
start /soft/oracle/db102/rdbms/admin/utlrp.sql
SELECT job_name FROM dba_scheduler_running_jobs WHERE job_name like 'UTL_RECOMP_SLAVE_%';
exit
 EOF
exit ${err_sql}

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *