Resizing Log File
Resizing Log File
Before looking at the tasks involved to perform the re-size, let's look at the current online redo log groups and their sizes:
SQL> SELECT a.group#,b.members,a.member,b.bytes FROM v$logfile a, v$log b WHERE a.group# = b.group#;
GROUP# -------1 2 3 MEMRES -------1 1 1 MEMBER ---------------------------------------------------/u01/app/oracle/product/10.2.0/db_1/mydb/redo01.log /u01/app/oracle/product/10.2.0/db_1/mydb/redo02.log /u01/app/oracle/product/10.2.0/db_1/mydb/redo03.log BYTES --------52428800 52428800 52428800
Step 1: Make the last redo log CURRENT Force a log switch until the last redo log is marked "CURRENT" by issuing the following command:
SQL> select group#, status from v$log; GROUP# STATUS ---------- ---------------1 CURRENT 2 INACTIVE 3 INACTIVE SQL> alter system switch logfile; SQL> alter system switch logfile; SQL> select group#, status from v$log; GROUP# ---------1 2 3 STATUS ---------------INACTIVE INACTIVE CURRENT
Step 2: Drop first redo log After making the last online redo log file the CURRENT one, drop the first online redo log:
SQL> alter database drop logfile group 1; Database altered.
SQL> SELECT a.group#, a.member, b.bytes FROM v$logfile a, v$log b WHERE a.group# = b.group#; GROUP# ---------2 3 MEMBER BYTES ------------------------------------------------------- ---------/u01/app/oracle/product/10.2.0/db_1/mydb/redo02.log 52428800 /u01/app/oracle/product/10.2.0/db_1/mydb/redo03.log 52428800 SQL> select group#, status from v$log; GROUP# ---------2 3 Note: STATUS ---------------INACTIVE CURRENT
If you are going to drop a logfile group, it cannot be the current logfile group. I have run into instances; however, where attempting to drop the logfile group resulted in the following error as a result of the logfile group having an active status:
SQL> ALTER DATABASE DROP LOGFILE GROUP 1; ALTER DATABASE DROP LOGFILE GROUP 1 * ERROR at line 1: ORA-01624: log 1 needed for crash recovery of instance ORA920 (thread 1) ORA-00312: online log 1 thread 1: '/u01/app/oracle/product/10.2.0/db_1/mydb/redo01.log'
Step 3: Re-create dropped online redo log group Re-create the dropped redo log group with different size.
SQL> alter database add logfile group 1 ('/u01/app/oracle/product/10.2.0/db_1/mydb/redo011.log', '/u01/app/oracle/product/10.2.0/db_1/mydb/redo012.log') size 100M;
Step 4: Force another log switch After re-creating the online redo log group, force a log switch. The online redo log group just created should become the "CURRENT" one:
SQL> select group#, status from v$log; GROUP# ---------1 2 3 STATUS ---------------UNUSED INACTIVE CURRENT
SQL> alter system switch logfile; SQL> select group#, status from v$log; GROUP# ---------1 2 3 STATUS ---------------CURRENT INACTIVE ACTIVE
Step 5: Loop back to until all logs are rebuilt After re-creating an online redo log group, continue to re-create (or resize) all online redo log groups until all of them are rebuilt. After rebuilding (resizing) all online redo log groups, here is a snapshot of all physical files:
SQL> SELECT a.group#, a.member, b.bytes FROM v$logfile a, v$log b WHERE a.group# = b.group#; GROUP# ---------1 2 1 2 MEMBER SIZE_MB ------------------------------------------------------- ---------/u01/app/oracle/product/10.2.0/db_1/mydb/redo011.log 100 /u01/app/oracle/product/10.2.0/db_1/mydb/redo021.log 100 /u01/app/oracle/product/10.2.0/db_1/mydb/redo012.log 100 /u01/app/oracle/product/10.2.0/db_1/mydb/redo022.log 100