高可用之4——Data Guard 配置Standby Redo Log

本文涉及的产品
日志服务 SLS,月写入数据量 50GB 1个月
简介: 转载:http://blog.itpub.net/35489/viewspace-672422 Data Guard在最大保护和最高可用性模式下,Standby数据库必须配置standby redo log,通过下面的实 验展示创建的原则和过程。

转载:http://blog.itpub.net/35489/viewspace-672422

Data Guard在最大保护和最高可用性模式下,Standby数据库必须配置standby redo log,通过下面的实

验展示创建的原则和过程。

1.原则
1).standby redo log的文件大小与primary 数据库online redo log 文件大小相同
2).standby redo log日志文件组的个数依照下面的原则进行计算
   Standby redo log组数公式>=(每个instance日志组个数+1)*instance个数
   例如在我的环境中,只有一个节点,这个节点有三组redo,所以
   Standby redo log组数公式>=(3+1)*1 == 4
   所以需要创建4组Standby redo log
3).每一日志组为了安全起见,可以包含多个成员文件

2.配置过程,正常情况下仅需要在Standby端进行配置,考虑到主备切换,在primary端亦进行配置
1)Standby库添加四组Standby redo log,用户备库的恢复
sys@ora10g> alter database add standby logfile group 4

('/oracle/u02/ORA10GDG/STANDBYRD01.LOG') size 200M;

Database altered.

sys@ora10g> alter database add standby logfile group 5

('/oracle/u02/ORA10GDG/STANDBYRD02.LOG') size 200M;

Database altered.

sys@ora10g> alter database add standby logfile group 6

('/oracle/u02/ORA10GDG/STANDBYRD03.LOG') size 200M;

Database altered.

sys@ora10g> alter database add standby logfile group 7

('/oracle/u02/ORA10GDG/STANDBYRD04.LOG') size 200M;

Database altered.

2)Primary库添加四组Standby redo log,用于主备切换
sys@ora10g> alter database add standby logfile group 4

('/oracle/u02/ORA10G/STANDBYRD01.LOG') size 200M;

Database altered.

sys@ora10g> alter database add standby logfile group 5

('/oracle/u02/ORA10G/STANDBYRD02.LOG') size 200M;

Database altered.

sys@ora10g> alter database add standby logfile group 6

('/oracle/u02/ORA10G/STANDBYRD03.LOG') size 200M;

Database altered.

sys@ora10g> alter database add standby logfile group 7

('/oracle/u02/ORA10G/STANDBYRD04.LOG') size 200M;

Database altered.


3.Standby redo log删除方法
sys@ora10g> alter database drop standby logfile group 4;
sys@ora10g> alter database drop standby logfile group 5;
sys@ora10g> alter database drop standby logfile group 6;
sys@ora10g> alter database drop standby logfile group 7;


4.通过V$STANDBY_LOG视图验证standby redo log文件组是否成功创建
sys@ora10g> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;

    GROUP#    THREAD# SEQUENCE# ARC STATUS
---------- ---------- ---------- --- ----------
         4          0          0 YES UNASSIGNED
         5          0          0 YES UNASSIGNED
         6          0          0 YES UNASSIGNED
         7          0          0 YES UNASSIGNED


Question:  In Data Guard, why do we need standby redo log files?  Should the the primary redo log files be enough?

Answer:  A standby redo log resides on the standby database site.  The standby redo log file is similar to an online redo log, except that a standby redo log is used to store redo data that has been received from a primary database.

Oracle Data Guard used to have the onerous(严重的) problem of loosing the last redo log.  If the primary instanced crashed, the "current" redo log (as written by the LGWR process) would need to be flushed (with a log switch) before the most recent changes could be applied to the standby database.  If you could not flush the current redo, data could be lost forever.

Also see these important notes on LNS log transport waits.

Standby Redo Logs

In Oracle 10g and beyond we see an exciting new approach to Data Guard management whereby we write the current redo log to a "standby redo log", allowing complete recovery in cases of catastrophic(灾难性的) instance failure. 

Note:  The standby redo logs are populated with redo information as fast as the primary redo logs, rather than waiting for the redo log to be archived and shipped to the standby database. This means that the standby redo log has more current information than the log apply mechanism because it took a "shortcut" and was written to the standby, bypassing the traditional archiving and FTP to the standby database.

The Oracle documentation notes three Data Guard Protection Modes.  The Maximum protection mode offers redo synchronization:

Maximum Protection?This mode offers the highest level of data protection. Data is synchronously transmitted to the standby database from the primary database and transactions are not committed on the primary database unless the redo data is available on at least one standby database configured in this mode. If the last standby database configured in this mode becomes unavailable, processing stops on the primary database. This mode ensures no-data-loss.

Maximum Availability?This mode is similar to the maximum protection mode, including zero data loss. However, if a standby database becomes unavailable (for example, because of network connectivity problems), processing continues on the primary database. When the fault is corrected, the standby database is automatically resynchronized with the primary database.

Maximum Performance?This mode offers slightly less data protection on the primary database, but higher performance than maximum availability mode. In this mode, as the primary database processes transactions, redo data is asynchronously shipped to the standby database. The commit operation of the primary database does not wait for the standby database to acknowledge receipt of redo data before completing write operations on the primary database. If any standby destination becomes unavailable, processing continues on the primary database and there is little effect on primary database performance.

Asynchronous redo transmission

We see more about the standby redo log mode in the 10g r2 docs where a new feature called "Asynchronous Redo Transmission" uses a new background process called LNSn:

Asynchronous redo transmission using the log writer process (LGWR ASYNC) has been improved to reduce the performance impact on the primary database. During asynchronous redo transmission, the network server (LNSn) process transmits redo data out of the online redo log files on the primary database and no longer interacts directly with the log writer process.

