1. Create a table T2 to insert two rows of data. If the first row of data is written into the archived log, the second row of data is in the online log.
SQL> create table t2 (
A1 number (10 ),
A2 char (10) tablespace users;
SQL> insert into t2 values (11, 'A ');
SQL> commit;
SQL> alter system switch logfile;
SQL> insert into t2 values (22, 'bb ');
SQL> commit;
2. query log files
SQL> select member from v $ logfile;
MEMBER
--------------------------------------------------------------------------------
/Database/ykg/ykg1a. log
/Database/ykg/ykg2a. log
3. Close the database normally
SQL> shutdown immediate
Database closed.
Database dismounted.
Oracle instance shut down.
4. Simulate online Log File Corruption
SQL> host rm-rf/database/ykg *. log
5. Database startup Error
SQL> startup
ORACLE instance started.
Total System Global Area 293601280 bytes
Fixed Size 2020392 bytes
Variable Size 92277720 bytes
Database Buffers 197132288 bytes
Redo Buffers 2170880 bytes
Database mounted.
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/database/ykg/ykg1a. Log'
6. view the SEQUENCE number of the current online log
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 191
Next log sequence to archive 192
Current log sequence 192
7. Pretend that the execution is not completely restored to restore the log Group
RMAN> run {
2> recover database until sequence 193 thread 1;
3> alter database open resetlogs ;}
8. Verify that the log member has been restored and the data is not lost.
SQL> select member from v $ logfile;
MEMBER
--------------------------------------------------------------------------------
/Database/ykg/ykg1a. log
/Database/ykg/ykg2a. log