0% found this document useful (0 votes)
4 views

Log_Files

Redo log files in Oracle are essential for recording all changes made to the database, ensuring that changes can be redone in case of a crash. Each database must have at least two redo log files, which can be in various states such as CURRENT, ACTIVE, INACTIVE, and UNUSED. The document also provides SQL commands for managing redo log groups and members, including adding, dropping, and dynamically creating log files.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Log_Files

Redo log files in Oracle are essential for recording all changes made to the database, ensuring that changes can be redone in case of a crash. Each database must have at least two redo log files, which can be in various states such as CURRENT, ACTIVE, INACTIVE, and UNUSED. The document also provides SQL commands for managing redo log groups and members, including adding, dropping, and dynamically creating log files.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

REDOLOG FILES.

Whenever something changes in a data file, Oracle records


the change in the redo log. The name redo log indicates its
purpose, if the database crashes, the RDBMS can redo all
changes.
REDOLOG FILES.

What are Redo log files?

A set of files that record all changes made to an Oracle database. The LGWR process writes
information from redo log buffer to the redo log files. A database MUST have at least two
redo log files. Log files can be multiplexed on multiple disks to ensure that they will not get
lost.

Redo log file have different states:

CURRENT: Redo records are currently being written to the group.Only one group is current at a time.

ACTIVE: Redo group that contains redo's of a dirty buffer (not yet committed transaction).

INACTIVE: log that can be overwritten.

UNUSED: initial state after creation, when it's still empty.

LGWR writes both uncommitted and committed transactions from the log buffer to the online
redo log files under below conditions:

 COMMIT
 1/3 Redo buffer is full.
 1MB of new redo in the log buffer.
 Every 3 seconds.
 Before DBWR writes to the database files.

1
REDOLOG FILES.

1. Check for Log groups and Members:-

select GROUP#,SEQUENCE#,MEMBERS,STATUS,ARCHIVED from v$log;

2. List of members in each group:-

select member,group# from v$logfile;

3. Adding Log Group:--

alter database add logfile group 8 '/u01/app/oracle/oradata/chetan/redo08.log' size 10m;

4. Check for the New member added :-


If you observe status for new member is UNUSED.

select MEMBERS,GROUP#,BYTES/1024/1024,STATUS from v$log;

2
REDOLOG FILES.
5. Adding Member:--

alter database add logfile member '/u01/app/oracle/oradata/chetan/redo09.log' to group 8;

select GROUP#,MEMBERS,BYTES/1024/1024 from v$log;


If you observe, if need not to specify for size of member when adding to Log group. By default it
will take the size of existing member, as all members in a Log group should be indentical.

6. Dropping Group:-

alter database drop logfile member '/u01/app/oracle/oradata/chetan/redo09.log';

Point to remember over here is, when log member is dropped it is removed from Database
but you need to physically drop it at OS level.

select MEMBER,GROUP# from v$logfile;

3
REDOLOG FILES.

As you can see, redo file is present at OS level, remove it Manually!!!!

7. Create logfile members dynamically. (O.M.F)

SQL>alter system set db_create_online_log_dest_1='/u01/app/oracle/oradata/chetan';


SQl>alter system set db_create_online_log_dest_2='/u01/app/oracle/oradata/chetan';
SQL>alter system set db_create_online_log_dest_3='/u01/app/oracle/oradata/chetan';

Here you can see, currently we have 4 members in 4 Groups.

4
REDOLOG FILES.

Now, you created one log group without specifying any member details. In this scenario if your
DB_CREATE_ONLINE_LOG_DEST_n is set , Oracle will take care for new members location as well
as naming convention.

alter database add logfile group 4;

In below output , you can see 3 members are created as our 3 destinations were set.
DB_CREATE_ONLINE_LOG_DEST_1 , DB_CREATE_ONLINE_LOG_DEST_2 and
DB_CREATE_ONLINE_LOG_DEST_3 .Also name is dynamically allocated by oracle.

select MEMBEr,GROUP# from v$logfile;

========================================================================

You might also like