Lesson 6 | Recreating Redo Log Files |
Objective | Describe the Steps to recreate Inactive Redo Logs |
SELECT GROUP_ID, MEMBER, STATUS FROM V$LOGFILE;
ALTER SYSTEM DROP REDO LOGFILE group <group_id>;
ALTER DATABASE ADD LOGFILE group <group_id> ('<logfile_path1>','<logfile_path2>') SIZE <logfile_size>;
ALTER SYSTEM SWITCH LOGFILE group <group_id>;
ALTER SYSTEM CHECKPOINT GLOBAL;
ALTER DATABASE CLEAR LOGFILE
command drops and recreates the corrupt online redo file, but you can also perform this process manually. It's a helpful procedure to know if the ALTER DATABASE CLEAR LOGFILE
command fails and reusing the currently configured log file name to recreate the log file becomes impossible. You may preview all the steps below.
SQL> select b.group#, a.status, b.status, b.member from v$log a, v$logfile b where a.group#=b.group# order by 1,2;
Add one member to each redo log group. Query all redo log members and their status:
GROUP# STATUS MEMBER ---- ------------ -------------------------------- 1 CURRENT /u01/oracle/product/10.2.0/db_1/ora data/testdb/redo01.log 2 INACTIVE /u01/oracle/product/10.2.0/db_1/ora data/testdb/redo02.log 3 ACTIVE /u01/oracle/product/10.2.0/db_1/ora data/testdb/redo03.log
The following series of images demonstrates how to perform an inactive redo log recovery.
SQL> STARTUP OPEN PFILE='C:\ORANT\DATABASE\INITORCL.ORA' ORACLE instance started. Total System Global Area 11710464 bytes Fixed Size 49152 bytes Variable Size 11177984 bytes Database Buffers 409600 bytes Redo Buffers 73728 bytes Database mounted. ORA-00313: open failed for members of log group 3 of thread 1 ORA-00312: online log 3 thread 1: 'C:\ORANT\DATABASE\LOG2ORCL.ORA' SQL> SELECT * FROM V$LOGFILE; GROUP# STATUS MEMBER ------ ------- ---------------------------------------------- 1 C:\ORANT\DATABASE\LOG4ORCL.ORA 2 STALE C:\ORANT\DATABASE\LOG3ORCL.ORA 3 STALE C:\ORANT\DATABASE\LOG2ORCL.ORA 4 C:\ORANT\DATABASE\LOG1ORCL.ORA 4 rows selected. SQL> ALTER DATABASE DROP LOGFILE GROUP 3; Statement processed. SQL> ALTER DATABASE ADD LOGFILE GROUP 3 'C:\ORANT\DATABASE\LOG2ORCL.ORA' SIZE 150k; Statement processed. SQL> ALTER DATABASE OPEN; Statement processed. SQL>