[oracle@testbox ~]$ RESTORE_TIME=`TZ=GMT date +%d-%m-%Y`
[oracle@testbox ~]$ echo $RESTORE_TIME
11-07-2011
[oracle@testbox ~]$ RESTORE_TIME=`TZ=GMT+24 date +%d-%m-%Y`
[oracle@testbox ~]$ echo $RESTORE_TIME
10-07-2011
[oracle@testbox ~]$ RESTORE_TIME=`TZ=GMT+48 date +%d-%m-%Y`
[oracle@testbox ~]$ echo $RESTORE_TIME
10-07-2011
[oracle@testbox ~]$ RESTORE_TIME=`TZ=GMT-48 date +%d-%m-%Y`
[oracle@testbox ~]$ echo $RESTORE_TIME
12-07-2011
[oracle@testbox ~]$ RESTORE_TIME=`date "+%d-%m-%Y"`
[oracle@testbox ~]$ echo $RESTORE_TIME
11-07-2011
[oracle@testbox ~]$ RESTORE_TIME=`date -d yesterday "+%d-%m-%Y"`
[oracle@testbox ~]$ echo $RESTORE_TIME
10-07-2011
[oracle@testbox ~]$
RESTORE_TIME=`date -d yesterday "+%d-%m-%Y"`
echo Beginning copy of $SOURCE to $DEST. Press Ctrl+C to abort within 10 secs...
sleep 10
# Delete old logs and create an automatic log for this operation
find /tmp -name /tmp/$LOGFILE* -mtime +14 -exec rm {} \; 2>/dev/null
exec > >(tee -a /tmp/$LOGFILE.$TIMESTAMP)
echo Generating RMAN script ..
cat <<EOF >> /tmp/rman-duplicate.$$
run {
set until time "to_date('$RESTORE_TIME 23:00:00','DD-MM-YYYY HH24:MI:SS')";
allocate auxiliary channel aux_01 device type disk;
duplicate target database to $DEST;
}
exit;
No comments:
Post a Comment