1.Data Guard
2 DG Services 详解 – Redo Transport Services
3 DG Services 详解 – Apply Services
4 DG Services 详解 – Role Transitions
5 Data Guard 的数据保护级别与性能关系
5.1 三种模式对比
1️⃣最大保护模式
- 这种模式提供了
最高级别
的数据保护能力; - 要求至少一个物理备库收到重做日志后,主库的事务才能够提交;
- 主库找不到合适的备库写入时,主库会hang住,防止未受保护的数据出现;
优点:该模式可以保证备库没有数据丢失;
缺点:备库的自动关闭会影响到主库的可用性,同时需要备库恢复后才能提交,对网络等客观条件要求非常的高,主库的性能会因此受到非常大的冲击。
2️⃣最大可用性模式
- 该模式提供了仅次于“最大保护模式”的数据保护能力;
- 要求至少一个物理备库收到重做日志后,主库的事务才能够提交;
- 主库找不到合适的备库写入时,主库不会关闭,而是临时降低到“最大性能模式”模式,直到问题得到处理;
优点:该模式可以在没有问题出现的情况下,保证备库没有数据丢失,是一种折中的方法;
缺点:在正常运行的过程中缺点是主库的性能受到诸多因素的影响。
3️⃣最大性能模式
- 该模式是默认模式,可以保证主数据库的最高可用性;
- 保证主库运行过程中不受备库的影响,主库事务正常提交,不因备库的任何问题影响到主库的运行;
优点:避免了备库对主数据库的性能和可用性影响;
缺点:如果与主库提交的事务相关的恢复数据没有发送到备库,这些事务数据将被丢失,不能保证数据无损失;
5.2 设置主库的保护模式
查询当前的保护模式
SQL> SELECT PROTECTION_MODE, PROTECTION_LEVEL, DATABASE_ROLE ROLE, SWITCHOVER_STATUS FROM V$DATABASE;
不同数据保护模式对redo transport 的要求
最大可用 | 最大性能 | 最大保护 |
---|---|---|
AFFIRM | NOAFFIRM | AFFIRM |
SYNC | ASYNC | SYNC |
注:主库和备库的参数log_archive_dest_n 参数都需要指定DB_UNIQUE_NAME
语句
SQL> ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE {AVAILABILITY | PERFORMANCE | PROTECTION};
将主库模式切换到最大可用性
maximize protection <--> maximize availability <--> maximize performance
当在把dataguard的保护级别按这上面的顺序减低或, 不需要primary库在mount状态;当从最好性能直接切换到最好保护时,primary 必须在mount 状态。
主库操作
SQL> select protection_mode, protection_level, database_role role, switchover_status from v$database;
SQL> alter system set log_archive_dest_2='service=study_st lgwr affirm sync valid_for=(online_logfiles,primary_role) db_unique_name=study_st';
SQL> alter database set standby database to maximize availability;
将主库模式切换到最大保护
SQL> alter database set standby database to maximize protection;
或
SQL> shutdown immediate;
SQL> startup mount;
SQL> select database_role,protection_mode,protection_level from v$database;
SQL> alter database open;
6 Data Guard 异构平台支持
部署 Data Guard 时最简单的途径是配置同构的对称主/备用配置。但是,为了利用运行不同操作系统的现有服务器,或者为了在尽可能减少停机时间或风险的情况下帮助从一个平台向另一个平台移植时,通常部署异构配置会非常有用。对于希望使用低于生产环境的处理能力的配置或者使用成本低于其主系统的组件来配置备用系统,从而减少其灾难恢复投资的用户而言,这是相当合理的选择。
确定主数据库和备用数据库的平台 ID。
SQL> select platform_id, platform_name from v$database;
物理standby
PLATFORM_ID | PLATFORM_NAME | 使用 Data Guard (物理备用)时,相同 Data Guard 配置中支持的 PLATFORM_ID |
---|---|---|
2 | Solaris[tm] OE (64-bit) Solaris Operating System (SPARC)(64-bit) | 2 6 - 由于 Bug 12702521 中报告的问题,不支持此项 |
3 | HP-UX (64-bit) HP-UX PA-RISC | 3 4 - Oracle 10g 及更高版本,请参阅技术支持文档 Note: 395982.1 |
4 | HP-UX IA (64-bit) HP-UX Itanium | 4 3 - Oracle 10g 及更高版本,请参阅技术支持文档 Note: 395982.1 |
5 | HP Tru64 UNIX HP Tru64 UNIX | 5 |
6 | IBM AIX on POWER Systems (64-bit) | 2 - 由于 Bug 12702521 中报告的问题,不支持此项 6 |
7 | Microsoft Windows (32-bit) Microsoft Windows (x86) | 7 8, 12 - Oracle 10g 及更高版本,请参阅 技术支持文档 Note: 414043.1 10 - Oracle 11g 及更高版本,需要 Patch 13104881 11, 13 - Oracle 11g 及更高版本,请参阅 技术支持文档 Note: 414043.1, Patch 13104881 |
8 | Microsoft Windows IA (64-bit) Microsoft Windows (64-bit Itanium) | 7 - Oracle 10g 及更高版本,请参阅 技术支持文档 Note: 414043.1 8 12 - Oracle 10g 及更高版本 11, 13 - Oracle 11g 及更高版本,需要 Patch 13104881 |
9 | IBM zSeries Based Linux z/Linux | 9 18 (仅 64 位 zSeries) |
10 | Linux (32-bit) Linux x86 | 7 - Oracle 11g 及更高版本,需要 Patch 13104881 10 11, 13 - Oracle 10g 及更高版本,请参阅 技术支持文档 Note: 414043.1 |
11 | Linux IA (64-bit) Linux Itanium | 10 - Oracle 10g 及更高版本,请参阅 技术支持文档 Note: 414043.1 11 13 - Oracle 10g 及更高版本 7 - Oracle 11g 及更高版本,请参阅 技术支持文档 Note: 414043.1,还需要 Patch 13104881 8, 12 - Oracle 11g 及更高版本,需要 Patch 13104881 |
12 | Microsoft Windows 64-bit for AMD Microsoft Windows (x86-64) | 7 - Oracle 10g 及更高版本,请参阅技术支持说明 Note: 414043.1 8 - Oracle 10g 及更高版本 12 11, 13 - Oracle 11g 及更高版本,需要 Patch 13104881 |
13 | Linux 64-bit for AMD Linux x86-64 | 7 - Oracle 11g 及更高版本,请参阅 技术支持文档 Note: 414043.1,还需要 Patch 13104881 10 - Oracle 10g 及更高版本,请参阅技术支持文档 Note: 414043.1 11 - Oracle 10g 及更高版本 8, 12 - Oracle 11g 及更高版本,需要 Patch 13104881 13 20 - Oracle 11g 及更高版本 |
15 | HP Open VMS HP OpenVMS Alpha HP IA OpenVMS OpenVMS Itanium | 15 |
16 | Apple Mac OS Mac OS X Server | 16 |
17 | Solaris Operating System (x86) Solaris Operating System (x86) | 17 20 - Oracle 10g 及更高版本,请参阅 技术支持文档 Note: 414043.1 |
18 | IBM Power Based Linux Linux on Power | 9(仅 64 位 zSeries) 18 |
20 | Solaris Operating System (AMD64) Solaris Operating System (x86-64) | 13 - Oracle 11g 及更高版本 17 - Oracle 10g 及更高版本,请参阅 技术支持文档 Note: 414043.1 20 |
举例:表格10,主库10支持的备库有7,10,11,13。但是备库是7时需要11g及更高版本才支持,并且需要应用patch13104881;备库为11和13时,需要10g及更高版本,支持文档为414043.1
逻辑standby
PLATFORM_ID | PLATFORM_NAME | 使用 Data Guard (物理备用)时,相同 Data Guard 配置中支持的 PLATFORM_ID |
---|---|---|
2 | Solaris[tm] OE (64-bit) Solaris Operating System (SPARC) (64-bit) | 2 |
3 | HP-UX (64-bit) HP-UX PA-RISC | 3 4 |
4 | HP-UX IA (64-bit) HP-UX Itanium | 3 4 |
5 | HP Tru64 UNIX HP Tru64 UNIX | 5 |
6 | AIX-Based Systems (64-bit) AIX5L | 6 |
7 | Microsoft Windows (32-bit) Microsoft Windows (x86) | 7 10 requires patch for Bug 13104881 8, 12 - Replication can only occur from a 32-bit primary to a 64-bit standby, once a role transition has promoted the 64-bit system to the primary role, the original 32-bit primary is not supported as a standby database. |
8 | Microsoft Windows IA (64-bit) Microsoft Windows (64-bit Itanium) | 7 - Replication can only occur from a 32-bit primary to a 64-bit standby, once a role transition has promoted the 64-bit system to the primary role, the original 32-bit primary is not supported as a standby database. 8, 12 11, 13, both require patch for Bug 13104881 |
9 | IBM zSeries Based Linux z/Linux | 9 |
10 | Linux (32-bit) Linux x86 | 7, requires patch for Bug 13104881 10 11, 13 - Replication can only occur from a 32-bit primary to a 64-bit standby, once a role transition has promoted the 64-bit system to the primary role, the original 32-bit primary is not supported as a standby database. |
11 | Linux IA (64-bit) Linux Itanium | 10 - Replication can only occur from a 32-bit primary to a 64-bit standby, once a role transition has promoted the 64-bit system to the primary role, the original 32-bit primary is not supported as a standby database. 8, requires patch for Bug 13104881 11, 13 |
12 | Microsoft Windows 64-bit for AMD Microsoft Windows (x86-64) | 7 - from Oracle 11g onward. Replication can only occur from a 32-bit primary to a 64-bit standby, once a role transition has promoted the 64-bit system to the primary role, the original 32-bit primary is not supported as a standby database. 8, 12 |
13 | Linux 64-bit for AMD Linux x86-64 | 10 - Replication can only occur from a 32-bit primary to a 64-bit standby, once a role transition has promoted the 64-bit system to the primary role, the original 32-bit primary is not supported as a standby database. 8, requires patch for Bug 13104881 11, 13 |
15 | HP Open VMS HP OpenVMS Alpha HP IA OpenVMS OpenVMS Itanium | 15 |
16 | Apple Mac OS Mac OS X Server | 16 |
17 | Solaris Operating System (x86) Solaris Operating System (x86) | 17 |
18 | IBM Power Based Linux Linux on Power | 18 |
20 | Solaris Operating System (AMD64) Solaris Operating System (x86-64) | 20 |
今天的文章先到这里,后面继续更新Data Guard ----理论详解(五) 之DG日常维护管理与监控