mise à jour v2

Grosse mise à jour :
- style moderne des tableaux et code
- code structuré et factorisé
- sql et sh affinés
This commit is contained in:
Yacine31
2025-11-19 15:55:11 +01:00
parent 2832bd82e8
commit 4e7683aee2
66 changed files with 586 additions and 577 deletions

View File

@@ -1,18 +1,22 @@
#!/bin/bash
# Importe les fonctions utilitaires
source "$(dirname "$0")/utils.sh"
# --- Script principal ---
# script à exécuter si seulement dbvctl existe et une instance avec le nom de service dbv existe aussi
count=$(ps -ef | grep dbvctl | grep -v grep | grep ${ORACLE_SID} | wc -l)
count=$(ps -ef | grep dbvctl | grep -v grep | grep "${ORACLE_SID}" | wc -l)
if [ $count -gt 0 ]; then
if [ "$count" -gt 0 ]; then
echo "<h1>Configuration DBVisit</h1>"
# les process dbvisit en cours
echo "<h2>Process DBVisit en cours d'exécution</h2>"
echo "<pre>"
ps -ef | grep dbvctl | grep -v grep
echo "</pre>"
print_h2 "Process DBVisit en cours d'exécution"
run_and_print "ps -ef | grep dbvctl | grep -v grep"
# on récupère le chemin de l'executable dbvctl
export DBV_HOME=$(dirname $(ps -ef | grep dbvctl | grep -v grep | awk '{print $8}' | sort -u))
export DBV_HOME=$(dirname "$(ps -ef | grep dbvctl | grep -v grep | awk '{print $8}' | sort -u)")
# si les exacutables sont lancé avec ./dbvctl, le résultat retourné est .
# dans ce cas on remplace par la valeur par défaut : /usr/dbvisit/standby
if [ "$DBV_HOME" = "." ]; then
@@ -20,18 +24,13 @@ if [ $count -gt 0 ]; then
export DBV_HOME="/usr/dbvisit/standby"
fi
# statut de la base de données
echo "<h2>Statut de la base : ${ORACLE_SID} sur le serveur $(hostname)</h2>"
echo "<pre>"
${DBV_HOME}/dbvctl -d ${ORACLE_SID} -o status
echo "</pre>"
print_h2 "Statut de la base : ${ORACLE_SID} sur le serveur $(hostname)"
run_and_print "${DBV_HOME}/dbvctl -d ${ORACLE_SID} -o status"
# on récupère le statut de la base pour exécuter la commande sur la base primaire
db_prim=$(${DBV_HOME}/dbvctl -d ${ORACLE_SID} -o status | grep -i "read write" | wc -l)
if [ ${db_prim} -gt 0 ]; then
echo "<h2>Rapport de GAP DBVisit pour la base ${ORACLE_SID}</h2>"
echo "<pre>"
${DBV_HOME}/dbvctl -d ${ORACLE_SID} -i
echo "</pre>"
db_prim=$("${DBV_HOME}/dbvctl" -d "${ORACLE_SID}" -o status | grep -i "read write" | wc -l)
if [ "${db_prim}" -gt 0 ]; then
print_h2 "Rapport de GAP DBVisit pour la base ${ORACLE_SID}"
run_and_print "${DBV_HOME}/dbvctl -d ${ORACLE_SID} -i"
fi
fi