时间:2021-07-01 10:21:17 帮助过:30人阅读
参考文档:http://www.eygle.com/digest/2010/10/oracle_dataguard_redo_changing.html Metalink 473442.1 号文档 近期客户的DATAGUARD环境中主库出现有 checkpoint not complete警告,当前系统只有3组REDO大小各100M,需要增加REDO日志组。 1.在主库和备库设
参考文档:http://www.eygle.com/digest/2010/10/oracle_dataguard_redo_changing.html在备库上开启日志应用:
SQL> alter database recover managed standby database disconnect from session;删除日志组就是以上步骤,把增加处换成删除
--注意主库CURRENT状态的日志组不能删,可以先手动切换,再删除;
--在备库上CLEARING_CURRENT状态的日志了不能删除,需要通过开启、关闭恢复应用来切换当前日志组,不要手动切换。
主库上删除日志组成员
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- --------------------------------------------------
1 /u01/app/oracle/prod/disk1/redo01.log
2 /u01/app/oracle/prod/disk1/redo02.log
3 /u01/app/oracle/prod/disk1/redo03.log
4 /u01/app/oracle/prod/disk1/standbylog1.log
5 /u01/app/oracle/prod/disk1/standbylog2.log
6 /u01/app/oracle/prod/disk1/standbylog3.log
7 /u01/app/oracle/prod/disk1/standbylog4.log
1 /u01/app/oracle/prod/disk2/log1b.log
2 /u01/app/oracle/prod/disk2/log2b.log
3 /u01/app/oracle/prod/disk2/log3b.log
10 rows selected.
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log2b.log';
alter database drop logfile member '/u01/app/oracle/prod/disk2/log2b.log'
*
ERROR at line 1:
ORA-01609: log 2 is the current log for thread 1 - cannot drop members
ORA-00312: online log 2 thread 1: '/u01/app/oracle/prod/disk1/redo02.log'
ORA-00312: online log 2 thread 1: '/u01/app/oracle/prod/disk2/log2b.log'
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log3b.log';
Database altered.
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log1b.log';
Database altered.
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- --------------------------------------------------
1 /u01/app/oracle/prod/disk1/redo01.log
2 /u01/app/oracle/prod/disk1/redo02.log
3 /u01/app/oracle/prod/disk1/redo03.log
4 /u01/app/oracle/prod/disk1/standbylog1.log
5 /u01/app/oracle/prod/disk1/standbylog2.log
6 /u01/app/oracle/prod/disk1/standbylog3.log
7 /u01/app/oracle/prod/disk1/standbylog4.log
2 /u01/app/oracle/prod/disk2/log2b.log
8 rows selected.
SQL> alter system switch logfile;
System altered.
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log2b.log';
Database altered.
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- --------------------------------------------------
1 /u01/app/oracle/prod/disk1/redo01.log
2 /u01/app/oracle/prod/disk1/redo02.log
3 /u01/app/oracle/prod/disk1/redo03.log
4 /u01/app/oracle/prod/disk1/standbylog1.log
5 /u01/app/oracle/prod/disk1/standbylog2.log
6 /u01/app/oracle/prod/disk1/standbylog3.log
7 /u01/app/oracle/prod/disk1/standbylog4.log
7 rows selected.
SQL> show parameter standby
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
standby_archive_dest string ?/dbs/arch
standby_file_management string AUTO
SQL> alter system switch logfile;
System altered.
##########################################
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CLEARING_CURRENT
3 CLEARING
2 CLEARING
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> select group#,member,status from v$logfile;
GROUP# MEMBER STATUS
---------- -------------------------------------------------- -------
1 /u01/app/oracle/prod/disk1/redo01.log
2 /u01/app/oracle/prod/disk1/redo02.log
3 /u01/app/oracle/prod/disk1/redo03.log
4 /u01/app/oracle/prod/disk1/standbylog1.log
5 /u01/app/oracle/prod/disk1/standbylog2.log
6 /u01/app/oracle/prod/disk1/standbylog3.log
7 /u01/app/oracle/prod/disk1/standbylog4.log
1 /u01/app/oracle/prod/disk2/log1b.log
2 /u01/app/oracle/prod/disk2/log2b.log
3 /u01/app/oracle/prod/disk2/log3b.log
10 rows selected.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CLEARING_CURRENT
3 CLEARING
2 CLEARING
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log2b.log';
alter database drop logfile member '/u01/app/oracle/prod/disk2/log2b.log'
*
ERROR at line 1:
ORA-01275: Operation DROP LOG MEMBER is not allowed if standby file management
is automatic.
SQL> show parameter standby
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
standby_archive_dest string ?/dbs/arch
standby_file_management string AUTO
SQL> alter system set standby_file_management='manual';
System altered.
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log2b.log';
Database altered.
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log1b.log';
alter database drop logfile member '/u01/app/oracle/prod/disk2/log1b.log'
*
ERROR at line 1:
ORA-01609: log 1 is the current log for thread 1 - cannot drop members
ORA-00312: online log 1 thread 1: '/u01/app/oracle/prod/disk1/redo01.log'
ORA-00312: online log 1 thread 1: '/u01/app/oracle/prod/disk2/log1b.log'
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log3b.log';
Database altered.
SQL> alter database recover managed standby database disconnect from session; --通过开启恢复应用来切换当前日志组,不要手动切换。
Database altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CLEARING_CURRENT
3 CLEARING
2 CLEARING
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CLEARING
3 CLEARING_CURRENT
2 CLEARING
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log1b.log';
alter database drop logfile member '/u01/app/oracle/prod/disk2/log1b.log'
*
ERROR at line 1:
ORA-01156: recovery in progress may need access to files ---取消恢复应用
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database drop logfile member '/u01/app/oracle/prod/disk2/log1b.log';
Database altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CLEARING
3 CLEARING_CURRENT
2 CLEARING
SQL>
SQL> select group#,member,status from v$logfile;
GROUP# MEMBER STATUS
---------- -------------------------------------------------- -------
1 /u01/app/oracle/prod/disk1/redo01.log
2 /u01/app/oracle/prod/disk1/redo02.log
3 /u01/app/oracle/prod/disk1/redo03.log
4 /u01/app/oracle/prod/disk1/standbylog1.log
5 /u01/app/oracle/prod/disk1/standbylog2.log
6 /u01/app/oracle/prod/disk1/standbylog3.log
7 /u01/app/oracle/prod/disk1/standbylog4.log
7 rows selected.
########
删除完成可以在主库上切换下日志看是否应用到备库,一般来说删除一个REDO日志MEMBER是没影响的。