Data Guard模式切换



Data Guard模式切换

 

概念
a、最大性能(maximize performance):
    这是Data Guard默认的保护模式。primay上的事务commit前不需要从standby上收到反馈信息,该模式在primary故障时可能丢失数据,但standby对primary的性能影响最小。
b、最大可用(maximize availability):
    在正常情况下,最大可用模式和最大保护模式一样;在standby不可用时,最大可用模式会自动降低成最大性能模式,所以standby故障不会导致primay不可用。只要至少有一个standby可用的情况下

,即使primary down机,也能保证不丢失数据。
c、最大保护(maximize protection):
    最高级别的保护模式。primay上的事务在commit前必须确认redo已经传递到至少一个standby上,如果所有standby不可用,则primary会挂起。该模式能保证零数据丢失, 一般为保证主库在某个从库

故障后仍能正常运行,最好配置两个及以上的从库。

摘自官方文档的描述:
Maximum Performance Mode
This protection mode (the default) provides the highest level of data protection that is possible without affecting the performance of the primary database. This is accomplished

by allowing a transaction to commit as soon as the redo data needed to recover that transaction is written to the local online redo log. The primary database's redo data stream

is also written to at least one standby database, but that redo stream is written asynchronously with respect to the commitment of the transactions that create the redo data.

When network links with sufficient bandwidth are used, this mode provides a level of data protection that approaches that of maximum availability mode with minimal impact on

primary database performance.

The maximum performance mode enables you to either set the LGWR and ASYNC attributes, or set the ARCH attribute on the LOG_ARCHIVE_DEST_n parameter for the standby database

destination. If the primary database fails, you can reduce the amount of data that is not received on the standby destination by setting the LGWR and ASYNC attributes.

Maximum Availability Mode
This protection mode provides the highest level of data protection that is possible without compromising the availability of the primary database. Like maximum protection mode,

a transaction will not commit until the redo needed to recover that transaction is written to the local online redo log and to at least one remote standby redo log. Unlike

maximum protection mode, the primary database does not shut down if a fault prevents it from writing its redo stream to a remote standby redo log. Instead, the primary database

operates in maximum performance mode until the fault is corrected and all gaps in redo log files are resolved. When all gaps are resolved, the primary database automatically

resumes operating in maximum availability mode.

This mode ensures that no data loss will occur if the primary database fails, but only if a second fault does not prevent a complete set of redo data from being sent from the

primary database to at least one standby database.

Like maximum protection mode, the maximum availability mode requires that you:

    Configure standby redo log files on at least one standby database.

    Set the SYNC, LGWR, and AFFIRM attributes of the LOG_ARCHIVE_DEST_n parameter for at least 1 standby database.

Maximum Protection Mode
This protection mode ensures that no data loss will occur if the primary database fails. To provide this level of protection, the redo data needed to recover each transaction

must be written to both the local online redo log and to the standby redo log on at least one standby database before the transaction commits. To ensure data loss cannot occur,

the primary database shuts down if a fault prevents it from writing its redo stream to at least one remote standby redo log. For multiple-instance RAC databases, Data Guard

shuts down the primary database if it is unable to write the redo records to at least one properly configured database instance. The maximum protection mode requires that at

least one standby instance has a standby redo log and the LGWR, SYNC, and AFFIRM attributes be used on the LOG_ARCHIVE_DEST_n parameter for this destination.

选项
    maximum protection maximum availability  maximum performance
redo archival process  LGWR   LGWR   LGWR or ARCH
network transmission mode SYNC   SYNC   SYNC or ASYNC when using LGWR process.SYNC if using ARCH process
disk write option  AFFIRM   AFFIRM   AFFIRM or NOAFFIRM
standby redo log required? yes   yes   no,but it is recommended


举例:
将Data Guard有最大性能模式切换到最高可用的应用举例
备库:
--取消日志应用
alter database recover managed standby database cancel;

主库:
--查看log_archive_dest_2参数
show parameter log_archive_dest_2;
--修改log_archive_dest_2参数
alter system set log_archive_dest_2='SERVICE=stadb LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stadb';

--重启数据库
shutdown immediate;
startup mount;

--将主库修改为最高可用模式
--alter database set standby database to maximize performance;
alter database set standby database to maximize availability;
--alter database set standby database to maximize protection;

--打开数据库
alter database open;

--查看数据库模式
select open_mode,database_role,switchover_status,protection_mode,protection_level from v$database;

备库:
--应用日志
alter database recover managed standby database disconnect from session;

--修改备库的log_archive_dest_2是为了主备切换
--查看log_archive_dest_2参数
show parameter log_archive_dest_2;
--修改log_archive_dest_2参数
alter system set log_archive_dest_2='SERVICE=pridb LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=pridb';

--查看数据库模式
select open_mode,database_role,switchover_status,protection_mode,protection_level from v$database;


转自:http://blog.csdn.net/orcldb/article/details/8187691

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值