美文网首页
oracle database 远程连接

oracle database 远程连接

作者: e43ef8a56980 | 来源:发表于2018-10-07 22:16 被阅读0次
  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

相关文章

网友评论

      本文标题:oracle database 远程连接

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