Re: Ergh..banging head against a wall here (sqlplus...recover..until time...sysdate)

  • From: Jared Still <jkstill@xxxxxxxxx>
  • To: ChrisDavid.Taylor@xxxxxxxxxxxxxxx
  • Date: Tue, 3 Aug 2010 08:20:21 -0700

On Tue, Aug 3, 2010 at 6:59 AM, Taylor, Chris David <
ChrisDavid.Taylor@xxxxxxxxxxxxxxx> wrote:

>  Ok, I’m trying to setup an automated job to recover a database within
> sqlplus.  Everything works fine until I try to add an “UNTIL TIME” with
> SYSDATE.  Is there no way to configure UNTIL TIME with SYSDATE?
>
>
>
Borrowing from the Perl Motto: TMTOWTDI

Excerpted from a script that runs RESTORE VALIDATE from
cron on a random database.

TARGET_DATE=$(date --date="$DAYS_OLD days ago" '+%m/%d/%Y %H:%M')

# previous to 10g RMAN would include passwords in output
# filter them out
$RMAN_CMD  <<-EOF | $GREP -ivE 'connect target|connect catalog' | tee
$LOGFILE
set echo on;
connect target $DB_USER/$DB_PASSWORD@$DATABASE;
connect catalog $RCAT_USER/$RMAN_PASSWORD@$RMAN_CATALOG;
show all;
RUN
{
   set until time "to_date('$TARGET_DATE','mm/dd/yyyy hh24:mi')";
   restore database validate;
   restore validate archivelog from time
"to_date('$ARCH_BEGIN_DATE','mm/dd/yyyy hh24:mi')"
         until time "to_date('$TARGET_DATE','mm/dd/yyyy hh24:mi')";
}
EOF


Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist
Oracle Blog: http://jkstill.blogspot.com
Home Page: http://jaredstill.com

Other related posts: