建立通信路径

使用 ZDM 服务建立通信路径,以便与源数据库和目标数据库以及源数据库和目标数据库之间的 SSH 连接进行通信。

设置通信

在源数据库和目标数据库之间建立通信,并为 ZDM 服务创建 SSH 密钥以与源数据库和目标数据库通信。

为了简化管理,我们将在本地重用 ZDM 服务工具公钥,并将其添加到源主机和目标主机。

如果目标数据库是 Oracle Real Application Clusters (RAC) 数据库,则必须在 RAC 节点之间为 oracle 用户设置无密码 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 服务 hosts 文件中。
    使用全限定域名 (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