

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Amazon RDS Custom for Oracle 上 Oracle PeopleSoft 應用程式的轉換角色
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle"></a>

*sampath kathirvel，Amazon Web Services*

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

若要在 Amazon Web Services (AWS) 上執行 [Oracle PeopleSoft](https://www.oracle.com/applications/peoplesoft/) 企業資源規劃 (ERP) 解決方案，您可以使用 [Amazon Relational Database Service (Amazon RDS)](https://aws.amazon.com/rds/) 或 [Amazon 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>

**先決條件 **
+ [使用僅供讀取複本模式完成在 Amazon RDS Custom 上將 HA 新增至 Oracle PeopleSoft](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/add-ha-to-oracle-peoplesoft-on-amazon-rds-custom-by-using-a-read-replica.html)。

**限制 **
+ [RDS Custom for Oracle](https://docs.amazonaws.cn/en_us/AmazonRDS/latest/UserGuide/custom-reqs-limits.html#custom-reqs-limits.limits) 的限制和不支援的組態
+ 與 [Amazon RDS Custom for Oracle 僅供讀取複本](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-rr.html#custom-rr.limitations)相關聯的限制

**產品版本**
+ 如需 Amazon RDS Custom 支援的 Oracle 資料庫版本，請參閱 [RDS Custom for Oracle](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 資料庫執行個體類別，請參閱 [RDS Custom for Oracle 的資料庫執行個體類別支援](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-reqs-limits.html#custom-reqs-limits.instances)。

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

**技術堆疊**
+ Amazon RDS Custom for Oracle

**目標架構**

下圖顯示 Amazon RDS Custom 資料庫執行個體和 Amazon RDS Custom 僅供讀取複本。Oracle Data Guard 在 DR 的容錯移轉期間提供角色轉換。

![\[具有僅供讀取複本資料庫之主要 RDS Custom 資料庫執行個體的 Oracle Data Guard 切換。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/da3b011c-1668-4de4-9079-0982888a74b4/images/4e2a2f3b-b5bd-44b7-9b5a-13a663ee3be6.png)


如需在 AWS 上使用 Oracle PeopleSoft 的代表性架構，請參閱[在 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>

**AWS 服務**
+ [Amazon RDS Custom for Oracle](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) 可協助您使用以程式設計方式擷取秘密的 API 呼叫取代程式碼中的硬式編碼登入資料，包括密碼。在此模式中，您會從秘密名稱`RDS_DATAGUARD`為 的 Secrets Manager 擷取資料庫使用者密碼`do-not-delete-rds-custom-+<<RDS Resource ID>>+-dg`。

**其他服務**
+ [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>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 暫停主要和複本的資料庫自動化。 | 雖然 RDS Custom 自動化架構不會干擾角色轉換程序，但最好在 Oracle Data Guard 切換期間暫停自動化。若要暫停和繼續 RDS Custom 資料庫自動化，請遵循[暫停和繼續 RDS Custom 自動化](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-managing.html#custom-managing.pausing)中的指示。 | 雲端管理員，DBA | 
| 檢查 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> | DBA | 
| 驗證執行個體角色。 | 開啟 AWS 管理主控台，然後導覽至 Amazon RDS 主控台。在資料庫的**複寫**區段的**連線與安全**索引標籤上，驗證主要和複本的執行個體角色。主要角色應與 Oracle Data Guard 主要資料庫相符，而複本角色應與 Oracle Data Guard 實體待命資料庫相符。 | 雲端管理員，DBA | 
| 執行切換。 | 若要執行切換，`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> | DBA | 
| 驗證 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> | DBA | 
| 在 Amazon RDS 主控台上驗證執行個體角色。 | 在您執行角色切換後，Amazon RDS 主控台會在**資料庫****連線與安全**索引標籤的**複寫**區段下顯示新角色。**複寫狀態**可能需要幾分鐘的時間才能從空白更新為**複寫**。 | DBA | 

### 設定 FSFO
<a name="configure-fsfo"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 重設切換。 | 將切換設回主節點。 | DBA | 
| 安裝並啟動觀察者。 | 觀察者程序是`DGMGRL`用戶端元件，通常在與主要和待命資料庫不同的機器中執行。觀察者的 ORACLE HOME 安裝可以是 Oracle Client Administrator 安裝，也可以安裝 Oracle Database Enterprise Edition 或 Personal Edition。如需資料庫版本的觀察程式安裝詳細資訊，請參閱[安裝和啟動觀察程式](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_tw/prescriptive-guidance/latest/patterns/transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle.html)對於 Oracle 12c 版本 2 和更新版本，您最多可以部署三個觀察者。一個觀察者是主要觀察者，其餘則是備份觀察者。當主要觀察者失敗時，其中一個備份觀察者會擔任主要角色。 | DBA | 
| 從觀察者主機連線至 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> | DBA | 
| 將待命資料庫修改為容錯移轉目標。 | 從主節點或觀察者節點連線到一個待命資料庫。（雖然您的初始化可能具有 mulitiple 待命資料庫，但您目前只需要連線到一個。)**非 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> | DBA | 
| 為 DGMGRL 的連線設定 FastStartFailoverThreshold。 | 在 Oracle 19c 中，預設值為 30 秒，最小值為 6 秒。較低的值可能會縮短容錯移轉期間的復原時間目標 (RTO)。較高的值有助於降低主要資料庫發生不必要的容錯移轉暫時性錯誤的機率。RDS Custom for Oracle 自動化架構會監控資料庫運作狀態，並每隔幾秒執行修正動作。因此，我們建議將 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> | DBA | 
| 從主要節點或觀察者節點連線至 DGMGRL 以啟用 FSFO。 | 如果資料庫未啟用 [Flashback 資料庫](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> | DBA | 
| 啟動觀察者以進行 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> | DBA | 
| 驗證容錯移轉。 | 在此案例中，可以透過手動停止主要 EC2 執行個體來執行容錯移轉測試。在停止 EC2 執行個體之前，請使用 `tail`命令，根據您的組態監控觀察者日誌檔案。使用 `DGMGRL`以`orcl_d`使用者 登入待命資料庫`RDS_DATAGUARD`，並檢查 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> | DBA | 

### 設定 Oracle Peoplesoft 應用程式與資料庫之間的連線
<a name="configure-connectivity-between-the-oracle-peoplesoft-application-and-the-database"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 在主要資料庫中建立和啟動服務。 | 您可以使用同時包含組態中主要和待命資料庫端點的 TNS 項目，以避免角色轉換期間的應用程式組態變更。您可以定義兩個角色型資料庫服務，以支援讀取/寫入和唯讀工作負載。在下列範例中， `orcl_rw`是主要資料庫上作用中的讀取/寫入服務。 `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> | DBA | 
| 在待命資料庫中啟動服務。 | 若要在唯讀待命資料庫中啟動服務，請使用下列程式碼。<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> | DBA | 
| 重新啟動主要資料庫時，自動啟動服務。 | 若要在重新啟動時在主要資料庫中自動啟動服務，請使用下列程式碼。<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> | DBA | 
| 設定讀取/寫入和唯讀資料庫之間的連線。 | 您可以針對讀取/寫入和唯讀連線使用下列應用程式組態範例。<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> | DBA | 

## 相關資源
<a name="transition-roles-for-an-oracle-peoplesoft-application-on-amazon-rds-custom-for-oracle-resources"></a>
+ [使用 Amazon RDS Custom for Oracle 上的 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 Broker 指南 ](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 參考文件）