Recovery when online logs are corrupted (shut down the database normally)

Source: Internet
Author: User

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

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.