Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using SYSDATE in RMAN script

user522620Jun 25 2012 — edited Jun 26 2012
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2012
Added on Jun 25 2012
5 comments
3,141 views