美文网首页
使用plsql访问远程数据库

使用plsql访问远程数据库

作者: wxainn | 来源:发表于2017-07-20 23:09 被阅读0次

    在自己的Oracle安装目录找到以下文件:tnsnames.ora

    例如:

    D:\app\Administrator\product\11.1.0\db_1\NETWORK\ADMIN\tnsnames.ora
    

    打开文件添加以下内容:

    非集群,数据库在一台服务器上:

    名称 =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = ip地址)(PORT = 端口号))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = 数据库实例)
        )
      )
    
    //例如下面这个
    KZJN =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.162.146)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = orcl)
        )
      )
    

    集群,数据库在多台服务器上:

    名称 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = ip地址1)(PORT = 对应端口号))
        (ADDRESS = (PROTOCOL = TCP)(HOST = ip地址1)(PORT = 对应端口号))
        (LOAD_BALANCE = yes)
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SID = 数据库实例)
        )
      )
      
    //例如下面这个
    JQ =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.190.88)(PORT = 1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.190.99)(PORT = 1521))
        (LOAD_BALANCE = yes)
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SID = tmis21)
        )
      )
    

    保存修改后打开plsql,在数据库下拉列表中回多出新添加的内容,选择对应的下拉项,填写用户名密码即可。
    <center>


    这里写图片描述

    </center>

    相关文章

      网友评论

          本文标题:使用plsql访问远程数据库

          本文链接:https://www.haomeiwen.com/subject/kvfskxtx.html