Я хочу проверить через оболочку, совпадают ли два вывода из команды sqlplus. Поэтому я l oop до тех пор, пока переменные, перехватывающие этот вывод, не станут равными, а затем завершим l oop, после чего следует следующий набор инструкций.
Ни один из нижеприведенных циклов не работает должным образом.
Я ожидаю, что данные для testSeq
и expectedSeq
будут выбраны в режиме реального времени, а затем сравнены, чтобы проверить данные, если они равны, выйти и перейти к следующему шагу.
testSeq=`sqlplus -S user/xxxxxxxxx@${primary} << EOF
set heading off feedback off pagesize 0 verify off echo off numwidth 15
select max(ARCHIVED_SEQ#) from v\\$ARCHIVE_DEST_STATUS;
EOF`
expectedSeq=`sqlplus -S user/xxxxxxxxx@${DR}<< EOF
set heading off feedback off pagesize 0 verify off echo off numwidth 15
select max(APPLIED_SEQ#) from V\\$ARCHIVE_DEST_STATUS;
EOF`
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
while (true)
do
while do;
testSeq=`sqlplus -S user/xxxxxxxxx@${primary} << EOF
set heading off feedback off pagesize 0 verify off echo off numwidth 15
select max(ARCHIVED_SEQ#) from v\\$ARCHIVE_DEST_STATUS;
EOF`
expectedSeq=`sqlplus -S user/xxxxxxxxx@${DR}<< EOF
set heading off feedback off pagesize 0 verify off echo off numwidth 15
select max(APPLIED_SEQ#) from V\\$ARCHIVE_DEST_STATUS;
EOF`
if [[ "$testSeq" != "$expectedSeq" ]]
then
echo "$DR sync is in Progress." | mailx -s "$DR Refresh update" xxxxx@mail.com
else
sleep 20
echo "$DR is in sync with ${PRIMARY} and ready to be switched to Snapshot DR" | mailx -s "$DR Refresh update" xxxxx@mail.com
done
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
while [[ "$testSeq" != "$expectedSeq" ]]; do
echo "$DR sync is in Progress." | mailx -s "$DR Refresh update" xxxxx@mail.com
sleep 20
done
echo "$DR is in sync with ${PRIMARY} and ready to be switched to Snapshot DR" | mailx -s "$DR Refresh update" xxxxx@mail.com
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
until [ "$expectedSeq" -eq "$testSeq" ]; do
echo "$DR sync is in Progress." | mailx -s "$DR Refresh update" xxxxx@mail.com
sleep 5
if [ $? -eq 0 ]; then
break
fi
done
echo "$DR is in sync with ${PRIMARY} and ready to be switched to Snapshot DR" | mailx -s "$DR Refresh update" xxxxx@mail.com
Ценю всю помощь. Заранее спасибо