Update backup_archive_fnct_FRA.sh
This commit is contained in:
@@ -1,30 +1,30 @@
|
|||||||
#
|
#
|
||||||
# retourne le porucentage d'occupation de la FRA
|
# retourne le porucentage d'occupation de la FRA
|
||||||
|
# Si il est supérieur à un poucentage limit, il lance un script
|
||||||
|
# pour sauvegarder les archivelog et purger la FRA
|
||||||
#
|
#
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#
|
||||||
# fonction d'aide
|
# Vérification du paramètre d'entrée
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
f_help() {
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo syntax : $0 ORACLE_SID
|
|
||||||
echo
|
|
||||||
exit $1
|
|
||||||
|
|
||||||
} #f_help
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
ORACLE_SID=$1
|
ORACLE_SID=$1
|
||||||
|
[ "${ORACLE_SID}" ] || echo syntax : $0 ORACLE_SID && exit 2;
|
||||||
|
|
||||||
[ "${ORACLE_SID}" ] || f_help 2;
|
# Variables d'initialisation
|
||||||
|
script_dir=/home/oracle/scripts
|
||||||
|
pct_limit=85
|
||||||
|
action_script=${script_dir}/backup_rman.sh -t AL ${ORACLE_SID}
|
||||||
|
|
||||||
|
#
|
||||||
# positionner les variables d'environnement ORACLE
|
# positionner les variables d'environnement ORACLE
|
||||||
|
#
|
||||||
export ORACLE_SID
|
export ORACLE_SID
|
||||||
ORAENV_ASK=NO
|
ORAENV_ASK=NO
|
||||||
PATH=/usr/local/bin:$PATH
|
PATH=/usr/local/bin:$PATH
|
||||||
. oraenv -s >/dev/null
|
. oraenv -s >/dev/null
|
||||||
|
|
||||||
|
#
|
||||||
|
# calcul de la taille FRA
|
||||||
|
#
|
||||||
fra_usage=$(sqlplus -s '/ as sysdba' << EOF
|
fra_usage=$(sqlplus -s '/ as sysdba' << EOF
|
||||||
set pages 0 feedback off;
|
set pages 0 feedback off;
|
||||||
select round(sum(percent_space_used),0) from v\$flash_recovery_area_usage;
|
select round(sum(percent_space_used),0) from v\$flash_recovery_area_usage;
|
||||||
@@ -33,11 +33,12 @@ EOF
|
|||||||
|
|
||||||
pct_fra_used=$(echo ${fra_usage} | egrep -o "[0-9]*")
|
pct_fra_used=$(echo ${fra_usage} | egrep -o "[0-9]*")
|
||||||
|
|
||||||
if [ "${pct_fra_used}" -gt 65 ]
|
#
|
||||||
|
# Si la FRA dépasse la limite on lance le script
|
||||||
|
#
|
||||||
|
if [ "${pct_fra_used}" -gt ${pct_limit} ]
|
||||||
then
|
then
|
||||||
echo ${pct_fra_used} : backup des archivelog necessaire
|
echo ${pct_fra_used} : backup des archivelog necessaire : ${action_script}
|
||||||
else
|
else
|
||||||
echo ${pct_fra_used} : backup des archivelog NON necessaire
|
echo ${pct_fra_used} : backup des archivelog NON necessaire
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user