RMAN, SCN
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: RMAN, SCN

Hybrid View

  1. #1
    Join Date
    Jan 2001
    Posts
    71

    Question

    When use RMAN to do timed babed incomplete recovery, what's the time format to use? 'Mon DD YYYY HH24:MI:SS' or 'YYYY-MM-DD:HH24:MI:SS' or ...?

    which view and which column to find SCN for changed based recovery?

    Thanks.

  2. #2
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Performing Incomplete Recovery with a Recovery Catalog

    The database must be closed to perform database point-in-time recovery. Note that if you are recovering to
    a time, you should set the time format environment variables before invoking RMAN (see "Setting NLS
    Environment Variables"). For example, enter:

    NLS_LANG=american
    NLS_DATE_FORMAT='Mon DD YYYY HH24:MI:SS'

    To recover the database until a specified time:

    1.Start RMAN and connect to the target database and, optionally, the recovery catalog database. For
    example, enter:

    % rman target / catalog rman/rman@rcat



    Optionally, specify a log file at connect time:

    % rman target / catalog rman/rman@rcat log = rman_log



    2.If the database is open, shut it down and then mount it:

    shutdown immediate;
    startup mount;



    3.Determine which time you want to recover to. For example, if you discover at 9:15 a.m. that a user
    accidentally dropped a tablespace at 9:02 a.m., then you can recover to 9 a.m.--just before the drop
    occurred. You will lose all changes to the database made since that time.

    4.Perform the following operations within your run command:

    a.Set the end recovery time using the date format specified in your NLS_LANG and
    NLS_DATE_FORMAT environment variables.

    b.Allocate channels.

    c.Restore the database.

    d.Recover the database.

    e.Open the database with the RESETLOGS option.

    For example, this job performs an incomplete recovery until Nov 15 at 9 a.m.

    run {
    set until time 'Nov 15 1998 09:00:00';
    allocate channel ch1 type 'sbt_tape';
    restore database;
    recover database;
    sql 'ALTER DATABASE OPEN RESETLOGS';
    }


    5.Reset the database:

    reset database;


    6.Immediately back up the database. Because the database is a new incarnation, the pre-RESETLOGS
    backups are not usable. For example, enter:

    run {
    allocate channel ch1 type 'sbt_tape';
    backup database;
    }

    To recover the database until a specified SCN:

    1.Start RMAN and connect to the target database and, optionally, the recovery catalog database. For
    example, enter:

    % rman target / catalog rman/rman@rcat



    Optionally, specify a message log file at connect time:

    % rman target / catalog rman/rman@rcat log = rman_log



    2.If the database is open, shut it down and then mount it:

    shutdown immediate;
    startup mount;



    3.Determine the SCN to which you want to recover. For example, if you made a backup of tablespace
    TBS_1 and then shortly afterwards a user accidentally overwrote a datafile in TBS_3, then you can issue
    a list command to determine the SCN for the TBS_1 backup and then restore yesterday's whole
    database backup and recover to that SCN.

    4.Perform the following operations within your run command:

    a.Set the end recovery SCN.

    b.Allocate channels.

    c.Restore the database.

    d.Recover the database.

    e.Open the database with the RESETLOGS option.

    For example, this job performs an incomplete recovery until SCN 1000.

    run {
    set until scn 1000;
    allocate channel ch1 type 'sbt_tape';
    restore database;
    recover database;
    sql 'ALTER DATABASE OPEN RESETLOGS';
    }



    5.Reset the database:

    reset database;


    6.Immediately back up the database. Because the database is a new incarnation, the pre-RESETLOGS
    backups are not usable. For example, enter:

    run {
    allocate channel ch1 type 'sbt_tape';
    backup database;
    }

    To recover the database until a specified log sequence number:

    1.Start RMAN and connect to the target database and, optionally, the recovery catalog database. For
    example, enter:

    % rman target / catalog rman/rman@rcat



    Optionally, specify a message log file at connect time:

    % rman target / catalog rman/rman@rcat log = rman_log



    2.If the database is open, shut it down and then mount it:

    shutdown immediate;
    startup mount;



    3.Determine the log sequence number to which you want to recover. For example, query
    V$LOG_HISTORY to view the redo logs that you have archived.

    RECID STAMP THREAD# SEQUENCE# FIRST_CHAN FIRST_TIM NEXT_CHANG
    ---------- ---------- ---------- ---------- ---------- --------- ----------
    1 344890611 1 1 20037 24-SEP-98 20043
    2 344890615 1 2 20043 24-SEP-98 20045
    3 344890618 1 3 20045 24-SEP-98 20046
    4 344890621 1 4 20046 24-SEP-98 20048
    5 344890624 1 5 20048 24-SEP-98 20049
    6 344890627 1 6 20049 24-SEP-98 20050
    7 344890630 1 7 20050 24-SEP-98 20051
    8 344890632 1 8 20051 24-SEP-98 20052
    8 rows selected.



    4.Perform the following operations within your run command:

    a.Set the log sequence number for recovery termination.

    b.Allocate channels.

    c.Restore the database.

    d.Recover the database.

    e.Open the database with the RESETLOGS option.

    For example, this job performs an incomplete recovery until log sequence number 6 on thread 1:

    run {
    set until logseq 6 thread 1;
    allocate channel ch1 type 'sbt_tape';
    restore database;
    recover database;
    sql 'ALTER DATABASE OPEN RESETLOGS';
    }



    5.Reset the database:

    reset database;


    6.Immediately back up the database. Because the database is a new incarnation, the pre-RESETLOGS
    backups are not usable. For example, enter:

    run {
    allocate channel ch1 type 'sbt_tape';
    backup database;
    }
    Thanx
    Sam



    Life is a journey, not a destination!


  3. #3
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    What a funny option "edit/delete" is You can only edit the thread and you cannot remove your own copy of your posting.

    Moderators & Forum Administrators, why it is so
    Sam

    [Edited by sambavan on 04-02-2001 at 10:59 AM]
    Thanx
    Sam



    Life is a journey, not a destination!


  4. #4
    Join Date
    Jan 2001
    Posts
    71
    Thanks sambavan

    I have this manual. But when I put in time format just the same as manual, RMAN return an error and rejected this time format.

    From v$log_hishory, which column is SCN#? sequence# or ..?

  5. #5
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Before using the time format in RMAN, you have to set it in your profile i.e NLS_DATE_FORMAT='YYYY-MM-DD:HH24:MI:SS'
    then in RMAN

    RMAN> set until time = '1997-12-09:11:44:00';

    in RMAN do

    RMAN> list backup

    This would show you the SCN# and sequence#s

    Good luck,
    Sam
    Thanx
    Sam



    Life is a journey, not a destination!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width