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 |