alter database recover managed standby database cancel;
Database altered.
SQL> alter database add standby logfile group 11 (‘+DATA/orcldg/onlinelog/standby_group_11.log‘) size 60M;
alter database add standby logfile group 12 (‘+DATA/orcldg/onlinelog/standby_group_12.log‘) size 60M;
alter database add standby logfile group 13 (‘+DATA/orcldg/onlinelog/standby_group_13.log‘) size 60M;
alter database add standby logfile group 14 (‘+DATA/orcldg/onlinelog/standby_group_14.log‘) size 60M;
alter database add standby logfile group 15 (‘+DATA/orcldg/onlinelog/standby_group_15.log‘) size 60M;
alter database add standby logfile group 16 (‘+DATA/orcldg/onlinelog/standby_group_16.log‘) size 60M;
备库standby删除
alter database drop logfile group 5;
alter database drop logfile group 6;
alter database drop logfile group 7;
alter database drop logfile group 8;
alter database drop logfile group 9;
alter database drop logfile group 10;
主库redo添加
alter database add logfile thread 1 group 11 (‘+DATA/orcl/onlinelog/group_11.log‘) size 60m;
alter database add logfile thread 1 group 12 (‘+DATA/orcl/onlinelog/group_12.log‘) size 60m;
alter database add logfile thread 2 group 13 (‘+DATA/orcl/onlinelog/group_13.log‘) size 60m;
alter database add logfile thread 2 group 14 (‘+DATA/orcl/onlinelog/group_14.log‘) size 60m;
主库redo 删除
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
alter database drop logfile group 4;
备库redo添加
刚开始删除的时候可能报错,执行以下命令:
alter system set standby_file_management=‘manual‘;
然后删除
alter database add logfile group 5 (‘+DATA/orcldg/onlinelog/group_05.log‘) size 60m;
alter database add logfile group 6 (‘+DATA/orcldg/onlinelog/group_06.log‘) size 60m;
alter database add logfile thread 2 group 7 (‘+DATA/orcldg/onlinelog/group_07.log‘) size 60m;
alter database add logfile thread 2 group 8 (‘+DATA/orcldg/onlinelog/group_08.log‘) size 60m;
alter database clear logfile ‘+DATA/orcldg/onlinelog/group_2.272.862167353‘
备库redo删除
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
alter database drop logfile group 4;
--这种也是可以的
alter database add logfile member (‘+DATA/orcldg/onlinelog/group_2.273.862167353‘) size 60M reuse;
create spfile from pfile=‘$ORACLE_HOME/dbs/pfile_for_standby.txt‘
如果遇到错误可以查看 log_file_name_convert 与 db_file_name_convert 是否有问题
alter system set log_file_name_convert=‘+DATA/orcl/onlinelog, +DATA/orcldg/onlinelog‘ scope=spfile;
alter system set db_file_name_convert=‘+DATA/orcl/datafile, +DATA/orcldg/datafile‘ scope=spfile;
--主库standby 删除
alter database drop logfile group 5;
alter database drop logfile group 6;
alter database drop logfile group 7;
alter database drop logfile group 8;
alter database drop logfile group 9;
alter database drop logfile group 10;
主库standby 添加
alter database add standby logfile group 5 (‘+DATA/orcl/onlinelog/standby_group_05.log‘) size 60M reuse;
alter database add standby logfile group 6 (‘+DATA/orcl/onlinelog/standby_group_06.log‘) size 60M reuse;
alter database add standby logfile group 7 (‘+DATA/orcl/onlinelog/standby_group_07.log‘) size 60M reuse;
alter database add standby logfile group 8 (‘+DATA/orcl/onlinelog/standby_group_08.log‘) size 60M reuse;
alter database add standby logfile group 9 (‘+DATA/orcl/onlinelog/standby_group_9.log‘) size 60M reuse;
alter database add standby logfile group 10 (‘+DATA/orcl/onlinelog/standby_group_10.log‘) size 60M reuse;
然后在备库执行
alter database recover managed standby database using current logfile disconnect;
alter system set standby_file_management=‘auto‘;