Redo log files for storage structure
the
Redo log files can be divided into online redo log files and archived redo log files. It is a database transaction log. The purpose is to recover committed transactions in case of failure. Almost every operation you complete in oracle will generate some redo information and write it to the online redo log file. www.2cto.com
the
When the host is powered off, you can use the online redo log files to restore the system to the moment before the power failure; when the disk is damaged, you can use the archived redo log files to restore to the appropriate point in time; When some important information is submitted, you can also use them to help you recover to the moment before the accidental deletion.
the
“Before reusing the redo log, the contents of the redo log file should not be needed at the time of failure.” If Oracle is not sure of this, it will temporarily suspend the database, establish a checkpoint, and save the redo-protected data in the buffer cache Safely write to disk. Oracle does not write the modified data in database_buffer_cache to disk. On the contrary, it flushes the redo entry in the redo log buffer to the online redo log file. As long as the modified block is cached but not written to disk, when the database fails, the contents of the log file need to be redoed, but the redo log file cannot be reused. For example, when the log is full, when log 1 is filled but switched to log 2, DBWn will establish a checkpoint and write all dirty blocks protected by log 1 to disk. Before that, oracle cannot reuse this log file. Otherwise, it will be reported in the alert log that the checkpoint is not completed. When this message appears, the database hangs, and DBWn is busy completing the checkpoint it established.
the
For each oracle database, the way to disperse risks is to set up 3-way disk channels. What should I pay attention to in the setting of each channel? Mainly start with several factors such as peak load, average recovery time, and a large number of users modifying the same block.
1) Number of log groups?
Too few events to wait for
2) Log member size?
If it is too small, it will be changed frequently, resulting in checkpoints and low performance; if it is too large, it will be unsafe, and the data will be stored in one place
3) Are the members symmetrical?
Members should be set to the same size, and the number of mirrors should be the same. Otherwise, the algorithm will jitter violently. (Note, here should be, not necessarily)
Determine how many log groups there are?
SQL> select group# from v$log;
the
GROUP#
———-
1
2
3
How many mirrors are there?
SQL> select member from v$logfile;
the
MEMBER www.2cto.com
————————————————– ——————————
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_3_7xzskcdd_.log
/u01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_3_7xzskh9o_.log
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_2_7xzsk47l_.log
/u01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_2_7xzsk7of_.log
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_1_7xzsjx1g_.log
/u01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_1_7xzsk0ph_.log
the
Add a log group? If you use OMF, after adding a group, oracle will automatically add members for you.
alter database add logfile group 4(‘filename’, ‘filename’) size 100;
like:
SQL> alter database add logfile group 4 size 100m;
the
Database altered.
the
SQL> select group# from v$log;
the
GROUP#
———-
1
2
3
4
the
When deleting, replace add with drop. The current redo log file cannot be deleted. To delete it, you can use alter system switch logfile. After deletion, the files of the operating system still exist (except OMF), and it will be relatively clean to delete all the files on the operating system.
www.2cto.com
How to add a member?
alter database add logfile member
& # 39; filename & # 39; to group 1,
'filename' to group 2,
'filename' to group 3;
the
The status of the newly added group is unused.
SQL> select group#,bytes/1024/1024 m from v$log;
the
GROUP# M
———- ———-
1 50
2 50
3 50
the
SQL> alter database add logfile group 5 size 50m;
the
Database altered.
the
SQL> select group#,status from v$log;
the
GROUP# STATUS
———- —————-
1 INACTIVE
2 CURRENT
3 INACTIVE
5 UNUSED
the
There are several states of log members, which are explained a little here:
active: Overwritten by the RBA pointer, but not written in it. RBA moves away, it is inactive.
current: Overwritten by the RBA pointer, but being written.
inactive: Indicates that this group of redo log files is no longer needed for instance recovery.
unused: Indicates that oracle has never used the redo log file group.
The log will be active.
www.2cto.com
If there is only one member in the group, there is no difference between the concept of group and member. Groups are members, and members are groups. In short, the group is changed, and the group is mirrored.
The server process is responsible for writing the redo entry to the redo log buffer, and LGWR is responsible for flushing the redo entry to the online redo log file. So when will LGWR write it?
1) Every 3 seconds
2) 1/3 full
3) 1M redo entry
4) commit
5) Write before DBWn write
the
the
Author linwaterbin
Redo log files for storage structure
This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/redo-log-files-for-storage-structure/