来自 技术 2019-04-25 00:00 的文章

如何增加日志组成员到既有日志组?

开发四年只会写业务代码,分布式高并发都不会还想去BAT?>>>   

比如:

我们目前系统中有以下日志组:

SQL> select group#,sequence#,members,status ,archivedfrom v$log;

GROUP# SEQUENCE# MEMBERS STATUS ARC

---

1 28 1 CURRENT NO

2 26 1 INACTIVE YES

3 27 1 INACTIVE YES

发现每组都只有一个成员,我们想手工增加一个文件到既有组上去:

1* select group#,member from v$logfile

GROUP# MEMBER

3 /oracle/app/oracle/oradata/sztech1/redo03.log

2 /oracle/app/oracle/oradata/sztech1/redo02.log

1 /oracle/app/oracle/oradata/sztech1/redo01.log

我们给组一增加一个镜像成员,方法如下:

alterdatabaseadd logfile member '/oracle/app/oracle/oradata/sztech1/redo01b.log' to group 1;

之后,我们再查询,文件应该增加上去:

1* select group#,member from v$logfile

GROUP# MEMBER

3 /oracle/app/oracle/oradata/sztech1/redo03.log

2 /oracle/app/oracle/oradata/sztech1/redo02.log

1 /oracle/app/oracle/oradata/sztech1/redo01.log

1 /oracle/app/oracle/oradata/sztech1/redo01b.log

SQL> select group#,sequence#,members ,status ,archivedfrom v$log;

GROUP#SEQUENCE#MEMBERSSTATUS ARC

---

1 28

2 CURRENT NO

2 26 1 INACTIVE YES

3 27 1 INACTIVE YES

至此,日志组成员增加上去了.