Using SYSDATE in RMAN script
Hi
Each night I move an RMAN backup from a PROD server to a test server.
Then using RMAN script with NOCATALOG, I restore/recover the database on the test server as show below:
RUN{
ALLOCATE CHANNEL dev1 DEVICE TYPE DISK;
STARTUP NOMOUNT;
RESTORE CONTROLFILE from AUTOBACKUP;
SHUTDOWN;
STARTUP FORCE MOUNT;
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;
}
Of course the script fails at the "RECOVER DATABASE" command because it runs out of ARCH logs to apply at some point and therefore never gets to the final command of DATABASE OPEN. I would like to change that line to something like:
RECOVER DATABASE UNTIL TIME 'SYSDATE:02:45:00';
The above fails with an RMAN error of "expected number".
Of course I could use SET UNTIL TIME "to_date('SYSDATE 02:45:00','DD-MON-YYYY HH24:MI:SS')"; although I have the same problem, i.e., getting RMAN to accept SYSDATE as the date portion of the point in time recovery.
Oddly, from an RMAN prompt and within brackets, I can issue the following command successfully:
RMAN {
set until time "to_date('SYSDATE 02:45:00','DD-MON-YYYY HH24:MI:SS')";
}
command completed successfully
So my question is, how can I use SYSDATE in an RMAN point in time recovery and have sysdate represent the current date, either in the RECOVER DATABASE line or the SET UNTIL TIME line?
Thanks.