Sistemas‎ > ‎Linux‎ > ‎Scripts Linux‎ > ‎SAP‎ > ‎

Mover redolog mantendo os últimos dois arquivos

Crontab
# move redolog
*/5 * * * * /root/move_archivelog.sh > /dev/null


move_archivelog.sh

#!/bin/bash

ls -t /oracle/PRD/oraarch | head -2 > /tmp/redolog_ultimos_dois
ls -t /oracle/PRD/oraarch > /tmp/redolog_todos
grep -v -f /tmp/redolog_ultimos_dois /tmp/redolog_todos > /tmp/redolog_mover

echo "" > /tmp/mover_redolog.sh
for i in `/bin/cat /tmp/redolog_mover`
do
 echo "mv /oracle/PRD/oraarch/$i /mnt/redologs" >> /tmp/mover_redolog.sh
done

sh /tmp/mover_redolog.sh
Comments