1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Creating backups and fast recovery using RMAN

Discussion in 'Security, Backup and Recovery' started by FDavidov, Jan 7, 2015.

  1. FDavidov

    FDavidov Active Member

    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    80
    Hello everybody,

    I'm quite new with RMAN package and, to be frank, reading the manual (for the 3rd time!) is not helping much.

    I'd very much appreciate if anyone with experience in RMAN functionality would assist with some simple "recipes".

    1) I have an operational database (Oracle 11 R2) configured in a RAC mode with about 15 datafiles.
    2) I want to perform daily backups that would create fully copy of the datafiles.
    3) Once the backup is completed, these files would be MOVED/COPIED (using OS commands) to a separate folder (e.g. a folder whose name would reflect the DATE of the backup; alternatively, the backup process could generate brand new files each time, but this would drastically increase the time it takes for the backup to complete, I think).
    4) While MOVING/COPYING the files to the other folder, the REDO logs would be copied to the folder of the previous day; this way, it would be possible to re-generate the database from scratch to just before backup "N" using the files of backup "N-1" + the REDO logs found while generating BACKUP "N".
    5) Whenever I need to restore the database (for whatever reason) I would like to take the data files from BACKUP "X-1", restore them, and then update them with the stored REDO logs found while generating BACKUP "X".

    The following would (hopefully) explain what I would like to achieve:

    :
    :
    FOLDER OF DAY 6 containing:
    - Data files found in day "6",
    - REDO logs found in day "7";
    FOLDER OF DAY 7 containing:
    - Data files found in day "7",
    - REDO logs found in day "8";
    FOLDER OF DAY 8 containing:
    - Data files found in day "8",
    - REDO logs found in day "9";
    :
    :
    So, if I want to restore the database to the state it was just before DAY 8, I would be taking the 'Data files found in day "7"' and the 'REDO logs found in day "8"', all of them located within the FOLDER OF DAY "7".

    Hoping that the above is clear, here are my questions:

    1) Is the above feasible at all?
    2) Assuming it is, could anyone provide detailed RMAN scripts handling the BACKUP generation and the RESTORE to DAY "X" (I assume that some OS scripts may also be needed, and can handle them without any issue)?

    Thanking in advance to the philanthropists among you,

    Fernando.
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,351
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    It's RAC but that is still a single database; one set of data files to copy. And why do you think RMAN copies datafiles in their entirety for each day of an incremental backup? It's clear that you're confused.


    An RMAN backup can take one of two basic forms, a COLD backup (where the database is NOT open) and a HOT backup (where the database is open and taking transactions during the backup). Honestly if you want nothing but cold backups you will need a lot of space to store these backup sets since each day the entire database will be completely backed up. Of course while doing this the users will have absolutely NO access to the database. A hot backup would provide better recovery as it allows for point-in-time recovery rather than recovering to the state of the database as of the last cold backup.


    You also do not backup redo logs, you backup archived redo logs (archivelogs) and use THOSE to recover to a given point in time. This means you need a HOT backup, where you take a level 0 hot backup on Sunday (for example) and take level 1 incrementals during the week. HOT backups include the archivelogs, yet you may also want to backup the archivelogs as a separate step in the level 0/ level 1 backups to ensure you have them. Restoring and recovering only requires a date and time to restore to; RMAN takes care of the rest by choosing the most recent level 0 and appropriate level 1 backup to bring the database to the point you requested.


    You are making things unnecessarily complicated.
     
  3. FDavidov

    FDavidov Active Member

    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    80
    David,

    Many thans for your comments.

    I obviously missed some important info:

    - It is indeed a single database,
    - Backup type is HOT.

    The whole idea is (whenever a recovery needs to take place) to restore the database to working conditions in the fastest possible way. Of course, if we can do it with ALL THE VALID DATA, that would be the best, but it is still the AVAILABILITY is more important than the COMPLETENESS.

    Disk space: we can afford to keep, say, 4-6 days back (as explained, in separate folders), so this is not a problem.

    Last, and as described in my first post, sample RMAN scripts would be highly appreciated.

    Fernando.
     
  4. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,351
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    You still don't get it. A HOT backup includes the archived redo logs so the incremental backup series starting with the level 0 and including the most recent level 1 HAS ALL OF THE DATA, PERIOD. The RMAN command series to get your database back is simple:


    restore database;
    recover database;


    You're done, RMAN takes care of the rest and restores the database to the last committed transaction applied.


    There are dozens of such RMAN scripts online and Google can find them so why are you not using it?