RMAN - Point in Time Duplicate (11.2.0.2.0

From NazimWIKI
Jump to navigation Jump to search

I've spent weeks struggling with a point-in-time rman duplicate where for some obscure reason the duplicate would fail to apply point-in-time logs after midnight.


FINALLY - came across a bug in Metalink which explains this. People with access to Metalink can read about it by searching for:

Bug 11694127 - RMAN DUPLICATE not honoring TIME portion of date for "UNTIL TIME" [ID 11694127.8]

For those who don't have access, or couldn't be bothered reading it, in a nutshell, to honour the point-in-time "time" value which seems to get truncated, you must set both of the following environment variables (the format string and lang setting can be whatever is relevant to your database).


export NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS'
export NLS_LANG='AMERICAN'


A useful script to proceed with the duplicate may look like:


run {
set archivelog destination to '/backup/archivelog/';
duplicate database to DUPDB
  until time "TO_DATE('25-AUG-2012 02:30:00','DD-MON-YYYY HH24:MI:SS')"
  backup location '/backup/rmanbackup/'
  nofilenamecheck
LOGFILE 
GROUP 1 ( '+REDO1') SIZE 1G, 
GROUP 2 ( '+REDO2') SIZE 1G, 
GROUP 3 ( '+REDO1') SIZE 1G, 
GROUP 4 ( '+REDO2') SIZE 1G reuse;
}