建立通訊路徑

建立與 ZDM 服務的通訊路徑,以與來源資料庫和目標資料庫之間的來源資料庫和 SSH 連線進行通訊。

設定通訊

建立來源與目標資料庫之間的通訊,並建立 ZDM 服務的 SSH 金鑰以與來源和目標資料庫通訊。

為了簡化管理,我們將在本機重複使用 ZDM 服務工具公開金鑰並將其新增至來源主機和目標主機。

如果目標資料庫是 Oracle Real Application Clusters (RAC) 資料庫,則必須在 oracle 使用者的 RAC 節點之間設定無密碼的 SSH 連線。

  1. 建立 ZDM 主機的 SSH 金鑰。
    使用預設提示,但不使用密碼詞組。
    ssh-keygen
    建立兩個檔案:id_rsaid_rsa.pub
  2. 建立私密金鑰的副本。
    cp ~/.ssh/id_rsa ~/.ssh/zdm_service_tool.ppk
  3. 使用來源和目標上堡壘主機和資料庫主機的適當 IP 位址編輯命令檔。如果您能夠從本機機器存取來源與目標資料庫,請以本機方式重複使用 ZDM 服務工具公用金鑰,然後將它新增至來源與目標主機。
    # exit out of the zdmuser shell 
    exit
    # copy the public key to the opc user for download
    sudo cp /home/zdmuser/.ssh/id_rsa.pub /home/opc
    # exit the opc user shell, back to local host
    exit
    # copy the public key to the source and target hosts into authorized_keys file 
    ZDM_SERVICE_IP=ZDM_Service_IP_Address
    SOURCE_DB_IP=
    SOURCE_DB_BASTION=
    TARGET_DB_IP=Target_DB_IP_Address
    TARGET_DB_BASTION=
    ZDM_USER=opc
    SOURCE_USER=opc
    TARGET_USER=opc
    ssh ${ZDM_USER}@${ZDM_SERVICE_IP} 'cat /home/zdmuser/.ssh/id_rsa.pub' | ssh -J 
    ${SOURCE_USER}@${SOURCE_DB_BASTION} ${SOURCE_USER}@${SOURCE_DB_IP} 'cat >>
     ~/.ssh/authorized_keys'
    ssh ${ZDM_USER}@${ZDM_SERVICE_IP} 'cat /home/zdmuser/.ssh /id_rsa.pub' | ssh -J
    ${TARGET_USER}@${TARGET_DB_BASTION} ${TARGET_USER}@${TARGET_DB_IP} 'cat >>
    ~/.ssh/authorized_keys'
  4. 如果您無法從本機機器存取來源和目標資料庫,請以授權的金鑰將公開金鑰複製到主機。
    cat id_rsa.pub >> ~/.ssh/ authorized_keys
  5. 確認 zdmuser 具有從 ZDM 服務主機存取來源資料庫的 SSH。
    ssh -i ~/.ssh/zdm_service_tool.ppk opc@target_ip_address
  6. 確認 zdmuser 具有從 ZDM 服務主機存取目標資料庫的 SSH。
    ssh -i ~/.ssh/zdm_service_tool.ppk opc@source_ip_address
  7. 以 root 使用者身分,包含 zdm 服務主機檔案的來源與目標主機名稱查詢。
    請使用完整的網域名稱 (FQDN)。
    # exit zdmuser shell
    exit
    # get root access
    sudo su -
    echo source_db_ip source_FQDN source_hostname >> /etc/hosts
    echo target_db_ip target_FQDN target_hostname >> /etc/hosts
  8. 包括目標主機檔案的來源主機名稱查詢。
    輸入下列的值:source_db_ip sourcetarget_db_ip target_FQDN target_hostnametarget_db_ip target_scan_FQDN target-scan_hostnametarget_db_ipsource_db_ip source_FQDN source_hostnamesource_db_ip source_scan_FQDN source-scan_hostname
    # exit zdmuser shell
    exit
    # ssh command to source host
    ssh opc@source_db_ip 'echo target_db_ip target_FQDN target_hostname >> /etc/hosts'
    ssh opc@source_db_ip 'echo target_db_ip target_scan_FQDN target-scan_hostname >> /etc/hosts'
    # ssh command to target host
    ssh opc@target_db_ip 'echo source_db_ip source_FQDN source_hostname >> /etc/hosts'
    ssh opc@target_db_ip 'echo source_db_ip source_scan_FQDN source-scan_hostname >> /etc/hosts'

測試連線

透過連接埠 1521 測試來源與目標資料庫系統之間的通訊。

  1. 在來源資料庫伺服器上,透過連接埠 1521 測試從來源資料庫伺服器連線至目標資料庫系統的連線。
    tnsping FQDN_source:1521
  2. 在目標資料庫伺服器上,透過連接埠 1521 測試從目標資料庫系統連線至來源資料庫伺服器的連線。
    tnsping FQDN_target:1521