Home » RDBMS Server » Backup & Recovery » UNTIL TIME clause in RMAN
UNTIL TIME clause in RMAN [message #216619] Mon, 29 January 2007 13:46 Go to next message
craigthomas
Messages: 2
Registered: January 2007
Location: Atlanta
Junior Member

Hi all,

I'm trying to automate a test database restore script via RMAN. Everything works great, but I need change the date in the UNTIL TIME clause of the rman script. Does anyone know of a formula I can use so that it always restores to the previous SAT night @7:30PM, no matter what day the restore is kicked off?


DUPLICATE TARGET DATABASE TO xxxx UNTIL TIME 'Jan 22 2007 19:30:00'


Thanks for any suggestions. This is currently a 9.2 database.

Craig
Re: UNTIL TIME clause in RMAN [message #216628 is a reply to message #216619] Mon, 29 January 2007 14:51 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Would this help?
Depending on your OS, you can simplify the script by using
OS date instead of Oracle date Smile

oracle@mutation#somescript
current date : Mon Jan 29 15:53:23 EST 2007
last saturday : JAN 27 2007 19:30:00
Within RMAN scripts, you can use it like this :
set until time "to_date( JAN 27 2007 19:30:00,MON DD YYYY HH24:MI:SS)";
oracle@mutation#
oracle@mutation#
oracle@mutation#cat somescript
tdate=`date`
ldate=`sqlplus -s scott/tiger <<EOF
set feed off;
set term off;
set head off;
set trimspool on;
alter session set nls_date_format='MON DD YYYY HH24:MI:SS';
select next_day(trunc(sysdate,'WW')-7, 'Saturday')+ 19.5/24  from dual;
exit;
EOF`
echo current date   : $tdate
echo last saturday : $ldate
echo Within RMAN scripts, you can use it like this :
echo 'set until time "to_date('$ldate','MON DD YYYY HH24:MI:SS')";'
oracle@mutation#
Re: UNTIL TIME clause in RMAN [message #216633 is a reply to message #216628] Mon, 29 January 2007 15:08 Go to previous message
craigthomas
Messages: 2
Registered: January 2007
Location: Atlanta
Junior Member

Thanks Mahesh - I'll give that a shot!
Previous Topic: How to config. Rman Tape Backup. ?
Next Topic: export problem..
Goto Forum:
  


Current Time: Sun Apr 28 23:15:41 CDT 2024