92_syncarch.sh
92_syncarch.sh
adpmobile:madp-db-stb:omscripts oracle$ cat
92_syncarch_.sh
#!/bin/bash
PATH=$PATH:$HOME/bin
TIMESTR=`date +%Y-%m-%dT%H:%M:%S`
if [ -d /rmanbackup/archivelog ]
then
rsync -av /rmanbackup/archivelog/ /oracle/u02/archive_log/
find /oracle/u02/archive_log/ -mtime +1 -exec rm {} \;
. ~/.bash_profile
P=`sqlplus -s nagios/nagios@prod <SET
HEADING OFF FEEDBACK OFF ECHO OFF PAGESIZE
0
@/oracle/u02/omscripts/stb.sql;
exit;
EOF`
PROD=`echo $P | awk '{print $1}'`
$ORACLE_HOME/bin/rman cmdfile='/oracle/u02/omscripts/archivein.rman' log=/tmp/rman_Archivelog.$TIMESTR.log
S=`sqlplus -S / as sysdba <SET HEADING OFF FEEDBACK OFF ECHO OFF PAGESIZE
0
@/oracle/u02/omscripts/stb.sql;
exit;
EOF`
STB=`echo $S | awk '{print $1}'`
echo "PROD=> $PROD"
echo "STB=> $STB"
if [ "$PROD" == "$STB" ]
then
STR="$TIMESTR 201 Archivelog Rmanbackup done SCN $STB"
#/omscripts/sendsms.sh "$STR" "444" "300"
echo $STR
else
STR="$TIMESTR 201 Archivelog Prod SCN ${PROD} , STB SCN $STB"
/omscripts/sendsms.sh "$STR" "444" "400"
fi
else
STR="$TIMESTR 201 Archivelog Rmanbackup not Mount"
echo $STR
#/omscripts/sendsms.sh "$STR" "1776" "400"
fi
#!/bin/bash
PATH=$PATH:$HOME/bin
TIMESTR=`date +%Y-%m-%dT%H:%M:%S`
if [ -d /rmanbackup/archivelog ]
then
rsync -av /rmanbackup/archivelog/ /oracle/u02/archive_log/
find /oracle/u02/archive_log/ -mtime +1 -exec rm {} \;
. ~/.bash_profile
P=`sqlplus -s nagios/nagios@prod <
@/oracle/u02/omscripts/stb.sql;
exit;
EOF`
PROD=`echo $P | awk '{print $1}'`
$ORACLE_HOME/bin/rman cmdfile='/oracle/u02/omscripts/archivein.rman' log=/tmp/rman_Archivelog.$TIMESTR.log
S=`sqlplus -S / as sysdba <
@/oracle/u02/omscripts/stb.sql;
exit;
EOF`
STB=`echo $S | awk '{print $1}'`
echo "PROD=> $PROD"
echo "STB=> $STB"
if [ "$PROD" == "$STB" ]
then
STR="$TIMESTR 201 Archivelog Rmanbackup done SCN $STB"
#/omscripts/sendsms.sh "$STR" "444" "300"
echo $STR
else
STR="$TIMESTR 201 Archivelog Prod SCN ${PROD} , STB SCN $STB"
/omscripts/sendsms.sh "$STR" "444" "400"
fi
else
STR="$TIMESTR 201 Archivelog Rmanbackup not Mount"
echo $STR
#/omscripts/sendsms.sh "$STR" "1776" "400"
fi
/oracle/u02/omscripts/R_92_archivein.rman
adpmobile:madp-db-stb:omscripts oracle$ cat R_92_archivein.rman
connect target /
run {
recover database ;
}
exit
S_92_stb10g.sql
adpmobile:madp-db-stb:omscripts oracle$ cat S_92_stb10g.sql
# 10g 專用
select max(h.recid) from v$log_history h;
exit;
S_92_stb11g.sql
adpmobile:madp-db-stb:omscripts oracle$ cat S_92_stb11g.sql
SELECT SEQUENCE# FROM V$ARCHIVED_LOG WHERE
(THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME)
FROM V$ARCHIVED_LOG GROUP BY THREAD#);
exit;
SELECT SEQUENCE# FROM V$ARCHIVED_LOG WHERE
(THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME)
FROM V$ARCHIVED_LOG GROUP BY THREAD#);
exit;
沒有留言:
張貼留言