1.从库要添加至少一组 standby online redolog
启动到mount状态:
SQL> alter database add standby logfile '/u01/app/oracle/oradata/dataguard/redo04.log' size 50M;
SQL> alter database add standby logfile '/u01/app/oracle/oradata/dataguard/redo05.log' size 50M;
SQL> alter database add standby logfile '/u01/app/oracle/oradata/dataguard/redo06.log' size 50M;
2.从库要添加一个standby online redolog归档路径
SQL> alter system set log_archive_dest_3='location=/home/oracle/dataguard/archive1 valid_for=(standby_logfiles,standby_role) db_unique_name=aux1';
System altered.
3.主库更改远程归档参数
SQL> alter system set log_archive_dest_2='service=aux1 lgwr sync affirm valid_for=(online_logfiles,primary_role) db_unique_name=aux1';
System altered.
4.更改级别:
SQL> alter database set standby database to maximize availability;
Database altered.
5.查询验证:
主库:
SQL> select protection_mode,database_role,protection_level from v$database;
PROTECTION_MODE DATABASE_ROLE PROTECTION_LEVEL
-------------------- ---------------- --------------------
MAXIMUM AVAILABILITY PRIMARY MAXIMUM AVAILABILITY
从库:
SQL> select protection_mode,database_role,protection_level from v$database;
PROTECTION_MODE DATABASE_ROLE PROTECTION_LEVEL
-------------------- ---------------- --------------------
MAXIMUM AVAILABILITY PHYSICAL STANDBY MAXIMUM AVAILABILITY
2.将主库从最大可用转换成最大保护
1.将主库启动到mount状态。
2.切换
SQL> alter database set standby database to maximize protection;
Database altered.
3.在从库开启日志实时应用:
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
open时报错:
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
查询原因,切换到最大保护,要求下面几个条件:
1. lgwr
2. sync
3. standy log
4. 主从 flashback on
5. affirm
6. standby online redolog归档路径
SQL> recover managed standby database cancel;
Media recovery complete.
3.主从互换(先主换从,再从换主)
1.查询是否可以切换
2.主切成从
3.为主库添加standy online redolog
4.为主库添加standby online redolog归档路径
5.为主库添加db_file_name_convert,log_file_name_convert
6.检查从库远程归档路径,看是否需要更改从库远程归档参数。