1
Configuration :
Ce qu il faut c’est faire un script indépendant du nœud
ou on part le script, donc aller
chercher les ressources Golden Gate et le nœud dans le
cluster.
Après on peut exécuter des commandes de vérifications Golden Gate.
Au minimum le trail
file du radlkdmp sur
la source doit être identique
au trail file du
replicat.
Autre point on doit
verifier le lag, l avancement
des archivelog sur la source.
2
Cote extract
2.1
Les variables :
En rouges les variables
a adapter selon
si on est sur la source
ou la target.
#!/usr/bin/ksh
#set -x
DBID=RAPR
export type=extract –- extract ou
replicat
export repname=RADLK –- extract a monitorer
export GGS_HOME=/appl/oracle/ggates/12
export ORACLE_HOME=/appl/oracle/11204
export ORACLE_BASE=/appl/oracle
export
LD_LIBRARY_PATH=/appl/oracle/ggates/12:/appl/oracle/11204/lib
export DIRLOG=$ORACLE_BASE/LOG
export
LOG=$DIRLOG/${DBID}GG.`date \+%Y-%m-%d_%H:%M:%S`.log
export DIRBIN=/appl/oracle/BIN
export GRID_HOME=/appl/grid/11204
gguser=ggs --user
ggpass=xxxxxxx --password
2.2
Le cluster :
Ici on vérifie ou est
la ressource cluster si elle
local on execute la partie golden gate, sinon on se connecte au nœud qui a la ressource et on poursuit.
Ca donne donc
pgrep mgr --ici on cherche si le process mgr
est local ou pas retourne le PID
if [ $? -eq 1 ] -- en jouant sur le
code retour on déduit si local ou pas
then -- pas local on va chercher le nœud qui possède la ressource cluster
echo "----------------------------------------------"
export IP=`$GRID_HOME/bin/crsctl
status res ggateapp | grep STATE |
awk '{print $3}'`
export STATUS=`$GRID_HOME/bin/crsctl status res ggateapp | grep
TARGET | awk -F'=' '{print
$2}'`
echo $IP
echo $STATUS
ssh $IP $DIRBIN/gginfoall.ksh -- on exécute le script sur le nœud qui possède la
ressoure
echo "----------------------------------------------"
else
echo "roule" --on continue en mode
local
echo
"-------------------------------------------------">$LOG
echo info resource
cluster >>$LOG
echo
"-------------------------------------------------">>$LOG
$GRID_HOME/bin/crsctl status res ggateapp >>$LOG
$GRID_HOME/bin/crsctl status res pprgg-vip >>$LOG
$GRID_HOME/bin/crsctl status res
ora.radppr.radggatesvc.svc >>$LOG
echo
"-------------------------------------------------">>$LOG
echo "who am
i">>$LOG --extra ou sommes nous ? Résultat
: la ou il y a le service.
echo
"-------------------------------------------------">>$LOG
$ORACLE_HOME/bin/sqlplus `/usr/bin/cat ${DIRBIN}/RADPPR_login` as sysdba
<<EOF
spool $LOG append
@$DIRBIN/who.sql
EOF
2.3
Golden gate :
Ici la variable repname = RADLK
echo "-------------------------------------------------">>$LOG
echo info golden gate
>>$LOG
echo
"-------------------------------------------------">>$LOG
PROCESSES="mgr extract"
--change selon si on est en mode
extract ou replicat
cd $GGS_HOME
$GGS_HOME/ggsci <<EOF
>>$LOG
dblogin userid ${gguser}@GGATE
,password ${ggpass}
info all -- info checkpoint, lag synthetique
info ${repname} ,detail –
info sur les trail file, archivelog séquence
-- le path des fichiers
de config
info ${repname} ,showch –
plus de detail sur les trails, et
archivelog
lag ${type} ${repname}
stats ${type} ${repname}
reportrate hr -- les modification
par heure
info rmttrail *
-- info trail de la target
exit
EOF
En info rmttrail :
Use
INFO RMTTRAIL
to retrieve
configuration information for a remote trail. It shows the name of the trail,
the Extract that writes to it, the position of the last data processed, and the
assigned maximum file size.
Extract Trail: /appl/oracle/ggates/12/trail/radlk/lk
Extract: RADLK
Seqno:
56 à
la source le numéro ne suis pas forcement le pump process
RBA:
5458935
File Size:
200M
Extract Trail:
/appl/oracle/ggates/12/trail/radlk/lk
Extract: RADLKDMP
Seqno:
45 àle
numéro doit etre egal a
info radlk sur la target
RBA: 6802968
File Size: 200M
Ci-dessous on
retrouve les mêmes informations :
GGSCI (ppr-mtlunt116) 3> info radlkdmp
showch
EXTRACT
RADLKDMP Last Started 2015-10-28
15:39 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 17299
Log Read Checkpoint File /appl/oracle/ggates/12/trail/radlk/lk000056
2015-10-29
17:21:58.000000 RBA 10707865
Current Checkpoint Detail:
Read Checkpoint #1
GGS Log
Trail
Startup
Checkpoint (starting position in the data source):
Sequence #: 54
RBA:
875347
Timestamp: 2015-10-28 14:58:40.000000
Extract Trail: /appl/oracle/ggates/12/trail/radlk/lk
Current Checkpoint (position of last record
read in the data source):
Sequence #: 56
RBA:
10707865
Timestamp: 2015-10-29 17:21:58.000000
Extract Trail: /appl/oracle/ggates/12/trail/radlk/lk
Write Checkpoint #1
GGS Log
Trail
Current Checkpoint (current write
position):
Sequence #: 45
RBA:
12051898
Timestamp: 2015-10-29 17:23:46.419482
Extract Trail: /appl/oracle/ggates/12/trail/radlk/lk
Trail Type: RMTTRAIL
Header:
Version
= 2
Record
Source = A
Type =
1
# Input
Checkpoints = 1
#
Output Checkpoints = 1
File Information:
Block
Size = 2048
Max
Blocks = 100
Record
Length = 2048
Current
Offset = 0
Configuration:
Data
Source = 0
Transaction Integrity = 1
Task
Type = 0
Status:
Start
Time = 2015-10-28 15:39:20
Last
Update Time = 2015-10-29 17:23:46
Stop
Status = A
Last
Result = 400
2.4
Les process
echo info process et FS>>$LOG
echo
"-------------------------------------------------">>$LOG
df -h |
grep gg -- FS ou sont les
trails
for GGPROC in
$PROCESSES -- process mgr, extract ou replicat
do
FLAG=`ps -ef | grep ${GGPROC} | grep -v
grep | awk '{print $2}' ` --#process
if [ `ps -ef | grep ${GGPROC} |grep -v grep | wc -l` -gt 3 ]
– nombre de process
then
echo "no golden gate" >>$LOG
else
echo "---------------------
$GGPROC ---------------" >>$LOG
#ps -ef | grep $FLAG >>$LOG
/usr/bin/pargs $FLAG
>>$LOG --
argument des process id
echo "---------------------------------------------"
>>$LOG
fi
done
2.5
Dba_tab_modifications
Les tables qui ont
subi des modifications depuis les derniers
statistiques oracle.
3
Cote replicat :
3.1
Golden gate :
LA
difference pas d extract
Pas de
rmttrail
Sinon c est
identiques :
PROCESSES="mgr replicat"
$GGS_HOME/ggsci <<EOF
>>$LOG
dblogin userid
ggate@GG ,password xxxxxxx – pas de variable a ameliorer
info all
info ${repname} ,detail
info ${repname} ,showch
lag ${type} ${repname}
stats ${type} ${repname} reportrate
hr
exit
EOF
4
Logs :
Comme la
resource est dans le cluster on peut
se referer a
/var/log/messages
en cas d’erreur exemple :
Oct 28 15:05:16
ppr-unt116 Oracle GoldenGate Capture for Oracle[12144]: [ID 702911 user.error]
2015-10-28 15:05:16 ERROR OGG-01454
Oracle GoldenGate Capture for Oracle, radlk.prm: Unable to lock file
"/appl/oracle/ggates/12/trail/radlk/lk000054" (error 11, Resource
temporarily unavailable). Lock currently
held by process id (PID) 23281.
Oct 28 15:05:49
ppr-unt116 Oracle GoldenGate Capture for Oracle[13797]: [ID 702911
user.error] 2015-10-28 15:05:49
ERROR OGG-01031 Oracle GoldenGate Capture for Oracle,
radlkdmp.prm: There is a problem in
network communication, a remote file problem, encryption keys for target and
source do not match (if using ENCRYPT) or an unknown error. (Reply received is
Unable to open file "/appl/oracle/ggates/12/trail/radlk/lk000043"
(error 11, Resource temporarily unavailable)).
Oct 28 15:06:03
ppr-unt116 Oracle GoldenGate Capture for Oracle[16349]: [ID 702911
user.error] 2015-10-28 15:06:03
ERROR OGG-01454 Oracle GoldenGate Capture for Oracle,
radlk.prm: Unable to lock file
"/appl/oracle/ggates/12/trail/radlk/lk000054" (error 11, Resource
temporarily unavailable). Lock currently held by process id (PID)
23281.
Oct 28 15:07:58
ppr-unt116 Oracle GoldenGate Capture for Oracle[29686]: [ID 702911
user.error] 2015-10-28 15:07:58
ERROR OGG-01031 Oracle GoldenGate Capture for Oracle,
radlkdmp.prm: There is a problem in
network communication, a remote file problem, encryption keys for target and
source do not match (if using ENCRYPT) or an unknown error. (Reply received is
Unable to open file "/appl/oracle/ggates/12/trail/radlk/lk000043"
(error 11, Resource temporarily unavailable)).
Autre sources:
Pour le volet
cluster
/appl/grid/11204/log/`uname -n`/agent/crsd/scriptagent_oracle/scriptagent_oracle.log
Pour le
volet golden gate:
$GGS_HOME/gserr.log
5
Annexe
5.1
Script de monitoring coté extract :
#!/usr/bin/ksh
#set -x
DBID=RAPR
export type=extract
export repname=RADLK
export
GGS_HOME=/appl/oracle/ggates/12
export
ORACLE_HOME=/appl/oracle/11204
export ORACLE_BASE=/appl/oracle
export
LD_LIBRARY_PATH=/appl/oracle/ggates/12:/appl/oracle/11204/lib
export DIRLOG=$ORACLE_BASE/LOG
export
LOG=$DIRLOG/${DBID}GG.`date \+%Y-%m-%d_%H:%M:%S`.log
export DIRBIN=/appl/oracle/BIN
export GRID_HOME=/appl/grid/11204
gguser=XXXXX
ggpass=xxxxx
pgrep mgr
if [ $? -eq 1 ]
then
echo "----------------------------------------------"
export IP=`$GRID_HOME/bin/crsctl
status res ggateapp | grep STATE |
awk '{print $3}'`
export STATUS=`$GRID_HOME/bin/crsctl status res ggateapp | grep
TARGET | awk -F'=' '{print
$2}'`
echo $IP
echo $STATUS
ssh $IP $DIRBIN/gginfoall.ksh
echo "----------------------------------------------"
else
echo "roule"
echo
"-------------------------------------------------">$LOG
echo info resource
cluster >>$LOG
echo
"-------------------------------------------------">>$LOG
$GRID_HOME/bin/crsctl status res ggateapp >>$LOG
$GRID_HOME/bin/crsctl status res pprgg-vip >>$LOG
$GRID_HOME/bin/crsctl status res
ora.radppr.radggatesvc.svc >>$LOG
echo
"-------------------------------------------------">>$LOG
echo "who am
i">>$LOG
echo
"-------------------------------------------------">>$LOG
$ORACLE_HOME/bin/sqlplus `/usr/bin/cat ${DIRBIN}/RADPPR_login` as sysdba
<<EOF
spool $LOG append
@$DIRBIN/who.sql
EOF
echo
"-------------------------------------------------">>$LOG
echo info golden gate
>>$LOG
echo
"-------------------------------------------------">>$LOG
PROCESSES="mgr extract"
cd $GGS_HOME
$GGS_HOME/ggsci <<EOF
>>$LOG
dblogin userid ${gguser}@GGATE
,password ${ggpass}
info all
info ${repname} ,detail
info ${repname} ,showch
lag ${type} ${repname}
stats ${type} ${repname} reportrate
hr
info rmttrail *
exit
EOF
echo
"-------------------------------------------------">>$LOG
echo
"-------------------------------------------------">>$LOG
echo info process et FS>>$LOG
echo
"-------------------------------------------------">>$LOG
df -h | grep
gg
for GGPROC in
$PROCESSES
do
FLAG=`ps -ef | grep ${GGPROC} | grep -v
grep | awk '{print $2}' `
if [ `ps -ef | grep ${GGPROC} |grep -v grep | wc -l` -gt 3 ]
then
echo "no golden gate" >>$LOG
else
echo "---------------------
$GGPROC ---------------" >>$LOG
#ps -ef | grep $FLAG >>$LOG
/usr/bin/pargs $FLAG
>>$LOG
echo
"---------------------------------------------" >>$LOG
fi
done
echo
"-------------------------------------------------">>$LOG
echo info table :
les modifications, stats
>>$LOG
echo
"-------------------------------------------------">>$LOG
$ORACLE_HOME/bin/sqlplus `/usr/bin/cat ${DIRBIN}/RAPR_login` as sysdba
<<EOF
spool $LOG append
@$DIRBIN/dba_tab_modification.sql
EOF
mailx -s "GGATE PPR
" xxxxxxxx@tra.com <$LOG
find $DIRLOG -name ''${DBID}'GG*' -mtime +7
-exec rm {} \;
fi
5.2
Script
de monitoring coté replicat :
#!/usr/bin/ksh
#set -x
DBID=RAPRLK
export type=replicat
export repname=RADLK
export
GGS_HOME=/appl/oracle/ggates/12
export
ORACLE_HOME=/appl/oracle/12102
export ORACLE_BASE=/appl/oracle
export
LD_LIBRARY_PATH=/appl/oracle/ggates/12:/appl/oracle/12102/lib
export DIRLOG=$ORACLE_BASE/LOG
export
LOG=$DIRLOG/${DBID}GG.`date \+%Y-%m-%d_%H:%M:%S`.log
export DIRBIN=/appl/oracle/BIN
export GRID_HOME=/appl/grid/12102
export IP=`$GRID_HOME/bin/crsctl
status res ggateapp | grep STATE |
awk '{print $3}'`
export STATUS=`$GRID_HOME/bin/crsctl status res ggateapp | grep
TARGET | awk -F'=' '{print
$2}'`
echo $IP
echo $STATUS
pgrep mgr
if [ $? -eq 1 ]
then
echo "----------------------------------------------"
export IP=`$GRID_HOME/bin/crsctl
status res ggateapp | grep STATE |
awk '{print $3}'`
export STATUS=`$GRID_HOME/bin/crsctl status res ggateapp | grep
TARGET | awk -F'=' '{print
$2}'`
echo $IP
echo $STATUS
ssh $IP $DIRBIN/gginfoall.ksh
echo "----------------------------------------------"
else
echo "roule"
echo
"-------------------------------------------------">$LOG
echo info resource
cluster >>$LOG
echo
"-------------------------------------------------">>$LOG
$GRID_HOME/bin/crsctl status res ggateapp >>$LOG
$GRID_HOME/bin/crsctl status res pprgg-vip >>$LOG
$GRID_HOME/bin/crsctl status res
ora.radpprlk.radggatelkpprsvc.svc >>$LOG
echo
"-------------------------------------------------">>$LOG
echo "who am
i">>$LOG
echo
"-------------------------------------------------">>$LOG
$ORACLE_HOME/bin/sqlplus `/usr/bin/cat ${DIRBIN}/RAPRLK_login` as
sysdba <<EOF
spool $LOG append
@$DIRBIN/who.sql
EOF
echo
"-------------------------------------------------">>$LOG
echo info golden gate
>>$LOG
echo
"-------------------------------------------------">>$LOG
PROCESSES="mgr replicat"
$GGS_HOME/ggsci <<EOF
>>$LOG
dblogin userid ggate@xxxx ,password XXXXXXX
info all
info ${repname} ,detail
info ${repname} ,showch
lag ${type} ${repname}
stats ${type} ${repname} reportrate
hr
exit
EOF
echo
"-------------------------------------------------">>$LOG
echo
"-------------------------------------------------">>$LOG
echo
"-------------------------------------------------">>$LOG
echo info process et FS>>$LOG
echo "-------------------------------------------------">>$LOG
for GGPROC in
$PROCESSES
do
FLAG=`ps -ef | grep ${GGPROC} | grep -v
grep | awk '{print $2}' `
if [ `ps -ef | grep ${GGPROC} |grep -v grep | wc -l` -gt 3 ]
then
echo "no golden gate" >>$LOG
else
echo "---------------------
$GGPROC ---------------" >>$LOG
#ps -ef | grep $FLAG >>$LOG
/usr/bin/pargs $FLAG
>>$LOG
df -h | grep gg>>$LOG
echo
"---------------------------------------------" >>$LOG
fi
done
echo "-------------------------------------------------">>$LOG
echo info table :
les modifications, stats
>>$LOG
echo
"-------------------------------------------------">>$LOG
$ORACLE_HOME/bin/sqlplus `/usr/bin/cat ${DIRBIN}/RAPRLK_login` as
sysdba <<EOF
spool $LOG append
@$DIRBIN/dba_tab_modification.sql
EOF
$ORACLE_HOME/bin/sqlplus `/usr/bin/cat ${DIRBIN}/RAPRLK_login` as sysdba
<<EOF
spool $LOG append
@$DIRBIN/infosynchro.sql
EOF
mailx -s "GGATE PPR
" xxxxxx@tra.com <$LOG
find $DIRLOG -name ''${DBID}'GG*' -mtime +7
-exec rm {} \;
fi
Aucun commentaire:
Enregistrer un commentaire