This change in behavior allows the log writer process to write redo data to the current online redo log file and continue processing the next request without waiting for inter-process communication or network I/O to complete.



相关实践学习
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
相关文章
|
2月前
|
监控 安全 程序员
Python日志模块配置:从print到logging的优雅升级指南
从 `print` 到 `logging` 是 Python 开发的必经之路。`print` 调试简单却难维护,日志混乱、无法分级、缺乏上下文;而 `logging` 支持级别控制、多输出、结构化记录,助力项目可维护性升级。本文详解痛点、优势、迁移方案与最佳实践,助你构建专业日志系统,让程序“有记忆”。
244 0
|
3月前
|
缓存 Java 应用服务中间件
Spring Boot配置优化:Tomcat+数据库+缓存+日志,全场景教程
本文详解Spring Boot十大核心配置优化技巧,涵盖Tomcat连接池、数据库连接池、Jackson时区、日志管理、缓存策略、异步线程池等关键配置,结合代码示例与通俗解释,助你轻松掌握高并发场景下的性能调优方法,适用于实际项目落地。
575 5
|
9月前
|
SQL Java 数据库连接
微服务——SpringBoot使用归纳——Spring Boot使用slf4j进行日志记录—— application.yml 中对日志的配置
在 Spring Boot 项目中,`application.yml` 文件用于配置日志。通过 `logging.config` 指定日志配置文件(如 `logback.xml`),实现日志详细设置。`logging.level` 可定义包的日志输出级别,例如将 `com.itcodai.course03.dao` 包设为 `trace` 级别,便于开发时查看 SQL 操作。日志级别从高到低为 ERROR、WARN、INFO、DEBUG,生产环境建议调整为较高级别以减少日志量。本课程采用 yml 格式,因其层次清晰,但需注意格式要求。
829 0
|
安全 BI 网络安全
EventLog Analyzer 如何满足等保合规要求?密码有效期、产品日志保留、配置备份三大核心问题全面解答
EventLog Analyzer(ELA)助力企业满足网络安全等级保护要求,支持配置自动/手动备份、日志180天留存及密码策略管理,提升合规性与安全运营效率。
114 0
|
5月前
|
JSON 安全 Go
Go语言项目工程化 —— 日志、配置、错误处理规范
本章详解Go语言项目工程化核心规范,涵盖日志、配置与错误处理三大关键领域。在日志方面,强调其在问题排查、性能优化和安全审计中的作用,推荐使用高性能结构化日志库zap,并介绍日志级别与结构化输出的最佳实践。配置管理部分讨论了配置分离的必要性,对比多种配置格式如JSON、YAML及环境变量,并提供viper库实现多环境配置的示例。错误处理部分阐述Go语言显式返回error的设计哲学,讲解标准处理方式、自定义错误类型、错误封装与堆栈追踪技巧,并提出按调用层级进行错误处理的建议。最后,总结各模块的工程化最佳实践,助力构建可维护、可观测且健壮的Go应用。
|
6月前
|
存储 NoSQL MongoDB
Docker中安装MongoDB并配置数据、日志、配置文件持久化。
现在,你有了一个运行在Docker中的MongoDB,它拥有自己的小空间,对高楼大厦的崩塌视而不见(会话丢失和数据不持久化的问题)。这个MongoDB的数据、日志、配置文件都会妥妥地保存在你为它精心准备的地方,天旋地转,它也不会失去一丁点儿宝贵的记忆(即使在容器重启后)。
691 4
|
8月前
|
存储 监控 API
【Azure App Service】分享使用Python Code获取App Service的服务器日志记录管理配置信息
本文介绍了如何通过Python代码获取App Service中“Web服务器日志记录”的配置状态。借助`azure-mgmt-web` SDK,可通过初始化`WebSiteManagementClient`对象、调用`get_configuration`方法来查看`http_logging_enabled`的值,从而判断日志记录是否启用及存储方式(关闭、存储或文件系统)。示例代码详细展示了实现步骤,并附有执行结果与官方文档参考链接,帮助开发者快速定位和解决问题。
250 22
|
8月前
|
数据库 文件存储 数据安全/隐私保护
YashanDB redo日志文件管理
YashanDB的redo日志文件用于记录数据库物理日志,支持宕机重演和主备复制。 redo日志有4种状态:NEW(新创建)、CURRENT(当前写入)、ACTIVE(未归档或未写盘)和INACTIVE(可复用)。可通过V$LOGFILE视图或直接查看$YASDB_DATA/dbfiles目录来管理redo日志。此外,支持添加、切换和删除redo日志以优化性能或应对磁盘故障等情况,但需注意仅能删除INACTIVE或NEW状态的日志以确保数据安全。
|
9月前
|
监控 Shell Linux
Android调试终极指南:ADB安装+多设备连接+ANR日志抓取全流程解析,覆盖环境变量配置/多设备调试/ANR日志分析全流程,附Win/Mac/Linux三平台解决方案
ADB(Android Debug Bridge)是安卓开发中的重要工具,用于连接电脑与安卓设备,实现文件传输、应用管理、日志抓取等功能。本文介绍了 ADB 的基本概念、安装配置及常用命令。包括:1) 基本命令如 `adb version` 和 `adb devices`;2) 权限操作如 `adb root` 和 `adb shell`;3) APK 操作如安装、卸载应用;4) 文件传输如 `adb push` 和 `adb pull`;5) 日志记录如 `adb logcat`;6) 系统信息获取如屏幕截图和录屏。通过这些功能,用户可高效调试和管理安卓设备。
|
9月前
|
数据库连接 测试技术 Windows
【YashanDB知识库】windows配置ODBC跟踪日志, 使用日志定位问题
【YashanDB知识库】windows配置ODBC跟踪日志, 使用日志定位问题