Oracle Database log redo log work notes

Source: Internet
Author: User

Oracle Database logs are called redo logs. All data changes are recorded in redo logs, which can be used to repair damaged databases. Large Databases use logs. The benefits of this design are the same.

Redo logs are grouped. A database must have at least two groups. By default, there are three groups. The redo logs in each group are called members. By default, each group has only one member, which is not redundant and may cause loss of online redo logs. To improve data reliability, you should configure at least two members for the two groups, allocate the two members to different disks.

Redo logs are used in turn. When a redo log is full, LGWR switches to the next redo log group. This operation is called a log switch, which also performs checkpoint, the corresponding information is also written into the control file.

You can also manually perform log switch or checkpoint operations

The Code is as follows: Copy code

SQL> alter system switch logfile;

System altered.

SQL> alter system checkpoint;

System altered.

View the redo log information of the system:

The Code is as follows: Copy code

SQL> select l. group #, l. sequence #, l. bytes, l. members, l. status, f. member from v $ log l, v $ logfile f where l. GROUP # = f. GROUP #

GROUP # SEQUENCE # BYTES MEMBERS STATUS MEMBER
----------------------------------
1 43 104857600 1 INACTIVE/oradata/redo/redo01.log
2 44 104857600 1 INACTIVE/oradata/redo/redo02.log
3 45 104857600 1 CURRENT/oradata/redo/redo03.log

You can add online redo log groups online:

The Code is as follows: Copy code

SQL> alter database add logfile group 4 ('/oradata/redo/redo04.log') size 100 m;

Database altered.

SQL> select member from v $ logfile;

MEMBER
---------------------------
/Oradata/redo/redo03.log
/Oradata/redo/redo02.log
/Oradata/redo/redo01.log
/Oradata/redo/redo04.log

You can add online redo log members online:

The Code is as follows: Copy code

SQL> alter database add logfile member '/oradata/redo/redo0a. log' to group 1;

Database altered.

Sys @ SKDHC> select member from v $ logfile;

MEMBER
------------
/Oradata/redo/redo01.log
/Oradata/redo/redo02.log
/Oradata/redo/redo03.log
/Oradata/redo/redo0a. log
/Oradata/redo/redo0b. log
/Oradata/redo/redo0c. log

6 rows selected.

Delete groups and group members online:

The Code is as follows: Copy code

SQL> alter database drop logfile group 4;

Database altered.

SQL> alter database drop logfile member '/oradata/redo/redo0c. log;

Database altered.

SQL> select member from v $ logfile;

MEMBER
---------------------------
/Home/oracle/oradata/gldb/redo03.log
/Home/oracle/oradata/gldb/redo02.log
/Home/oracle/oradata/gldb/redo01.log

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.