当前位置:Gxlcms > mysql > DataGuard保护模式解析及演示

DataGuard保护模式解析及演示

时间:2021-07-01 10:21:17 帮助过:27人阅读

在一些场合,一些业务是不能容忍丢失数据的。而在另外的场合,数据库的可用性可能比数据的丢失更加重要。一些应用要求数据库的性能最大化,并且可以容忍少许数据

e

,

参数配置实例:

alter system set log_archive_dest_2='SERVICE=db_phystdby LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHYSTDBY AFFIRM ';

3、最高性能(Maximum performance)

最高性能模式是默认的保护模式,,这种模式在不影响主库性能的前提下提供最高级别的数据保护。这种模式事务提交是不受限制的。主库的redo data流同样要求写入至少一个standby database,但是redo 流与创建redo data的事务相对而言是不同步的。

当网络带宽足够使用时,这种模式提供了类似于最高可用模式的数据库保护,但是对于主库的性能影响最下。

从以上分析即可知,这种模式下,我们可以使用ARCHLGWR

当使用ARCH时,则需要SYNC(同步)。

当使用LGWR时,可以是SYNC也可以是ASYNC

Standby redo这个可有可无。

示例配置:

alter system set log_archive_dest_2 = 'SERVICE=db_phystdby LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHYSTDBY';

4、切换演示

切换为最大保护模式

a、现在备库上做操作,添加standby logfile

[oracle@dg2 ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jan 5 01:00:35 2014 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> alter database add standby logfile group 4 ('/u01/oracle/oradata/ORCLDB/stdby_redo04.log') size 50M; Database altered. SQL> alter database add standby logfile group 5 ('/u01/oracle/oradata/ORCLDB/stdby_redo05.log') size 50M; Database altered. SQL> alter database add standby logfile group 6 ('/u01/oracle/oradata/ORCLDB/stdby_redo06.log') size 50M; Database altered.

b、在主库上执行以下的操作

[oracle@dg1 bdump]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jan 5 01:10:32 2014 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> alter database set standby database to maximize PROTECTION; alter database set standby database to maximize PROTECTION * ERROR at line 1: ORA-01126: database must be mounted in this instance and not open in any instance SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 390070272 bytes Fixed Size 2021024 bytes Variable Size 142608736 bytes Database Buffers 243269632 bytes Redo Buffers 2170880 bytes Database mounted. SQL> alter database set standby database to maximize PROTECTION; Database altered. SQL> select PROTECTION_MODE,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,SWITCHOVER_STATUS from v$database; PROTECTION_MODE OPEN_MODE DB_UNIQUE_NAME DATABASE_ROLE SWITCHOVER_STATUS -------------------- ---------- ------------------------------ ---------------- -------------------- MAXIMUM PROTECTION MOUNTED WENDING PRIMARY TO STANDBY 分别将FLASHBACK_ON开启。 SQL> select FLASHBACK_ON from v$database; FLASHBACK_ON ------------------ NO SQL> alter database flashback on; Database altered. 主库上操作 SQL> alter system set log_archive_dest_2 = 'SERVICE=db_phystdby LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHYSTDBY AFFIRM '; System altered. SQL> alter database open; Database altered. SQL> select PROTECTION_MODE,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,SWITCHOVER_STATUS from v$database; PROTECTION_MODE OPEN_MODE DB_UNIQUE_NAME DATABASE_ROLE SWITCHOVER_STATUS -------------------- ---------- ------------------------------ ---------------- -------------------- MAXIMUM PROTECTION MOUNTED PHYSTDBY PHYSICAL STANDBY SESSIONS ACTIVE

本文出自 “阿布” 博客,请务必保留此出处

人气教程排行