添加redo日志组和添加日志组多元化
- 查看redo日志组的状态和日志的位置.
SQL>select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCSTATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
-------------------- ---------- ---------- ---------- ---------- --- ----------------------------- ------------ ------------ ------------
1 1 58 52428800 512 1NO CURRENT 116662724-JAN-16 2.8147E+14
2 1 56 52428800 512 1YES INACTIVE 113719619-JAN-16 1166195 24-JAN-16
3 1 57 52428800 512 1YES INACTIVE 116619524-JAN-16 1166627 24-JAN-16
SQL>select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
----------------- ------- -------------------------------------------------- ---
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO
4 STANDBY/u01/app/oracle/oradata/orcl/standby/slog1.rdo NO
5 STANDBY/u01/app/oracle/oradata/orcl/standby/slog2.rdo NO
6 STANDBY/u01/app/oracle/oradata/orcl/standby/slog3.rdo NO
7 STANDBY/u01/app/oracle/oradata/orcl/standby/slog4.rod NO
- 建立系统要存放日志组的路径.
mkdir -p /u01/app/oracle/redo
chmod -R 755 /u01/app/oracle/redo
3.建立redo日志组8
SQL> alter database add logfile group 8(‘/u01/app/oracle/redo/redo04.log‘)size 50m;
Database altered.
- 给每个redo日志组建立多元化.
SQL> alter database add logfile member‘/u01/app/oracle/oradata/orcl/redo011.log‘ to group 1;
SQL> alter database add logfile member‘/u01/app/oracle/oradata/orcl/redo022.log‘ to group 2;
SQL> alter database add logfile member‘/u01/app/oracle/oradata/orcl/redo033.log‘ to group 3;
- 查看redo的状态,组合4没有被使用,所以切几次日志,组合4已生效.
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCSTATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ------------- ---------------- ------------- ------------ ------------ ------------
1 1 62 52428800 512 2NO CURRENT 117665425-JAN-16 2.8147E+14
2 1 60 52428800 512 2YES INACTIVE 117661925-JAN-16 1176640 25-JAN-16
3 1 61 52428800 512 2YES INACTIVE 117664025-JAN-16 1176654 25-JAN-16
8 1 59 52428800 512 1YES INACTIVE 117659925-JAN-16 1176619 25-JAN-16
SQL> alter system switch logfile;
System altered.
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- --------------------------------------------------------- ---
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO
4 STANDBY/u01/app/oracle/oradata/orcl/standby/slog1.rdo NO
5 STANDBY/u01/app/oracle/oradata/orcl/standby/slog2.rdo NO
6 STANDBY/u01/app/oracle/oradata/orcl/standby/slog3.rdo NO
7 STANDBY/u01/app/oracle/oradata/orcl/standby/slog4.rod NO
8 ONLINE /u01/app/oracle/redo/redo04.log NO
1 INVALID ONLINE /u01/app/oracle/oradata/orcl/redo011.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo022.log NO
3 ONLINE /u01/app/oracle/oradata/orcl/redo033.log NO
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
- 查看redo日志组的多元化.
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- --------------------------------------------------------- ---
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO
4 STANDBY/u01/app/oracle/oradata/orcl/standby/slog1.rdo NO
5 STANDBY/u01/app/oracle/oradata/orcl/standby/slog2.rdo NO
6 STANDBY/u01/app/oracle/oradata/orcl/standby/slog3.rdo NO
7 STANDBY/u01/app/oracle/oradata/orcl/standby/slog4.rod NO
8 ONLINE /u01/app/oracle/redo/redo04.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo011.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo022.log NO
3 ONLINE /u01/app/oracle/oradata/orcl/redo033.log NO