6 Replies Latest reply on Apr 10, 2012 9:06 AM by qbsl

    RMAN Restore bahaviour

    qbsl
      Hi

      Give the following situation:
      1. A Live database backed up every day at midnight and takes one hour to run.
      2. An hour after it finishes, a test database is refreshed from the live database's backup and told to restore the test database to a specific point in time - 12.30AM (i.e., half way through the running time of the most recent backup.

      Would RMAN use the latest backup to rebuild the test database, or would it default to the previous day's backup (as the last fully completed backup prior to 12.30) and follow through the archive logs of the previous day's activity to catch up to the right point in time?

      [Not a DBA so please excuse me if the language isn't as precise as you're used to...]

      Thanks
        • 1. Re: RMAN Restore bahaviour
          713555
          it depends on the files

          day 1.
          backup database plus archivelogs
          backup controlfile

          arc logs

          day 2.

          backup database plus archivelogs
          backup controlfile


          at what point are you restoring to test and how are you doing it? you would have to restore the controlfille and then restore the database.
          the controlfile from day 1 is only aware of the backup of the database from 1. you can of course roll through the arc logs if you make them available. but the usual way is to restore to a point in time to the last arc log that was generated by the backup in day 1.
          • 2. Re: RMAN Restore bahaviour
            666177
            I would say that depends...
            Depends on which time the last SCN checkpoint will occur DURING the backup of the datafiles.

            If the last checkpoint will happen before the "restore point-in-time", at 12:29 AM for example, RMAN will chose the most recent completed backup and not the previous day one. Though if any datafile start to backup after 12:30 this backup cannot be used to your restore, because when rman start to backup a datafile, it triggers a checkpoint.

            Also, checkpoints are triggered for the following reasons: FAST_START_MTTR_TARGET, redo log switch and because of the parameters LOG_CHECKPOINT_TIMEOUT and LOG_CHECKPOINT_INTERVAL.

            I also would say that it is very likely that you database will do checkpoints during your backup, unless your database was not being used.

            Resuming, is more likely that RMAN will use the previous day backup... but it is not a certainty. ;)

            Regards,
            Rafael
            1 person found this helpful
            • 3. Re: RMAN Restore bahaviour
              qbsl
              Thanks both. I should probably have come at this from another angle:

              The above situation exactly describes a real backup schedule and the restore process IS going back to the previous day's backup and then processing the archive logs.
              What I'm trying to find out at is whether this behaviour is specifically because the restore time chosen overlaps with the backup period (my theory) or whether it is just happening more-or-less randomly and is just something we have to accommodate.

              Any alternative theories about why it might be happening would also be welcome too...
              • 4. Re: RMAN Restore bahaviour
                EdStevens
                qbsl wrote:
                Thanks both. I should probably have come at this from another angle:

                The above situation exactly describes a real backup schedule and the restore process IS going back to the previous day's backup and then processing the archive logs.
                What I'm trying to find out at is whether this behaviour is specifically because the restore time chosen overlaps with the backup period (my theory) or whether it is just happening more-or-less randomly and is just something we have to accommodate.

                Any alternative theories about why it might be happening would also be welcome too...
                A Tom Kyte or Johnathan Lewis may weigh in with some deep theory to the contrary, but it seems obvious to me that a recovery must begin with a consistently complete backupset. Therefor it would be fundamentally impossible to use a given backupset to perform a recovery to a PIT prior to the completion of that backupset. Suppose the backup began at precisely 04:21:01, and finishing at precisely 04:51:01. Would you expect to be able use that backupset to recover to 04:21:02? 04:21:59? 04:32:47? At what point in time prior to 04:51:01 would you expect to be able to use that backupset, and why? Why that time, and not 5 seconds earlier?
                1 person found this helpful
                • 5. Re: RMAN Restore bahaviour
                  Nelson Calero
                  You are seeing the expected behavior: your restore time is at a point where no new full/incremental/archivelogs backups are available to be used.

                  Some way the new backup could be used "randomly", depending on the size of your database, is when you are taking incremental backups, during a day with few activity, the midnight backup finish earlier than usual and become available for the time your restore runs.

                  You should consider to change your procedure to refresh the test database after the first backup finish, and instead of using a fixed time as a restore point, take the last SCN included in your recent backup (using the NEXT_CHANGE$ column from V$ARCHIVED_LOG).

                  Regards.
                  • 6. Re: RMAN Restore bahaviour
                    qbsl
                    Thanks again for all the helpful answers.