Oracle does not completely restore the lost archive log

Source: Internet
Author: User

Environment:
OS: Red Hat Linux As 5
DB: Oracle 10.2.0.4
 
The following describes how to simulate Incomplete recovery after archiving logs are lost.
1. Back up the database
Run {
Allocate channel c1 device type disk;
Allocate channel c2 device type disk;
Allocate channel c3 device type disk;
Allocate channel c4 device type disk;
Backup database format'/u02/rman_bak/full _ % u _ % T. bak ';
Release channel c1;
Release channel c2;
Release channel c3;
Release channel c4;
}
 
2. Incomplete recovery is performed to reset the log. The time point here is the time point after the backup set is generated.
Run {
Set until time "to_date ('2017-07-06 21:52:00 ', 'yyyy-MM-DD HH24: MI: ss ')";
Restore database;
Recover database;
}
Reset logs
RMAN> alter database open resetlogs;
Database opened
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
 
3. Back up data again to simulate restoration after log loss
Run {
Allocate channel c1 device type disk;
Allocate channel c2 device type disk;
Allocate channel c3 device type disk;
Allocate channel c4 device type disk;
Backup database format'/u02/rman_bak/full _ % u _ % T. bak ';
Release channel c1;
Release channel c2;
Release channel c3;
Release channel c4;
}
 
4. Simulate data
SQL> connect scott/scott
SQL> create table tb_test
(
Id number,
Remark varchar2 (30 ),
Create_time date default sysdate
);
Table created.
SQL> connect/as sysdba
Write the first record and generate archive log 1
SQL> insert into scott. tb_test values (1, 'First switchover ', sysdate );
SQL> commit;
SQL> alter system switch logfile;
Archive log 1 is generated at this time.
[Oracle @ hxl 2012_07_06] $ ls
O1_mf_000000007zfx44j4 _. arc
Write the second record and generate archive log 2
SQL> insert into scott. tb_test values (2, 'second failed', sysdate );
SQL> commit;
SQL> alter system switch logfile;
Archive log 2 is generated at this time.
[Oracle @ hxl 2012_07_06] $ ls-1
O1_mf_000000007zfx44j4 _. arc
O1_mf_1_2_7zfxmbq9 _. arc
Write the third record and generate archive log 3
SQL> insert into scott. tb_test values (3, 'third failed', sysdate );
SQL> commit;
SQL> alter system switch logfile;
Archive log 3 is generated at this time.
[Oracle @ hxl 2012_07_06] $ ls-1
O1_mf_000000007zfx44j4 _. arc
O1_mf_1_2_7zfxmbq9 _. arc
O1_mf_1_3_7zfy5jnz _. arc
Write article 4 Record and generate archive log 4
SQL> insert into scott. tb_test values (4, 'Fourth failed', sysdate );
SQL> commit;
SQL> alter system switch logfile;
Archive log 4 is generated at this time.
[Oracle @ hxl 2012_07_06] $ ls-1
O1_mf_000000007zfx44j4 _. arc
O1_mf_1_2_7zfxmbq9 _. arc
O1_mf_1_3_7zfy5jnz _. arc
O1_mf_00004_7zfyth7x _. arc
 
5. We use Incomplete recovery to restore the time point at which the archive log is generated, and record the time point '2017-07-06 22:50:00'
[Oracle @ hxl 2012_07_06] $ ls-al
Total 14264
Drwxr-x --- 2 oracle oinstall 4096 Jul 6.
Drwxr-x --- 11 oracle oinstall 4096 Jul 6 ..
-Rw-r ----- 1 oracle oinstall 9038848 Jul 6 o%mf_%%7zfx44j4 _. arc
-Rw-r ----- 1 oracle oinstall 5408256 Jul 6 o1_mf_1_2_7zfxmbq9 _. arc
-Rw-r ----- 1 oracle oinstall 41984 Jul 6 o1_mf_1_3_7zfy5jnz _. arc
-Rw-r ----- 1 oracle oinstall 45568 Jul 6 o1_mf_1_4_7zfyth7x _. arc

  • 1
  • 2
  • Next Page

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.