This discussion is archived
1 2 Previous Next 24 Replies Latest reply: Apr 8, 2013 6:51 PM by Hemant K Chitale RSS

Restoring a bkp level 0 with no Archived Logs

KeenOnOracle Explorer
Currently Being Moderated
Hi Friends.

Is it possible to recover a bkp incremental level 0 made by RMAN on a different server without archived logs?

Lets assume I have a bkp level 0 and the source DB isn't available anymore, it just crashed at all. Is it possible with any archived logs to restore it on a different machine?
Lets also assume I got bkp of controlfile and pfile from source. Thats all I have. Bkp level0, controlfile and spfile.

Tks a lot
  • 1. Re: Restoring a bkp level 0 with no Archived Logs
    EdStevens Guru
    Currently Being Moderated
    KeenOnOracle wrote:
    Hi Friends.

    Is it possible to recover a bkp incremental level 0 made by RMAN on a different server without archived logs?

    Lets assume I have a bkp level 0 and the source DB isn't available anymore, it just crashed at all. Is it possible with any archived logs to restore it on a different machine?
    Lets also assume I got bkp of controlfile and pfile from source. Thats all I have. Bkp level0, controlfile and spfile.

    Tks a lot
    you could recover "until time" to the time at which the level 0 backup completed. Beyond that, no.
  • 2. Re: Restoring a bkp level 0 with no Archived Logs
    KeenOnOracle Explorer
    Currently Being Moderated
    Tks Ed!
  • 3. Re: Restoring a bkp level 0 with no Archived Logs
    Jonathan Lewis Oracle ACE Director
    Currently Being Moderated
    EdStevens wrote:

    you could recover "until time" to the time at which the level 0 backup completed. Beyond that, no.
    Are you sure about that ? I didn't think it would work because you need the archived redo logs from the moment the backup started to the moment it ended so that you could get the data files to a self-consistent state. The files will probably be changing as they're backed up, so the last file backed up will be in the future of the first file backed up.

    Regards
    Jonathan Lewis
  • 4. Re: Restoring a bkp level 0 with no Archived Logs
    KeenOnOracle Explorer
    Currently Being Moderated
    Hi Jonathan,

    So this simple command will not generate a backupset consistent to recover on another machine?

    run {
    allocate channel c1 type disk format 'c:\primary_bkp\rman_%s%t.bkp';
    backup as compressed backupset incremental level 0 database;}

    Even doing an "alter system archive log current" before it starts?
    What would be the solution for this?

    Imagine further... imagine I have this level 0 bkp and 2 others level 1 backup for the days after. Wouldnt be possible apply them to restore the DB without archives?

    In my case(env. + quality of WAN, etc.) the archived logs are too big to transmit every log switch, so I always record a bkp level0 plus the level1 for the rest of the week. But no archived logs to the "remote" palce.

    tks a lot !
  • 5. Re: Restoring a bkp level 0 with no Archived Logs
    rp0428 Guru
    Currently Being Moderated
    >
    So this simple command will not generate a backupset consistent to recover on another machine?
    >
    No - for the reasons that Jonathan explained.

    The datafile headers have SCN in them. The control files have SCN in them. The REDO log files have SCN in them.

    The SCN of the database at the END of the backup may be different than the SCN at the start of the backup. That means that the SCN in one or more of the datafiles will be different than the SCN in other datafiles.

    The REDO logs are needed to resolve that discrepancy.

    If you have a COLD backup (i.e. a backup/copy of all files when the DB was shutdown during the backup) then you can restore it without the REDO logs.

    See the Backup and Recovery Guide for the full description of backup modes and functionality
    http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmcncpt.htm#BABIHBBE
    >
    Consistent Backups
    You can use the BACKUP command to make consistent and inconsistent backups of the database. A consistent backup occurs when the database is in a consistent state. A database is in a consistent state after being shut down with the SHUTDOWN NORMAL, SHUTDOWN IMMEDIATE, or SHUTDOWN TRANSACTIONAL commands. A consistent shutdown guarantees that all redo has been applied to the datafiles. If you mount the database and make a backup at this point, then you can restore the database backup later and open it without performing media recovery.

    Inconsistent Backups
    Any database backup that is not consistent is an inconsistent backup. A backup made when the database is open is inconsistent, as is a backup made after an instance failure or SHUTDOWN ABORT command. When a database is restored from an inconsistent backup, Oracle Database must perform media recovery before the database can be opened, applying any pending changes from the redo logs.
    >
    Yours was an 'Inconsistent Backup' - note the last clause above
    >
    applying any pending changes from the redo logs.
  • 6. Re: Restoring a bkp level 0 with no Archived Logs
    KeenOnOracle Explorer
    Currently Being Moderated
    Ok i got it.


    what about "backup database plus archivelog"?

    Would make it possible?


    The need is replicate RMAN backup to another destination to avoid lost of data in case of failures to the primary location. There's no way, unfortunately, to have one more license os Oracle to replicate it as a Standby DB so that I'm looking for solutions replicating rman backups.

    Tks
  • 7. Re: Restoring a bkp level 0 with no Archived Logs
    Justin_Mungal Journeyer
    Currently Being Moderated
    Jonathan Lewis wrote:
    EdStevens wrote:

    you could recover "until time" to the time at which the level 0 backup completed. Beyond that, no.
    Are you sure about that ? I didn't think it would work because you need the archived redo logs from the moment the backup started to the moment it ended so that you could get the data files to a self-consistent state. The files will probably be changing as they're backed up, so the last file backed up will be in the future of the first file backed up.

    Regards
    Jonathan Lewis
    That is the way I understand it as well. If you create a hot-backup, then you must also have archive logs to roll previously restored data files forward to the same SCN. If the database is closed when you run the backup, and the database was gracefully shutdown, you do not need archive logs since recovery is not required.
  • 8. Re: Restoring a bkp level 0 with no Archived Logs
    KeenOnOracle Explorer
    Currently Being Moderated
    not answered yet :(

    Edited by: KeenOnOracle on Apr 4, 2013 5:20 PM
  • 9. Re: Restoring a bkp level 0 with no Archived Logs
    rp0428 Guru
    Currently Being Moderated
    >
    what about "backup database plus archivelog"?

    Would make it possible?
    >
    As long as they are the logs that match the files that belong to the rest of the backup: controlfile, datafiles, etc.

    That's one of the main reasons to use RMAN: it will backup EVERYTHING that is needed for recovery. If you then choose to pick that consistent set of files apart and copy some of them to another location but get the REDO copies from somewhere else you are likely to wind up with an inconsistent set of TOTALLY USELESS files. The REDO files have SCN in them also.

    The most likely thing you will gain from trying to circumvent Oracle's carefully orchestrated backup functionality is a set of files that, ultimately, turn out to be unusable. Unfortunately for many people they never test their backups and don't discover until weeks or months later that they really have no backup.

    Hey - it's your database. Take whatever level of risk you feel comfortable with.
  • 10. Re: Restoring a bkp level 0 with no Archived Logs
    EdStevens Guru
    Currently Being Moderated
    Jonathan Lewis wrote:
    EdStevens wrote:

    you could recover "until time" to the time at which the level 0 backup completed. Beyond that, no.
    Are you sure about that ? I didn't think it would work because you need the archived redo logs from the moment the backup started to the moment it ended so that you could get the data files to a self-consistent state. The files will probably be changing as they're backed up, so the last file backed up will be in the future of the first file backed up.

    Regards
    Jonathan Lewis
    Well, now that you say that it sounds correct. However ..

    I just happened to be working on adding some intelligence to a script we run weekly to refresh a test db from prod. It's based on copying the rman backups from prod server to test server, then "duplicate target database to testdb" The script that creates the backups looks like this:
    sql "alter system archive log current";
    backup as compressed backupset archivelog all delete all input format "$BACKUP_LOC/%U.alog";
    backup as compressed backupset incremental level 0 database tag tag_proddb;
    sql "alter system archive log current";
    backup as compressed backupset archivelog all delete all input format "$BACKUP_LOC/%U.alog";
    The above is what I inherited and I haven't touched it yet. But here's the interesting bit. The refresh script looks like this
    run {
    set until time "to_date('`date +%Y-%m-%d` 11:55:00','YYYY-MM-DD hh24:mi:ss')";
    duplicate target database to TESTDB;
    }
    It runs the same day as the level 0 backup, that finishes around 0930, and is depending on the backupsets that are copied over to contain archivelogs through 11:55:00, which are provided by a special backup of the archivelogs that runs at noon. (the level 0 backup typically takes about 9 hours to run) Obviously some scheduling coordination is required.

    My change, and I've tested it out in my vm lab, is to query the rman catalog and get the completion time of the most recent level 0 backup, then plug that value into the SET UNTIL clause. So it would appear that I am recovering with just the level 0 backup.
    In the vm lab it is working beautifully.

    I offer the above as a justification for my earlier comments. Maybe you've exposed something that would bite me if I moved this to the live system, and I need to figure that out. Could it be because my lab system is not generating any redo during the backup, so it is just lucky?

    But I am pulling the thread away from the OP.

    Edited by: EdStevens on Apr 4, 2013 3:50 PM
  • 11. Re: Restoring a bkp level 0 with no Archived Logs
    Justin_Mungal Journeyer
    Currently Being Moderated
    EdStevens wrote:
    Jonathan Lewis wrote:
    EdStevens wrote:

    you could recover "until time" to the time at which the level 0 backup completed. Beyond that, no.
    Are you sure about that ? I didn't think it would work because you need the archived redo logs from the moment the backup started to the moment it ended so that you could get the data files to a self-consistent state. The files will probably be changing as they're backed up, so the last file backed up will be in the future of the first file backed up.

    Regards
    Jonathan Lewis
    Well, now that you say that it sounds correct. However ..

    I just happened to be working on adding some intelligence to a script we run weekly to refresh a test db from prod. It's based on copying the rman backups from prod server to test server, then "duplicate target database to testdb" The script that creates the backups looks like this:
    sql "alter system archive log current";
    backup as compressed backupset archivelog all delete all input format "$BACKUP_LOC/%U.alog";
    backup as compressed backupset incremental level 0 database tag tag_proddb;
    sql "alter system archive log current";
    backup as compressed backupset archivelog all delete all input format "$BACKUP_LOC/%U.alog";
    The above is what I inherited and I haven't touched it yet. But here's the interesting bit. The refresh script looks like this
    run {
    set until time "to_date('`date +%Y-%m-%d` 11:55:00','YYYY-MM-DD hh24:mi:ss')";
    duplicate target database to TESTDB;
    }
    It runs the same day as the level 0 backup, that finishes around 0930, and is depending on the backupsets that are copied over to contain archivelogs through 11:55:00, which are provided by a special backup of the archivelogs that runs at noon. (the level 0 backup typically takes about 9 hours to run) Obviously some scheduling coordination is required.

    My change, and I've tested it out in my vm lab, is to query the rman catalog and get the completion time of the most recent level 0 backup, then plug that value into the SET UNTIL clause. So it would appear that I am recovering with just the level 0 backup.
    In the vm lab it is working beautifully.
    In your VM lab are the archive log backup commands included as well? Wouldn't that explain why you're able to do use the set until time clause?

    >
    I offer the above as a justification for my earlier comments. Maybe you've exposed something that would bite me if I moved this to the live system, and I need to figure that out. Could it be because my lab system is not generating any redo during the backup, so it is just lucky?

    But I am pulling the thread away from the OP.

    Edited by: EdStevens on Apr 4, 2013 3:50 PM
  • 12. Re: Restoring a bkp level 0 with no Archived Logs
    rp0428 Guru
    Currently Being Moderated
    >
    backup as compressed backupset incremental level 0 database tag tag_proddb;
    sql "alter system archive log current";
    backup as compressed backupset archivelog all delete all input format "$BACKUP_LOC/%U.alog";
    . . .
    duplicate target database to TESTDB;
    >
    That first backup captures the redo/archive logs from the end of the database backup.

    And then the 'duplicate' uses those redo/archive logs as well as the database backup.

    OP isn't using their redo/archive logs. It is OP that is hoping to 'get lucky'.
  • 13. Re: Restoring a bkp level 0 with no Archived Logs
    jgarry Guru
    Currently Being Moderated
    If you have parallelization (multiple backup channels) and therefore several backup pieces, the datafiles of a tablespace may be spread across pieces and have different SCN's.

    That's one minor reason I like how dbconsole does it - you can easily look at the logs from any backup piece and see a nicely formatted report of the SCN, so much easier than visually parsing the text files, though parsing with a script could be easier with one big log (trace) file - though I don't see the SCN for the data files in there, only archived logs. I might just be blind... dbconsole also lets you see the trace. On the other hand, getting to them can be painfully slow on some versions.

    You can probably figure out the SCN for a datafile by looking at the checkpoint_change# in v_$backup_datafile_details based on the file# (fno in the trace), but I don't know for sure, it's all done for me in dbconsole.

    I think where it can all go wrong is something like a datafile goes offline/readonly, so you miss the media recovery needed to fix. Or something like that, I know I ran into it redoing a standby after damagement did something ooky and I didn't catch it for a while, methods to fix varied by version and whether you catalog.

    I'm sure there are plenty of people who know more about this than me, just HTH.
  • 14. Re: Restoring a bkp level 0 with no Archived Logs
    Hemant K Chitale Oracle ACE
    Currently Being Moderated
    to query the rman catalog and get the completion time of the most recent level 0 backup, then plug that value into the SET UNTIL clause.
    It would use the ArchiveLogs for the redo that is from the time the L0 backup began to to the completion time.
    In your VM you may be fortunate that there isn't much redo.


    Hemant K Chitale
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points