Oracle spanning Point-in-time recovery

Source: Internet
Author: User

After you open the database with Resetlogs before oracle10g, the previous backup cannot be used for recovery. That is, you cannot perform a recovery across resetlogs points in time. Therefore, a full library backup is required immediately after execution.

ORACLE10G allows full or incomplete recovery across resetlogs points of time. The experiment is as follows:

  1. Perform a full library backup.

    Rman> BACKUP Database plus archivelog delete all input;

    INSERT INTO Test select * from test;

    sql> alter system switch logfile;

    Sql> commit;

    Commit complete.

    sql> alter system switch logfile;

    System altered.

    sql> TRUNCATE TABLE test;

    Table truncated.

    sql> alter system switch logfile;

    System altered.

    Sql> select * from V$log_history;

    Sql> Select recid,stamp,sequence#,first_change#,first_time,next_change# from V$log_history

    2 where RecId >80;

    Recidstamp first_change# First_time next_change#

    ---------- ---------- ------------- ------------ ------------

    Bayi 856723148 2130643 27-aug-14 2130889

    856752323 2130889 27-aug-14 2155374

    856753004 2155375 28-aug-14 2175380

    856753636 2175380 28-aug-14 2176030

    856754916 2176030 28-aug-14 2177334

    856754945 2177334 28-aug-14 2177347

    856755046 2177347 28-aug-14 2178414

    856755142 2178414 28-aug-14 2178471

    856755199 2178471 28-aug-14 2178508

    856755243 2178508 28-aug-14 2178543

    856755424 2178543 28-aug-14 2178823

    Recidstamp first_change# First_time next_change#

    ---------- ---------- ------------- ------------ ------------

    856755456 2178823 28-aug-14 2178836

    856755483 2178836 28-aug-14 2178940

    Rows selected.

  2. Shut down the database, delete data simulation failures

    After deletion, do the following

    rman> startup Mount;

    Oracle instance started

    Database mounted

    Total System Global area 599785472 bytes

    Fixed Size 2022600 bytes

    Variable Size 268436280 bytes

    Database buffers 322961408 bytes

    Redo buffers 6365184 bytes

    Rman> run{

    Set until sequence-thread 1;

    Restore database;

    Recover database;

    }

    Here to judge the specific to that sequence, the current query is as follows, history view V$log_history sequence#:

    Sql>archive log list;

    If this error occurs:

    sql> recover database until cancel;

    Ora-00283:recovery session canceled due to errors

    Ora-01610:recovery using the BACKUP controlfile option must is done

    sql> Recover Database BACKUP controlfile

    ora-00905:missing keyword

    Solve:

    Recover database using Backup controlfile until cancel;

    rman> ALTER DATABASE open resetlogs;

    To see if the serial number is reset:

    sql> archive log list;

    Database Log Mode Archive mode

    Automatic Archival Enabled

    Archive Destination Use_db_recovery_file_dest

    Oldest online log sequence 0

    Next log sequence to archive 1

    Current log sequence 1

    Sql> Create conn XZSP create TT able TT as SELECT * from Dba_users;

    Table created.

    sql> alter system switch logfile;

    System altered.

    Sql> Select COUNT (*) from TT;

    COUNT (*)

    ----------

    26

    sql> inert in SERT to TT select * from TT;

    Rows created.

    Sql>/

    Created rows.

    Sql>/

    104 rows created.

    Sql> Commit

    2;

    Commit complete.

    sql> alter system switch logfile;

    System altered.

    Sql> select recid,stamp,first_change#,first_time,next_change# from V$log_history;

    RECID STAMP sequence# first_change# first_time next_change#

    ---------- ---------- ---------- ------------- ------------ ------------

    856759449 1 2179277 28-aug-14 2179707

    101 856759476 2 2179707 28-aug-14 2179788

    102 856761071 1 2179621 28-aug-14 2179920

    103 856761108 2 2179920 28-aug-14 2179945

    103 rows selected.

    Oracle retains the log sequence number before resetlogs, and the log recid continues to grow, and the control file retains the sequence of archived logs. So you can recover across resetlogs. 10g was previously not able to use the current control file before recovering the backup.

    Rman> Run {

    2> Restore Database;

    3> Recover database;

    4>}

    Sql> Select COUNT (*) from TT;

    COUNT (*)

    ----------

    208

    Recovery can be done, and there are log_archive_format relationships.

    Sql>show parameter Log_archive_format

    Log_archive_format string Archive_%t_%s_%r.log

    The%r here is Oracle's new parameter, which is the Resetlogs's flag number. This archive log format can be a different incarnation database archive log to avoid overwriting each other, thus guaranteeing a log base spanning resetlogs recovery.

    ?

    ?

    Think: The Rman backup is seen here only once, before Resetlogs, and the second full recovery is based on the previous backup. Here to see Oracle10 is indeed over the Resetlog performed the recovery.

Oracle spanning Point-in-time recovery

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.