Redo日志是分组的,一个库至少需要两组,默认是三组。每个组内的redo日志称为成员。默认情况下,每个组只有一个成员,这样没有冗余性,可能造成online redo log的丢失,要提高数据的可靠性,应该为两个组至少配置两个成员,交将这两个成员分配到不同的磁盘上。
Redo日志是轮流使用的,一个redo log满了,LGWR会切换到下一组redo log,这种操作称为log switch,做log switch的同时也会做checkpoint,相应的信息还会写入控制文件。
也可以手工执行log switch或checkpoint操作
代码如下 | 复制代码 |
SQL> alter system switch logfile; System altered. SQL> alter system checkpoint; System altered. |
查看系统的redo log信息:
代码如下 | 复制代码 |
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 |
可以在线添加online redo log组:
代码如下 | 复制代码 |
SQL> alter database add logfile group 4 (‘/oradata/redo/redo04.log’) size 100m; Database altered. SQL> select member from v$logfile; MEMBER |
可以在线添加online redo log组成员:
代码如下 | 复制代码 |
SQL> alter database add logfile member ‘/oradata/redo/redo0a.log’ to group 1; Database altered. sys@SKDHC>select member from v$logfile; MEMBER 6 rows selected. |
在线删除刚才添加的组和组成员:
代码如下 | 复制代码 |
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 |