oracle database 远程连接

  1. download the latest JDBC driver for dbeaver ojdbc8.jar
    you must login in to download for the very first time.
    for example, if you downloaded ojdbc7.jar, to install this into your maven repository use this
mvn install:install-file -Dfile=ojdbc7.jar  -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar

the output will be like

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /home/yz/.dbeaver-drivers/ojdbc7.jar to /home/yz/.m2/repository/com/oracle/ojdbc7/12.1.0.1/ojdbc7-12.1.0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.491 s
[INFO] Finished at: 2018-10-08T22:59:05+08:00
[INFO] Final Memory: 6M/178M
[INFO] ------------------------------------------------------------------------
  1. open the port on your server.
    or make sure firewall is not running on your server. my centos case
 firewall-cmd --state
  1. sample working tnsnames.ora file on client side
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

  1. sample working listener.ora file on the server side ( just copy the sample file offered by the installation )
LISTENER =
  (ADDRESS_LIST=
        (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
        (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))

change listener.ora HOST=0.0.0.0
to accept all the connections

  1. start the listener process

lsnrctl stat

  1. connect

sqlplus hr/xxxxxxx@localhost/orcl

orcl : database
hr: username
xxxx : password
localhost : server address
change according your need

  1. test from my local fedora to remote tecent cloud server centos 7.4


    image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • ORA-00001: 违反唯一约束条件 (.) 错误说明:当在唯一索引所对应的列上键入重复值时,会触发此异常。 O...
    我想起个好名字阅读 10,791评论 0 9
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    wgl0419阅读 11,477评论 1 9
  • 2018年给自己定了一系列小目标,其中之一就是每月看一本历史/传记类书籍,一月《秦谜》,二月就是这本《苏东坡传》。...
    花子姐姐阅读 3,660评论 1 6
  • 这几天我只做好自己的事,一天专业课和单位的活,让我充实的很少去想阗阗在做什么。 阗阗这几天看到我的时间安排...
    丽萍在这阅读 1,027评论 2 1