

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 Amazon RDS 上为 Oracle PeopleSoft 应用程序过渡角色适用于 Oracle 定制
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle"></a>

*Sampath Kathirvel，Amazon Web Services*

## Summary
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle-summary"></a>

要在亚马逊网络服务 (AWS) 上运行 [Oracle PeopleSoft](https://www.oracle.com/applications/peoplesoft/) 企业资源规划 (ERP) 解决方案，您可以使用[亚马逊关系数据库服务 (Amazon RDS) 或 Ama](https://aws.amazon.com/rds/) [zon RDS Custom for Oracle](https://aws.amazon.com/rds/custom/)，后者支持需要访问底层操作系统 (OS) 和数据库环境的传统、定制和打包应用程序。有关规划迁移时需要考虑的关键因素，请参阅《AWS 规范指引》中的 [Oracle 数据库迁移策略](https://docs.aws.amazon.com/prescriptive-guidance/latest/migration-oracle-database/strategies.html)。

此模式侧重于为在 Amazon RDS Custom 上运行的 PeopleSoft 应用程序数据库执行 Oracle Data Guard 切换或角色过渡的步骤，该数据库是带有只读副本数据库的主数据库。该模式包括配置[快速启动失效转移 (FSFO)](https://docs.oracle.com/en/database/oracle/oracle-database/19/dgbkr/using-data-guard-broker-to-manage-switchovers-failovers.html#GUID-D26D79F2-0093-4C0E-98CD-224A5C8CBFA4) 的步骤。在此过程中，Oracle Data Guard 配置中的数据库将继续以其新角色运行。Oracle Data Guard 切换的典型使用案例包括灾难恢复（DR）演练、数据库的定期维护活动以及[备用优先补丁应用](https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/upgrading-patching-downgrading-oracle-data-guard-configuration.html#GUID-A5226768-DB6B-4714-BB9A-0A3EF17A01C8)滚动补丁。有关更多信息，请参阅博客文章[缩短 Amazon RDS Custom 中的数据库补丁停机时间](https://aws.amazon.com/blogs/database/reduce-database-patching-downtime-in-amazon-rds-custom-for-oracle-using-oracle-data-guard-standby-first-patch-apply/)。

## 先决条件和限制
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle-prereqs"></a>

**先决条件**
+ [使用只读副本模式完成 PeopleSoft 在 Amazon RDS 自定义上向 Oracle 添加 HA](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/add-ha-to-oracle-peoplesoft-on-amazon-rds-custom-by-using-a-read-replica.html)。

**限制**
+ [适用于 Oracle 的 RDS Custom](https://docs.amazonaws.cn/en_us/AmazonRDS/latest/UserGuide/custom-reqs-limits.html#custom-reqs-limits.limits) 的限制和不支持的配置
+ [适用于 Oracle 的 Amazon RDS Custom 只读副本](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-rr.html#custom-rr.limitations)的相关限制

**产品版本**
+ 有关 Amazon RDS Custom 支持的 Oracle 数据库版本，请参阅[适用于 Oracle 的 RDS Custom](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RDS_Fea_Regions_DB-eng.Feature.RDSCustom.html#Concepts.RDS_Fea_Regions_DB-eng.Feature.RDSCustom.ora)。
+ 有关 Amazon RDS Custom 支持的 Oracle 数据库实例类，请参阅[适用于 Oracle 的 RDS Custom 支持的数据库实例类](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-reqs-limits.html#custom-reqs-limits.instances)。

## 架构
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle-architecture"></a>

**技术堆栈**
+ 适用于 Oracle 的 Amazon RDS Custom

**目标架构**

下图显示了 Amazon RDS Custom 数据库实例和 Amazon RDS Custom 只读副本。Oracle Data Guard 在灾难恢复失效转移期间提供角色转换。

![\[使用一个只读副本数据库，将 Oracle Data Guard 切换为主要 RDS 自定义数据库实例。\]](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/images/pattern-img/da3b011c-1668-4de4-9079-0982888a74b4/images/4e2a2f3b-b5bd-44b7-9b5a-13a663ee3be6.png)


有关 PeopleSoft 在 AWS 上使用 Oracle 的代表性架构，请参阅[在 AWS 上设置高可用 PeopleSoft 架构](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/set-up-a-highly-available-peoplesoft-architecture-on-aws.html)。

## 工具
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle-tools"></a>

**Amazon Web Services**
+ [适用于 Oracle 的 Amazon RDS Custom](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/working-with-custom-oracle.html) 是一种托管式数据库服务，适用于需要访问底层操作系统和数据库环境的旧版、自定义和打包应用程序。
+ [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html) 帮助您将代码中的硬编码凭证（包括密码）替换为对 Secrets Manager 的 API 调用，以便以编程方式检索密钥。在此模式中，您需要使用密钥名称 `do-not-delete-rds-custom-+<<RDS Resource ID>>+-dg`，从 Secrets Manager for `RDS_DATAGUARD` 中检索数据库用户密码。

**其他服务**
+ [Oracle Data Guard](https://docs.oracle.com/en/database/oracle/oracle-database/21/sbydb/introduction-to-oracle-data-guard-concepts.html#GUID-5E73667D-4A56-445E-911F-1E99092DD8D7) 可帮助您创建、维护、管理和监控备用数据库。这种模式使用 Oracle Data Guard 最高性能来转换角色（[Oracle Data Guard 切换](https://docs.oracle.com/database/121/DGBKR/sofo.htm#DGBKR330)）。

## 最佳实践
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle-best-practices"></a>

对于生产部署，我们建议在与主节点和只读副本节点分开的第三个可用区中启动观察器实例。

## 操作说明
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle-epics"></a>

### 启动角色转换
<a name="initiate-role-transition"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 暂停主数据库和副本数据库的自动化。 | 尽管 RDS Custom 自动化框架不会干扰角色转换过程，但在 Oracle Data Guard 切换期间暂停自动化是一种不错的做法。要暂停和恢复 RDS Custom 数据库自动化，请按照[暂停和恢复 RDS Custom 自动化](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-managing.html#custom-managing.pausing)中的说明进行操作。 | 云管理员、数据库管理员 | 
| 检查 Oracle Data Guard 状态。 | 要检查 Oracle Data Guard 状态，请登录到主数据库。此模式包括用于使用多租户容器数据库（CDB）或非 CDB 实例的代码。**非 CDB**<pre>-bash-4.2$ dgmgrl RDS_DATAGUARD@RDS_CUSTOM_ORCL_A<br />DGMGRL for Linux: Release 19.0.0.0.0 - Production on Mon Nov 28 20:55:50 2022<br />Version 19.10.0.0.0<br />Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.<br />Welcome to DGMGRL, type "help" for information.<br />Password:<br />Connected to "ORCL_A"<br />Connected as SYSDG.<br />DGMGRL> show configuration<br />Configuration - rds_dg<br />Protection Mode: MaxAvailability<br />Members:<br />orcl_a - Primary database<br />orcl_d - Physical standby database <br />Fast-Start Failover: Disabled<br />Configuration Status:<br />SUCCESS (status updated 59 seconds ago)<br />DGMGRL></pre>**CDB**<pre>CDB-bash-4.2$ dgmgrl C##RDS_DATAGUARD@RDS_CUSTOM_RDSCDB_A<br />DGMGRL for Linux: Release 19.0.0.0.0 - Production on Wed Jan 18 06:13:07 2023<br />Version 19.16.0.0.0<br />Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.<br />Welcome to DGMGRL, type "help" for information.<br />Password:<br />Connected to "RDSCDB_A"<br />Connected as SYSDG.<br />DGMGRL> show configuration<br />Configuration - rds_dg<br />  Protection Mode: MaxAvailability<br />  Members:<br />  rdscdb_a - Primary database<br />    rdscdb_b - Physical standby database <br />Fast-Start Failover:  Disabled<br />Configuration Status:<br />SUCCESS   (status updated 52 seconds ago)<br />DGMGRL></pre> | 数据库管理员 | 
| 验证实例角色。 | 打开 AWS 管理控制台，然后导航到 Amazon RDS 控制台。在数据库的**复制**部分的**连接和安全**选项卡上，验证主数据库和副本数据库的实例角色。主角色应与 Oracle Data Guard 主数据库匹配，副本角色应与 Oracle Data Guard 物理备用数据库相匹配。 | 云管理员、数据库管理员 | 
| 执行切换。 | 要执行切换，请从主节点连接至 `DGMGRL`。**非 CDB**<pre>DGMGRL> switchover to orcl_d;<br />Performing switchover NOW, please wait...<br />Operation requires a connection to database "orcl_d"<br />Connecting ...<br />Connected to "ORCL_D"<br />Connected as SYSDG.<br />New primary database "orcl_d" is opening...<br />Operation requires start up of instance "ORCL" on database "orcl_a"<br />Starting instance "ORCL"...<br />Connected to an idle instance.<br />ORACLE instance started.<br />Connected to "ORCL_A"<br />Database mounted.<br />Database opened.<br />Connected to "ORCL_A"<br />Switchover succeeded, new primary is "orcl_d"<br />DGMGRL>  </pre>**CDB**<pre>DGMGRL> switchover to rdscdb_b<br />Performing switchover NOW, please wait...<br />New primary database "rdscdb_b" is opening...<br />Operation requires start up of instance "RDSCDB" on database "rdscdb_a"<br />Starting instance "RDSCDB"...<br />Connected to an idle instance.<br />ORACLE instance started.<br />Connected to "RDSCDB_A"<br />Database mounted.<br />Database opened.<br />Connected to "RDSCDB_A"<br />Switchover succeeded, new primary is "rdscdb_b"</pre> | 数据库管理员 | 
| 验证 Oracle Data Guard 连接。 | 切换后，验证 Oracle Data Guard 从主节点连接到 `DGMGRL`。**非 CDB**<pre>DGMGRL> show configuration;<br />Configuration - rds_dg<br />Protection Mode: MaxAvailability<br />Members:<br />orcl_d - Primary database<br />orcl_a - Physical standby database <br />Fast-Start Failover: Disabled<br />Configuration Status:<br />SUCCESS (status updated 60 seconds ago)<br />DGMGRL> <br /><br />DGMGRL> show configuration lag;<br />Configuration - rds_dg<br />Protection Mode: MaxAvailability<br />Members:<br />orcl_d - Primary database<br />orcl_a - Physical standby database <br />Transport Lag: 0 seconds (computed 0 seconds ago)<br />Apply Lag: 0 seconds (computed 0 seconds ago)<br />Fast-Start Failover: Disabled<br />Configuration Status:<br />SUCCESS (status updated 44 seconds ago)<br />DGMGRL> </pre>**CDB**<pre>DGMGRL> show configuration<br />DGMGRL> show configuration<br />Configuration - rds_dg<br />  Protection Mode: MaxAvailability<br />  Members:<br />  rdscdb_b - Primary database<br />    rdscdb_a - Physical standby database <br />Fast-Start Failover:  Disabled<br />Configuration Status:<br />SUCCESS   (status updated 52 seconds ago)<br />DGMGRL> <br /><br />DGMGRL> show configuration lag<br />Configuration - rds_dg<br />  Protection Mode: MaxAvailability<br />  Members:<br />  rdscdb_b - Primary database<br />    rdscdb_a - Physical standby database <br />               Transport Lag:      0 seconds (computed 0 seconds ago)<br />               Apply Lag:          0 seconds (computed 0 seconds ago)<br />Fast-Start Failover:  Disabled<br />Configuration Status:<br />SUCCESS   (status updated 53 seconds ago)<br />DGMGRL></pre> | 数据库管理员 | 
| 在 Amazon RDS 控制台上验证实例角色。 | 执行角色切换后，Amazon RDS 控制台在**数据库**下的**连接和安全**选项卡的**复制**部分下显示新角色。**复制状态**可能需要几分钟才能从空升级至**正在复制**。 | 数据库管理员 | 

### 配置 FSFO
<a name="configure-fsfo"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 重置切换。 | 将切换设置回主节点。 | 数据库管理员 | 
| 安装并启动观察器。 | 观察器过程是 `DGMGRL` 客户端组件，通常运行在与主数据库和备用数据库不同的计算机上。观察器的 ORACLE HOME 安装可以采用 Oracle Client Administrator 安装，也可以安装 Oracle 数据库企业版或个人版。有关数据库版本的观察器安装的更多信息，请参阅[安装和启动观察器](https://docs.oracle.com/en/database/oracle/oracle-database/19/dgbkr/using-data-guard-broker-to-manage-switchovers-failovers.html#GUID-11EF3897-8FCA-4A54-B63B-E8C1668AE21B)。要为观察器过程配置高可用性，您可能想要执行以下操作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle.html)对于 Oracle 12c 版本 2 及更高版本，您最多可以部署三个观察器。其中一个观察器是主观察器，其余的则是备用观察器。当主观察器失效时，其中一个备用观察器将扮演主角色。 | 数据库管理员 | 
| 从观察器主机连接到 DGMGRL。 | 观察器主机配有用于主数据库和备用数据库连接的 `tnsnames.ora`条目。只要数据丢失在[FastStartFailoverLagLimit](https://docs.oracle.com/en/database/oracle/oracle-database/19/dgbkr/oracle-data-guard-broker-properties.html)配置范围内（以秒为单位），您就可以启用具有最高性能保护模式的 FSFO。但是，您必须使用最大可用性保护模式才能实现零数据丢失（RPO=0）。**非 CDB**<pre>DGMGRL> show configuration;<br />Configuration - rds_dg<br />Protection Mode: MaxAvailability<br />Members:<br />orcl_a - Primary database<br />orcl_d - Physical standby database <br />Fast-Start Failover: Disabled<br />Configuration Status:<br />SUCCESS (status updated 58 seconds ago)<br />DGMGRL> show configuration lag<br />Configuration - rds_dg<br />Protection Mode: MaxAvailability<br />Members:<br />orcl_a - Primary database<br />orcl_d - Physical standby database <br />Transport Lag: 0 seconds (computed 1 second ago)<br />Apply Lag: 0 seconds (computed 1 second ago)<br />Fast-Start Failover: Disabled<br />Configuration Status:<br />SUCCESS (status updated 5 seconds ago)<br />DGMGRL></pre>**CDB**<pre>-bash-4.2$ dgmgrl C##RDS_DATAGUARD@RDS_CUSTOM_RDSCDB_A<br />DGMGRL for Linux: Release 19.0.0.0.0 - Production on Wed Jan 18 06:55:09 2023<br />Version 19.16.0.0.0<br />Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.<br />Welcome to DGMGRL, type "help" for information.<br />Password:<br />Connected to "RDSCDB_A"<br />Connected as SYSDG.<br />DGMGRL> show configuration<br />Configuration - rds_dg<br />  Protection Mode: MaxAvailability<br />  Members:<br />  rdscdb_a - Primary database<br />    rdscdb_b - Physical standby database <br />Fast-Start Failover:  Disabled<br />Configuration Status:<br />SUCCESS   (status updated 18 seconds ago)<br />DGMGRL></pre> | 数据库管理员 | 
| 将备用数据库修改为失效转移目标。 | 从主节点或观察器节点连接到一个备用数据库。（尽管您可能配有多个备用数据库，但此时您只需要连接到一个备用数据库。）**非 CDB**<pre>DGMGRL> edit database orcl_a set property FastStartFailoverTarget='orcl_d';<br />Property "faststartfailovertarget" updated<br />DGMGRL> edit database orcl_d set property FastStartFailoverTarget='orcl_a';<br />Property "faststartfailovertarget" updated<br />DGMGRL> show database orcl_a FastStartFailoverTarget;<br />FastStartFailoverTarget = 'orcl_d'<br />DGMGRL> show database orcl_d FastStartFailoverTarget;<br />FastStartFailoverTarget = 'orcl_a'<br />DGMGRL></pre>**CDB**<pre>DGMGRL> edit database orcl_a set property FastStartFailoverTarget='rdscdb_b';<br />Object "orcl_a" was not found<br />DGMGRL> edit database rdscdb_a set property FastStartFailoverTarget='rdscdb_b';<br />Property "faststartfailovertarget" updated<br />DGMGRL> edit database rdscdb_b set property FastStartFailoverTarget='rdscdb_a';<br />Property "faststartfailovertarget" updated<br />DGMGRL> show database rdscdb_a FastStartFailoverTarget;<br />  FastStartFailoverTarget = 'rdscdb_b'<br />DGMGRL> show database rdscdb_b FastStartFailoverTarget;<br />  FastStartFailoverTarget = 'rdscdb_a'<br />DGMGRL></pre> | 数据库管理员 | 
|  FastStartFailoverThreshold 为连接到 DGMGRL 进行配置。 | 在 Oracle 19c 中，默认值为 30 秒，最小值为 6 秒。较低的值可能会缩短失效转移期间的恢复时间目标（RTO）。较高的值有助于降低主数据库上出现不必要的失效转移瞬时错误的可能性。适用于 Oracle 的 RDS Custom 自动化框架监控数据库运行状况并每隔几秒钟执行一次纠正操作。因此，我们建议将值设置 FastStartFailoverThreshold 为大于 10 秒的值。以下示例将阈值配置为 35 秒。**非 CBD 或 CDB**<pre>DGMGRL> edit configuration set property FastStartFailoverThreshold=35;<br />Property "faststartfailoverthreshold" updated<br />DGMGRL> show configuration FastStartFailoverThreshold;<br />FastStartFailoverThreshold = '35'<br />DGMGRL></pre> | 数据库管理员 | 
| 通过从主节点或观察器节点连接到 DGMGRL 来启用 FSFO。 | 如果数据库未启用[闪回数据库](https://docs.oracle.com/en/database/oracle/oracle-database/19/rcmrf/FLASHBACK-DATABASE.html#GUID-584AC79A-40C5-45CA-8C63-DED3BE3A4511)，则会显示警告消息 `ORA-16827`。如果[FastStartFailoverAutoReinstate](https://docs.oracle.com/en/database/oracle/oracle-database/19/dgbkr/oracle-data-guard-broker-properties.html#GUID-824E97C0-EEB0-4E1B-BD4A-F5AE282CEA28)配置属性设置为`TRUE`（这是默认值），则可选的闪回数据库有助于自动将出现故障的主数据库恢复到故障转移之前的时间点。**非 CDB**<pre>DGMGRL> enable fast_start failover;<br />Warning: ORA-16827: Flashback Database is disabled<br />Enabled in Zero Data Loss Mode.<br />DGMGRL> <br />DGMGRL> show configuration<br />Configuration - rds_dg<br />Protection Mode: MaxAvailability<br />Members:<br />orcl_a - Primary database<br />Warning: ORA-16819: fast-start failover observer not started<br />orcl_d - (*) Physical standby database <br />Warning: ORA-16819: fast-start failover observer not started<br />Fast-Start Failover: Enabled in Zero Data Loss Mode<br />Configuration Status:<br />WARNING (status updated 29 seconds ago)<br />DGMGRL></pre>**CDB**<pre>DGMGRL> enable fast_start failover;<br />Warning: ORA-16827: Flashback Database is disabled<br />Enabled in Zero Data Loss Mode.<br />DGMGRL> show configuration;<br />Configuration - rds_dg<br />  Protection Mode: MaxAvailability<br />  Members:<br />  rdscdb_a - Primary database<br />    Warning: ORA-16819: fast-start failover observer not started<br />    rdscdb_b - (*) Physical standby database <br />Fast-Start Failover: Enabled in Zero Data Loss Mode<br />Configuration Status:<br />WARNING   (status updated 11 seconds ago)<br />DGMGRL></pre> | 数据库管理员 | 
| 启动观察器进行 FSFO 监控，然后验证状态。 | 您可以在启用 FSFO 之前或之后启动观察器。如果 FSFO 已启用，则观察器会立即开始监控状态以及与主备用数据库和目标备用数据库的连接。如果未启用 FSFO，则观察器要等到 FSFO 启用后才会开始监控。启动观察器时，将显示主数据库配置而不显示任何错误消息，前述 `show configuration` 命令就是明证。**非 CDB**<pre>DGMGRL> start observer;<br />[W000 2022-12-01T06:16:51.271+00:00] FSFO target standby is orcl_d<br />Observer 'ip-10-0-1-89' started<br />[W000 2022-12-01T06:16:51.352+00:00] Observer trace level is set to USER<br /><br />DGMGRL> show configuration<br />Configuration - rds_dg<br />Protection Mode: MaxAvailability<br />Members:<br />orcl_a - Primary database<br />orcl_d - (*) Physical standby database <br />Fast-Start Failover: Enabled in Zero Data Loss Mode<br />Configuration Status:<br />SUCCESS (status updated 56 seconds ago)<br />DGMGRL> <br /><br />DGMGRL> show observer<br />Configuration - rds_dg<br />Primary: orcl_a<br />Active Target: orcl_d<br />Observer "ip-10-0-1-89" - Master<br />Host Name: ip-10-0-1-89<br />Last Ping to Primary: 1 second ago<br />Last Ping to Target: 1 second ago<br />DGMGRL></pre>**CDB**<pre>DGMGRL> start observer;<br />Succeeded in opening the observer file "/home/oracle/fsfo_ip-10-0-1-56.dat".<br />[W000 2023-01-18T07:31:32.589+00:00] FSFO target standby is rdscdb_b<br />Observer 'ip-10-0-1-56' started<br />The observer log file is '/home/oracle/observer_ip-10-0-1-56.log'.<br /><br />DGMGRL> show configuration<br />Configuration - rds_dg<br />  Protection Mode: MaxAvailability<br />  Members:<br />  rdscdb_a - Primary database<br />    rdscdb_b - (*) Physical standby database <br />Fast-Start Failover: Enabled in Zero Data Loss Mode<br />Configuration Status:<br />SUCCESS   (status updated 12 seconds ago)<br />DGMGRL> <br /><br />DGMGRL> show observer;<br />Configuration - rds_dg<br />  Primary:            rdscdb_a<br />  Active Target:      rdscdb_b<br />Observer "ip-10-0-1-56" - Master<br />  Host Name:                    ip-10-0-1-56<br />  Last Ping to Primary:         1 second ago<br />  Last Ping to Target:          2 seconds ago<br />DGMGRL></pre> | 数据库管理员 | 
| 验证失效转移。 | 在这种情况下，可以通过手动停止主 EC2 实例来执行故障转移测试。在停止 EC2 实例之前，请使用`tail`命令根据您的配置监控观察者日志文件。以用户 `RDS_DATAGUARD` 的身份使用 `DGMGRL` 登录备用数据库 `orcl_d`，并检查 Oracle Data Guard 状态。系统应当表明 `orcl_d` 是新的主数据库。在此失效转移测试场景中，`orcl_d` 是非 CDB 数据库。在失效转移之前，已在 `orcl_a` 上启用闪回数据库。在先前的主数据库恢复在线状态并以 `MOUNT` 状态启动后，观察器将其恢复到新的备用数据库中。恢复后的数据库充当新主数据库的 FSFO 目标。您可以在观察器日志中验证详细信息。<pre>DGMGRL> show configuration<br />Configuration - rds_dg<br />Protection Mode: MaxAvailability<br />Members:<br />orcl_d - Primary database<br />Warning: ORA-16824: multiple warnings, including fast-start failover-related warnings, detected for the database<br />orcl_a - (*) Physical standby database (disabled)<br />ORA-16661: the standby database needs to be reinstated<br />Fast-Start Failover: Enabled in Zero Data Loss Mode<br />Configuration Status:<br />WARNING (status updated 25 seconds ago)<br />DGMGRL></pre>以下显示了 `observer.log` 中的示例输出。<pre>$ tail -f /tmp/observer.log<br />Unable to connect to database using rds_custom_orcl_a<br />[W000 2023-01-18T07:50:32.589+00:00] Primary database cannot be reached.<br />[W000 2023-01-18T07:50:32.589+00:00] Fast-Start Failover threshold has expired.<br />[W000 2023-01-18T07:50:32.590+00:00] Try to connect to the standby.<br />[W000 2023-01-18T07:50:32.590+00:00] Making a last connection attempt to primary database before proceeding with Fast-Start Failover.<br />[W000 2023-01-18T07:50:32.591+00:00] Check if the standby is ready for failover.<br />[S002 2023-01-18T07:50:32.591+00:00] Fast-Start Failover started...<br />2023-01-18T07:50:32.591+00:00<br />Initiating Fast-Start Failover to database "orcl_d"...<br />[S002 2023-01-18T07:50:32.592+00:00] Initiating Fast-start Failover.<br />Performing failover NOW, please wait...<br />Failover succeeded, new primary is "orcl_d"<br />2023-01-18T07:55:32.101+00:00<br />[S002 2023-01-18T07:55:32.591+00:00] Fast-Start Failover finished...<br />[W000 2023-01-18T07:55:32.591+00:00] Failover succeeded. Restart pinging.<br />[W000 2023-01-18T07:55:32.603+00:00] Primary database has changed to orcl_d.<br />[W000 2023-01-18T07:55:33.618+00:00] Try to connect to the primary.<br />[W000 2023-01-18T07:55:33.622+00:00] Try to connect to the primary rds_custom_orcl_d.<br />[W000 2023-01-18T07:55:33.634+00:00] The standby orcl_a needs to be reinstated<br />[W000 2023-01-18T07:55:33.654+00:00] Try to connect to the new standby orcl_a.<br />[W000 2023-01-18T07:55:33.654+00:00] Connection to the primary restored!<br />[W000 2023-01-18T07:55:35.654+00:00] Disconnecting from database rds_custom_orcl_d.<br />[W000 2023-01-18T07:55:57.701+00:00] Try to connect to the new standby orcl_a.<br />ORA-12170: TNS:Connect timeout occurred</pre> | 数据库管理员 | 

### 配置 Oracle Peoplesoft 应用程序和数据库之间的连接
<a name="configure-connectivity-between-the-oracle-peoplesoft-application-and-the-database"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 在主数据库中创建并启动该服务。 | 在配置中有一条 TNS 条目同时包含主数据库端点和备用数据库端点，使用此条目可以避免在角色转换期间更改应用程序配置。您可以定义两个基于角色的数据库服务来同时支持这两个工作负载 read/write 和只读工作负载。在以下示例中，`orcl_rw`是主数据库上处于活动状态的 read/write 服务。 `orcl_ro`是只读服务，在以只读模式打开的备用数据库上处于活动状态。<pre>SQL> select name,open_mode from v$database;<br />NAME OPEN_MODE<br />--------- --------------------<br />ORCL READ WRITE<br />SQL> exec dbms_service.create_service('orcl_rw','orcl_rw');<br />PL/SQL procedure successfully completed.<br />SQL> exec dbms_service.create_service('orcl_ro','orcl_ro');<br />PL/SQL procedure successfully completed.<br /><br />SQL> exec dbms_service.start_service('orcl_rw');<br />PL/SQL procedure successfully completed.<br />SQL></pre> | 数据库管理员 | 
| 在备用数据库中启动服务。 | 要在只读备用数据库中启动该服务，请使用以下代码。<pre>SQL> select name,open_mode from v$database;<br />NAME OPEN_MODE<br />--------- --------------------<br />ORCL READ ONLY WITH APPLY<br />SQL> exec dbms_service.start_service('orcl_ro');<br />PL/SQL procedure successfully completed.<br />SQL></pre> | 数据库管理员 | 
| 在主数据库重新启动时自动启动服务。 | 要在主数据库重新启动时自动启动该服务，请使用以下代码。<pre>SQL> CREATE OR REPLACE TRIGGER TrgDgServices after startup on database<br />DECLARE<br />db_role VARCHAR(30);<br />db_open_mode VARCHAR(30);<br />BEGIN<br />SELECT DATABASE_ROLE, OPEN_MODE INTO db_role, db_open_mode FROM V$DATABASE;<br />IF db_role = 'PRIMARY' THEN<br />DBMS_SERV 2 ICE.START_SERVICE('orcl_rw');<br />END IF;<br />IF db_role = 'PHYSICAL STANDBY' AND db_open_mode LIKE 'READ ONLY%' THEN<br />DBMS_SERVICE.START_SERVICE('orcl_ro');<br />END IF;<br />END;<br />/ <br />Trigger created.<br />SQL> </pre> | 数据库管理员 | 
| 在 read/write 和只读数据库之间配置连接。 | 您可以为 read/write 和只读连接使用以下应用程序配置示例。<pre>ORCL_RW = (DESCRIPTION =<br />(CONNECT_TIMEOUT= 120)(RETRY_COUNT=20)(RETRY_DELAY=3)(TRANSPORT_CONNECT_TIMEOUT=3)<br />(ADDRESS_LIST =<br />(ADDRESS = (PROTOCOL = TCP)(HOST=devpsftdb.******.us-west-2.rds.amazonaws.com)(PORT=1521))<br />(ADDRESS = (PROTOCOL = TCP)(HOST=psftread.******.us-west-2.rds.amazonaws.com)(PORT=1521))<br />)<br />(CONNECT_DATA=(SERVICE_NAME = orcl_rw))<br />)<br />ORCL_RO = (DESCRIPTION =<br />(CONNECT_TIMEOUT= 120)(RETRY_COUNT=20)(RETRY_DELAY=3)(TRANSPORT_CONNECT_TIMEOUT=3)<br />(ADDRESS_LIST =<br />(ADDRESS = (PROTOCOL = TCP)(HOST=devpsftdb.******.us-west-2.rds.amazonaws.com)(PORT=1521))<br />(ADDRESS = (PROTOCOL = TCP)(HOST=psftread.******.us-west-2.rds.amazonaws.com)(PORT=1521))<br />)<br />(CONNECT_DATA=(SERVICE_NAME = orcl_ro))<br />)</pre> | 数据库管理员 | 

## 相关的资源
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle-resources"></a>
+ [在适用于 Oracle 的 Amazon RDS Custom 上使用 Data Guard 启用高可用性](https://d1.awsstatic.com/whitepapers/enabling-high-availability-with-data-guard-on-amazon-rds-custom-for-oracle.pdf)（AWS 技术指南）
+ [将 Amazon RDS 配置为 Oracle PeopleSoft 数据库](https://d1.awsstatic.com/whitepapers/configuring-amazon-rds-as-peoplesoft-database.pdf)（AWS 白皮书）
+ [Oracle Data Guard 代理指南](https://docs.oracle.com/en/database/oracle/oracle-database/19/dgbkr/index.html)（Oracle 参考文档）
+ [Data Guard 概念和管理](https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/index.html)（Oracle 参考文档）
+ [Oracle Data Guard 特定的 FAN 和 FCF 配置要求](https://docs.oracle.com/en/database/oracle/oracle-database/19/dgbkr/using-data-guard-broker-to-manage-switchovers-failovers.html#GUID-DFFDAA2B-A889-49AD-AB85-747D73FF0FF5)（Oracle 参考文档）