Thursday, January 17, 2013

ORACLE - Redolog files

Oracle logfile day-to-day task:

1) Check logfile information:
SQL> select GROUP#, THREAD#, MEMBERS, STATUS from v$log;
    GROUP#    THREAD#    MEMBERS STATUS
---------- ---------- ---------- ----------------
         1          1          1 INACTIVE
         2          1          1 INACTIVE
         3          1          1 CURRENT


SQL>select member from v$logfile;
MEMBER
-------------------------------------------
/u01/app/oracle/oradata/JDB/redo03.log
/u01/app/oracle/oradata/JDB/redo02.log
/u01/app/oracle/oradata/JDB/redo01.log


2) Add new loggroup/logfiles before drop old logfiles:
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 4 ('+JDATA1') SIZE 500M;
or
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 5 ('+JDATA1',''+FRA') SIZE 500M;
or
ALTER DATABASE ADD LOGFILE THREAD 1
 GROUP 2 ('+JDATA1','+FRA') SIZE 500M,
 GROUP 3 ('+JDATA1','+FRA') SIZE 500M;
or
Use Grid control


3)Drop INACTIVE or UNUSED logfiles:
SQL> select group#,status from v$log;
    GROUP# STATUS
---------- ------------
         1 INACTIVE        [candidate for drop]
         2 INACTIVE       [candidate for drop]
         3 ACTIVE           [wait or alter system switch logfile;]
         4 ACTIVE          [ORA-01624 - needed crash recovery]
         5 CURRENT      [ORA-01623 - cannot drop]
         6 UNUSED


Use switch logfile command to chnage the status of logfiles and drop only INACTIVE logfile.

4) Oracle error messages for drop ACTIVE and CURRENT logfiles:
1)alter database drop logfile group 3
*
ERROR at line 1:
ORA-01624: log 3 needed for crash recovery of instance JDB (thread 1)
ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/JDB/redo03.log'

2)alter database drop logfile group 5
*
ERROR at line 1:
ORA-01623: log 5 is current log for instance JDB (thread 1) - cannot drop
ORA-00312: online log 5 thread 1: '/u01/app/oracle/oradata/JDB/redo05.log'

No comments:

Post a Comment