啟動監測器並啟用快速啟動容錯移轉

在個別的可用性區域中安裝 Azure 運算 VM 上的監測器,並且啟用快速啟動容錯移轉。
監測器是內建於 DGMGRL CLI 的低足跡從屬端,而且與其他從屬端一樣,可以在與資料庫伺服器不同的硬體平台上執行。

資料保全中介可將資料保全組態的建立、維護及監控自動化並集中化。它可讓您透過中介的用戶端介面,在本機或遠端執行所有管理作業:

  • Oracle Enterprise Manager Cloud Control,或
  • Data Guard 命令行介面 DGMGRL
DGMGRL 命令行是 Oracle AI Database 軟體安裝的一部分,可從 $ORACLE_HOME/bin/dgmgrl 取得。請依照下列步驟啟用快速啟動容錯移轉:
  1. 在監測器 VM 上下載並安裝 Oracle AI Database 從屬端。若為 Linux x64:
    unzip LINUX.X64_2326100_client.zip
    cd client
    ./runInstaller
    
  2. 建立含有主要和待命資料庫之連線字串的 tnsnames.ora 檔案。使用建議的連線字串搭配 SCAN 名稱:

    編輯監測器 VM 上的 $ORACLE_HOME/network/admin/tnsnames.ora

    vi $ORACLE_HOME/network/admin/tnsnamse.ora
    
    DBZONE1=(DESCRIPTION=(CONNECT_TIMEOUT= 90)(RETRY_COUNT=100)(RETRY_DELAY=3)(TRANSPORT_CONNECT_TIMEOUT=1000ms)(LOAD_BALANCE=off)(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=scan-vmcluster-1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME = DBzone1.ocidelegatedsu.ocivnet1.oraclevcn.com)))
    
    DBZONE2=(DESCRIPTION=(CONNECT_TIMEOUT= 90)(RETRY_COUNT=100)(RETRY_DELAY=3)(TRANSPORT_CONNECT_TIMEOUT=1000ms)(LOAD_BALANCE=off)(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=scan-mvcluster-2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME = DBzone2.ocidelegatedsu.ocivnet2.oraclevcn.com)))
    
    haservice = (DESCRIPTION =
    (CONNECT_TIMEOUT= 90)(RETRY_COUNT=100)(RETRY_DELAY=3)(TRANSPORT_CONNECT_TIMEOUT=1000ms)(LOAD_BALANCE=off)
        (ADDRESS_LIST =
            (LOAD_BALANCE=on)
            (ADDRESS = (PROTOCOL = TCP)(HOST=scan-vmcluster-1)(PORT=1521)))
        (ADDRESS_LIST =
            (LOAD_BALANCE=on)
            (ADDRESS = (PROTOCOL = TCP)(HOST=scan-vmcluster-2)(PORT=1521)))      
        (CONNECT_DATA=(SERVICE_NAME = haservice.oracle.com)))
  3. 驗證主要資料庫和待命資料庫的連線。
    export TNS_ADMIN=$ORACLE_HOME/network/admin
    
    dgmgrl SYS@DBZONE1
    ...
    Connected to "DBzone1"
    Connected as SYSDBA.
                
    dgmgrl SYS@DBZONE2
    ...
    Connected to "DBzone2"
    Connected as SYSDBA.
    
  4. 檢查資料保全組態與「快速啟動容錯移轉」目標設定值。
    DGMGRL> show configuration
    Configuration - db26_dgconf
      Protection Mode: MaxAvailability
      Members:
      DBzone1 - Primary database
        DBzone2 - Physical standby database
    Fast-Start Failover:  Disabled
    Configuration Status:
    SUCCESS   (status updated 20 seconds ago)
    
    DGMGRL> show database DBzone1 FastStartFailoverTarget;
      FastStartFailoverTarget = 'DBzone2'
    
    DGMGRL> show database DBzone2 FastStartFailoverTarget;
      FastStartFailoverTarget = 'DBzone1'
  5. 在監測器 VM 上啟動監測器處理作業。如果要在背景執行監測器:
    export WALLET_DIR=/u01/app/oracle/product/23.26.0/dbhome_1/network/admin/wallet
    mkstore -wrl $WALLET_DIR -create
    mkstore -wrl $WALLET_DIR -createCredential 'DBZONE1' sysdg <password>;
    mkstore -wrl $WALLET_DIR -createCredential 'DBZONE2' sysdg <password>;
    mkstore -wrl $WALLET_DIR -createCredential 'HASERVICE' sysdg <password>;
    
    vi /u01/app/oracle/product/23.26.0/dbhome_1/network/admin/sqlnet.ora
    WALLET_LOCATION = (SOURCE = (METHOD = FILE) (METHOD_DATA = (DIRECTORY = /u01/app/oracle/product/23.26.0/dbhome_1/network/admin/wallet)))
    SQLNET.WALLET_OVERRIDE = TRUE
    
    dgmgrl SYS@DBZONE1
    DGMGRL> START OBSERVER observer3 IN BACKGROUND FILE IS /home/oracle/observer3.dat LOGFILE IS /home/oracle/observer3.log CONNECT IDENTIFIER IS haservice;
    Submitted command "START OBSERVER" using connect identifier "haservice"
    
    DGMGRL> show observer
    Configuration - db26_dgconf
      Fast-Start Failover:     DISABLED
    Observer "observer3"(23.26.0.0.0)
      Host Name:                    fsfovm3
      Last Ping to Primary:         6 seconds ago
      Log File:                     /home/oracle/observerz3.log
      State File:                   /home/oracle/observerz3.dat
  6. 為組態啟用「快速啟動容錯移轉」。
    DGMGRL> enable fast_start failover
    Enabled in Zero Data Loss Mode.
  7. 請確定監測器和組態狀態顯示啟用「快速啟動容錯移轉」。
    DGMGRL> show observer
    Configuration - db26_dgconf
      Fast-Start Failover:     ENABLED
      Primary:            DBzone1
      Active Target:      DBzone2
    Observer "observer3"(23.26.0.0.0) - Master
      Host Name:                    fsfovm3
      Last Ping to Primary:         1 second ago
      Last Ping to Target:          2 seconds ago
      Log File:                     /home/oracle/observerz3.log
      State File:                   /home/oracle/observerz3.dat
    
    DGMGRL> show configuration
    Configuration - db26_dgconf
      Protection Mode: MaxAvailability
      Members:
      DBzone1 - Primary database
        DBzone2 - (*) Physical standby database
    Fast-Start Failover: Enabled in Zero Data Loss Mode
    Configuration Status:
    SUCCESS   (status updated 13 second ago)
    
    DGMGRL> show fast_start failover
    Fast-Start Failover: Enabled in Zero Data Loss Mode
    ...

監測器正在執行中,而且啟用資料保全組態的「快速啟動容錯移轉」。