截至本文撰寫為止,RDS Custom for Oracle 不支援多可用區選項,此選項可供 Amazon RDS for Oracle 使用儲存複寫做為 HA 解決方案使用。反之,此模式會使用建立和維護主要資料庫實體複本的待命資料庫來達成 HA。此模式著重於使用 Oracle Data Guard 設定僅供讀取複本,在具有 HA 的 Amazon RDS Custom 上執行 PeopleSoft 應用程式資料庫的步驟。
此模式也會將僅供讀取複本變更為唯讀模式。讓僅供讀取複本處於唯讀模式,可提供額外的優點:
從主要資料庫卸載唯讀工作負載
使用 Oracle Active Data Guard 功能從待命資料庫擷取運作狀態良好的區塊,以啟用損毀區塊的自動修復
使用 Far Sync 功能讓遠端待命資料庫保持同步,而不會產生與長途重做日誌傳輸相關聯的效能額外負荷。
在唯讀模式下使用複本需要 Oracle Active Data Guard 選項,因為這是 Oracle Database Enterprise Edition 的單獨授權功能,因此需要支付額外費用。
依預設,僅供讀取複本會在 MOUNT 模式中建立。若要以唯讀模式開啟它,您首先需要DGMGRL從主要節點或待命節點連線至 來關閉重做套用。
非 CDB
DGMGRL> show database orcl_dDGMGRL> show database orcl_d
Database - orcl_d
Role: PHYSICAL STANDBY
Intended State: APPLY-ONTransport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 0 seconds (computed 1 second ago)
Average Apply Rate: 11.00 KByte/s
Real Time Query: OFFInstance(s):
ORCLDatabase Status:
SUCCESSDGMGRL> edit database orcl_d set state=apply-off;
Succeeded.
DGMGRL> show database orcl_d
Database - orcl_d
Role: PHYSICAL STANDBY
Intended State: APPLY-OFFTransport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 42 seconds (computed 1 second ago)
Average Apply Rate: (unknown)
Real Time Query: OFFInstance(s):
ORCLDatabase Status:
SUCCESSDGMGRL>
CDB
DGMGRL>showconfigurationDGMGRL>showconfigurationConfiguration-rds_dgProtection Mode:MaxAvailabilityMembers:rdscdb_a-Primarydatabaserdscdb_b-PhysicalstandbydatabaseFast-Start Failover:DisabledConfiguration Status:SUCCESS(statusupdated57secondsago)DGMGRL>showdatabaserdscdb_b;Database-rdscdb_bRole:PHYSICALSTANDBYIntended State:APPLY-ONTransport Lag:0seconds(computed1secondago)Apply Lag:0seconds(computed1secondago)Average Apply Rate:2.00KByte/sReal Time Query:OFFInstance(s):RDSCDBDatabase Status:SUCCESSDGMGRL>editdatabaserdscdb_bsetstate=apply-off;Succeeded.DGMGRL>showdatabaserdscdb_b;Database-rdscdb_bRole:PHYSICALSTANDBYIntended State:APPLY-OFFTransport Lag:0seconds(computed1secondago)Apply Lag:0seconds(computed1secondago)Average Apply Rate:(unknown)Real Time Query:OFFInstance(s):RDSCDBDatabase Status:SUCCESS
DBA
以唯讀模式開啟僅供讀取複本執行個體。
使用 TNS 項目連接至待命資料庫,並從主要節點或待命節點連接至待命資料庫,以唯讀模式開啟。
非 CDB
$ sqlplus RDS_DATAGUARD@RDS_CUSTOM_ORCL_D as sysdg
-bash-4.2$ sqlplus RDS_DATAGUARD@RDS_CUSTOM_ORCL_D as sysdg
SQL*Plus: Release19.0.0.0.0- Production on Fri Sep 3023:00:142022
Version 19.10.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Enter password:
Last Successful login time: Fri Sep 30202222:48:27+00:00
Connected to:
Oracle Database 19c Enterprise Edition Release19.0.0.0.0- Production
Version 19.10.0.0.0SQL>select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
SQL>alter database open read only;
Database altered.
SQL>select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLYSQL>
CDB
-bash-4.2$ sqlplus C##RDS_DATAGUARD@RDS_CUSTOM_RDSCDB_B as sysdg
SQL*Plus: Release19.0.0.0.0- Production on Wed Jan 1121:14:072023
Version 19.16.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Enter password:
Last Successful login time: Wed Jan 11202321:12:05+00:00
Connected to:
Oracle Database 19c Enterprise Edition Release19.0.0.0.0- Production
Version 19.16.0.0.0SQL>select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
RDSCDB MOUNTED
SQL>alter database open read only;
Database altered.
SQL>select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
RDSCDB READ ONLYSQL>
DBA
啟用重做會套用至僅供讀取複本執行個體。
使用主要節點或待命節點中的 DGMGRL,在僅供讀取複本執行個體上啟用重做。
非 CDB
$dgmgrlRDS_DATAGUARD@RDS_CUSTOM_ORCL_DDGMGRL for Linux:Release19.0.0.0.0-ProductiononFriSep3023:02:162022Version19.10.0.0.0Copyright(c)1982,2019,Oracleand/oritsaffiliates.Allrightsreserved.WelcometoDGMGRL,type"help"forinformation.Password:Connectedto"ORCL_D"ConnectedasSYSDG.DGMGRL>editdatabaseorcl_dsetstate=apply-on;DGMGRL>editdatabaseorcl_dsetstate=apply-on;Succeeded.DGMGRL>showdatabaseorcl_dDatabase-orcl_dRole:PHYSICALSTANDBYIntended State:APPLY-ONTransport Lag:0seconds(computed0secondsago)Apply Lag:0seconds(computed0secondsago)Average Apply Rate:496.00KByte/sReal Time Query:ONInstance(s):ORCLDatabase Status:SUCCESSDGMGRL>
CDB
-bash-4.2$dgmgrlC##RDS_DATAGUARD@RDS_CUSTOM_RDSCDB_B-bash-4.2$dgmgrlC##RDS_DATAGUARD@RDS_CUSTOM_RDSCDB_BDGMGRL for Linux:Release19.0.0.0.0-ProductiononWedJan1121:21:112023Version19.16.0.0.0Copyright(c)1982,2019,Oracleand/oritsaffiliates.Allrightsreserved.WelcometoDGMGRL,type"help"forinformation.Password:Connectedto"RDSCDB_B"ConnectedasSYSDG.DGMGRL>editdatabaserdscdb_bsetstate=apply-on;Succeeded.DGMGRL>showdatabaserdscdb_bDatabase-rdscdb_bRole:PHYSICALSTANDBYIntended State:APPLY-ONTransport Lag:0seconds(computed0secondsago)Apply Lag:0seconds(computed0secondsago)Average Apply Rate:35.00KByte/sReal Time Query:ONInstance(s):RDSCDBDatabase Status:SUCCESSDGMGRL>showdatabaserdscdb_bDatabase-rdscdb_bRole:PHYSICALSTANDBYIntended State:APPLY-ONTransport Lag:0seconds(computed1secondago)Apply Lag:0seconds(computed1secondago)Average Apply Rate:16.00KByte/sReal Time Query:ONInstance(s):RDSCDBDatabase Status:SUCCESSDGMGRL>
DBA
將複本狀態從掛載變更為唯讀,並啟用重做
任務
描述
所需的技能
停止重做會套用至待命資料庫。
依預設,僅供讀取複本會在 MOUNT 模式中建立。若要以唯讀模式開啟它,您首先需要DGMGRL從主要節點或待命節點連線至 來關閉重做套用。
非 CDB
DGMGRL> show database orcl_dDGMGRL> show database orcl_d
Database - orcl_d
Role: PHYSICAL STANDBY
Intended State: APPLY-ONTransport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 0 seconds (computed 1 second ago)
Average Apply Rate: 11.00 KByte/s
Real Time Query: OFFInstance(s):
ORCLDatabase Status:
SUCCESSDGMGRL> edit database orcl_d set state=apply-off;
Succeeded.
DGMGRL> show database orcl_d
Database - orcl_d
Role: PHYSICAL STANDBY
Intended State: APPLY-OFFTransport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 42 seconds (computed 1 second ago)
Average Apply Rate: (unknown)
Real Time Query: OFFInstance(s):
ORCLDatabase Status:
SUCCESSDGMGRL>
CDB
DGMGRL>showconfigurationDGMGRL>showconfigurationConfiguration-rds_dgProtection Mode:MaxAvailabilityMembers:rdscdb_a-Primarydatabaserdscdb_b-PhysicalstandbydatabaseFast-Start Failover:DisabledConfiguration Status:SUCCESS(statusupdated57secondsago)DGMGRL>showdatabaserdscdb_b;Database-rdscdb_bRole:PHYSICALSTANDBYIntended State:APPLY-ONTransport Lag:0seconds(computed1secondago)Apply Lag:0seconds(computed1secondago)Average Apply Rate:2.00KByte/sReal Time Query:OFFInstance(s):RDSCDBDatabase Status:SUCCESSDGMGRL>editdatabaserdscdb_bsetstate=apply-off;Succeeded.DGMGRL>showdatabaserdscdb_b;Database-rdscdb_bRole:PHYSICALSTANDBYIntended State:APPLY-OFFTransport Lag:0seconds(computed1secondago)Apply Lag:0seconds(computed1secondago)Average Apply Rate:(unknown)Real Time Query:OFFInstance(s):RDSCDBDatabase Status:SUCCESS
DBA
以唯讀模式開啟僅供讀取複本執行個體。
使用 TNS 項目連接至待命資料庫,並從主要節點或待命節點連接至待命資料庫,以唯讀模式開啟。
非 CDB
$ sqlplus RDS_DATAGUARD@RDS_CUSTOM_ORCL_D as sysdg
-bash-4.2$ sqlplus RDS_DATAGUARD@RDS_CUSTOM_ORCL_D as sysdg
SQL*Plus: Release19.0.0.0.0- Production on Fri Sep 3023:00:142022
Version 19.10.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Enter password:
Last Successful login time: Fri Sep 30202222:48:27+00:00
Connected to:
Oracle Database 19c Enterprise Edition Release19.0.0.0.0- Production
Version 19.10.0.0.0SQL>select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
SQL>alter database open read only;
Database altered.
SQL>select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLYSQL>
CDB
-bash-4.2$ sqlplus C##RDS_DATAGUARD@RDS_CUSTOM_RDSCDB_B as sysdg
SQL*Plus: Release19.0.0.0.0- Production on Wed Jan 1121:14:072023
Version 19.16.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Enter password:
Last Successful login time: Wed Jan 11202321:12:05+00:00
Connected to:
Oracle Database 19c Enterprise Edition Release19.0.0.0.0- Production
Version 19.16.0.0.0SQL>select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
RDSCDB MOUNTED
SQL>alter database open read only;
Database altered.
SQL>select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
RDSCDB READ ONLYSQL>
DBA
啟用重做會套用至僅供讀取複本執行個體。
使用主要節點或待命節點中的 DGMGRL,在僅供讀取複本執行個體上啟用重做。
非 CDB
$dgmgrlRDS_DATAGUARD@RDS_CUSTOM_ORCL_DDGMGRL for Linux:Release19.0.0.0.0-ProductiononFriSep3023:02:162022Version19.10.0.0.0Copyright(c)1982,2019,Oracleand/oritsaffiliates.Allrightsreserved.WelcometoDGMGRL,type"help"forinformation.Password:Connectedto"ORCL_D"ConnectedasSYSDG.DGMGRL>editdatabaseorcl_dsetstate=apply-on;DGMGRL>editdatabaseorcl_dsetstate=apply-on;Succeeded.DGMGRL>showdatabaseorcl_dDatabase-orcl_dRole:PHYSICALSTANDBYIntended State:APPLY-ONTransport Lag:0seconds(computed0secondsago)Apply Lag:0seconds(computed0secondsago)Average Apply Rate:496.00KByte/sReal Time Query:ONInstance(s):ORCLDatabase Status:SUCCESSDGMGRL>
CDB
-bash-4.2$dgmgrlC##RDS_DATAGUARD@RDS_CUSTOM_RDSCDB_B-bash-4.2$dgmgrlC##RDS_DATAGUARD@RDS_CUSTOM_RDSCDB_BDGMGRL for Linux:Release19.0.0.0.0-ProductiononWedJan1121:21:112023Version19.16.0.0.0Copyright(c)1982,2019,Oracleand/oritsaffiliates.Allrightsreserved.WelcometoDGMGRL,type"help"forinformation.Password:Connectedto"RDSCDB_B"ConnectedasSYSDG.DGMGRL>editdatabaserdscdb_bsetstate=apply-on;Succeeded.DGMGRL>showdatabaserdscdb_bDatabase-rdscdb_bRole:PHYSICALSTANDBYIntended State:APPLY-ONTransport Lag:0seconds(computed0secondsago)Apply Lag:0seconds(computed0secondsago)Average Apply Rate:35.00KByte/sReal Time Query:ONInstance(s):RDSCDBDatabase Status:SUCCESSDGMGRL>showdatabaserdscdb_bDatabase-rdscdb_bRole:PHYSICALSTANDBYIntended State:APPLY-ONTransport Lag:0seconds(computed1secondago)Apply Lag:0seconds(computed1secondago)Average Apply Rate:16.00KByte/sReal Time Query:ONInstance(s):RDSCDBDatabase Status:SUCCESSDGMGRL>