查看redo日志组的状态和日志的位置.
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCSTATUS FIRST_CHANGE#FIRST_TIME NEXT_CHANGE# NEXT_TIME
-------------------- ---------- ---------- ---------- ---------- --- ----------------------- ------------ ------------ ------------
1 1 10 52428800 512 1YES INACTIVE 102400224-NOV-15 1026535 24-NOV-15
2 1 11 52428800 512 1YES ACTIVE 102653524-NOV-15 1039876 27-NOV-15
3 1 12 52428800 512 1NO CURRENT 1039876 27-NOV-15 2.8147E+14
SQL> col memberfor a50
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- -------------- ---------------------------------------- ---
3 ONLINE /u01/apps/oracle/oradata/orcl/redo03.log NO
2 ONLINE /u01/apps/oracle/oradata/orcl/redo02.log NO
1 ONLINE /u01/apps/oracle/oradata/orcl/redo01.log NO
建立系统要存放日志组的路径.
SQL> !mkdir -p/u01/apps/oracle/oradata/orcl/redo
SQL> alter database add logfile group4('/u01/apps/oracle/oradata/orcl/redo/redo04.log') size 50M;
Database altered.
给每个redo日志组建立多元化.
SQL> alter database add logfilemember '/u01/apps/oracle/oradata/orcl/redo/redo011.log' to group 1;
Databasealtered.
SQL> alter database add logfilemember '/u01/apps/oracle/oradata/orcl/redo/redo022.log' to group 2;
Databasealtered.
SQL> alter database add logfilemember '/u01/apps/oracle/oradata/orcl/redo/redo033.log' to group 3;
Databasealtered.
SQL> alter database add logfilemember '/u01/apps/oracle/oradata/orcl/redo/redo044.log' to group 4;
Databasealtered.
查看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 10 52428800 512 2YES INACTIVE 102400224-NOV-15 1026535 24-NOV-15
2 1 11 52428800 512 2YES INACTIVE 102653524-NOV-15 1039876 27-NOV-15
3 1 12 52428800 512 2NO CURRENT 103987627-NOV-15 2.8147E+14
4 1 0 52428800 512 2YES UNUSED 0 0
SQL>select * fromv$logfile;
GROUP# STATUS TYPE MEMBER IS_
----------------- ------- -------------------------------------------------- ---
3 ONLINE /u01/apps/oracle/oradata/orcl/redo03.log NO
2 ONLINE /u01/apps/oracle/oradata/orcl/redo02.log NO
1 ONLINE /u01/apps/oracle/oradata/orcl/redo01.log NO
4 ONLINE /u01/apps/oracle/oradata/orcl/redo/redo04.log NO
1 INVALID ONLINE /u01/apps/oracle/oradata/orcl/redo/redo011.log NO
2 INVALID ONLINE /u01/apps/oracle/oradata/orcl/redo/redo022.log NO
3 INVALID ONLINE /u01/apps/oracle/oradata/orcl/redo/redo033.log NO
4 INVALID ONLINE /u01/apps/oracle/oradata/orcl/redo/redo044.log NO
SQL>alter systemswitch logfile;
Systemaltered.
SQL>/
Systemaltered.
SQL>/
Systemaltered.
SQL>/
Systemaltered.
查看日志组多元化
SQL>select * fromv$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCSTATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
-------------------- ---------- ---------- ---------- ---------- --- ----------------------------- ------------ ------------ ------------
1 1 14 52428800 512 2YES INACTIVE 104102627-NOV-15 1041029 27-NOV-15
2 1 15 52428800 512 2YES INACTIVE 104102927-NOV-15 1041037 27-NOV-15
3 1 16 52428800 512 2NO CURRENT 104103727-NOV-15 2.8147E+14
4 1 13 52428800 512 2YES INACTIVE 104100727-NOV-15 1041026 27-NOV-15
SQL>select * fromv$logfile;
GROUP# STATUS TYPE MEMBER IS_
----------------- ------- -------------------------------------------------- ---
3 ONLINE /u01/apps/oracle/oradata/orcl/redo03.log NO
2 ONLINE /u01/apps/oracle/oradata/orcl/redo02.log NO
1 ONLINE /u01/apps/oracle/oradata/orcl/redo01.log NO
4 ONLINE /u01/apps/oracle/oradata/orcl/redo/redo04.log NO
1 ONLINE /u01/apps/oracle/oradata/orcl/redo/redo011.log NO
2 ONLINE /u01/apps/oracle/oradata/orcl/redo/redo022.log NO
3 ONLINE /u01/apps/oracle/oradata/orcl/redo/redo033.log NO
4 ONLINE /u01/apps/oracle/oradata/orcl/redo/redo044.log NO