Problem:
While restoring a Non-Production DB from RMAN backup using Duplicate method , I received this error:
RMAN-05502: the target database must be mounted when issuing a DUPLICATE command
I used to run the duplicate command one time with a random UNTIL TIME date ahead of the backup date, then the RMAN will give me an error indicating the actual farthest recovery date the backup can restore to, then I use the same date from the error message and feed it to UNTIL TIME clause when running the same script for the second time.
Solution:
The date specified in the UNTIL TIME clause is trying to restore the backup to a date older than the backup creation date, this is why I received that vague error message. Once I used a date ahead of the backup time (randomly) I got the right farthest recovery date the backup can go to:
RMAN-06617: UNTIL TIME (20-Jun-2019 13:05:17) is ahead of last NEXT TIME in archived logs (02-Jun-2019 17:30:19)
Then I restarted the instance in NOMOUNT mode one more time and used the exact “last NEXT TIME in archived logs” received from the above error message and the duplicate succeeded.
run {
RMAN-05502 error can happen because of using a wrong date in the UNTIL TIME clause, once you use the right date and time of the backupset the Duplicate will go through.