ORA-12545

  • 事情缘由
    星期一下午开始用户反映信用炒作查询功能异常,页面报出ORA-12545:因目标主机或对象不存在,连接失败的错误。咋一看感觉oracle出了问题了,查看了下DB的配置,一切正常啊,最近也没上什么版本,而且该应用有多个数据源,oracle的就有两个,另一个连接非常的正常,这就排除了app server程序的问题。难道是网络问题?在服务器上telnet机器和端口,也能连上。于是赶紧联系运维同学查看DB情况,发现各项服务也正常,sqlplus也登陆正常,这就诡异了,问题出在哪里了呢?突然有一运维同学突然想起来着个表貌似有DB link,DB link是什么东西啊?知识匮乏啊。。。果然是DB link出了问题,DBA更改了DB link服务又正常了。

  • 科普
    1. oracle的oci驱动和thin驱动
    oci/thin 
    JDBC OCI client-side driver: This is a JDBC Type 2 driver that uses Java native methods to call entrypoints in an underlying C library. That C library, called OCI (Oracle Call Interface), interacts with an Oracle database. The JDBC OCI driver requires an Oracle client installation of the same version as the driver.

    The use of native methods makes the JDBC OCI driver platform specific. Oracle supports Solaris, Windows, and many other platforms. This means that the Oracle JDBC OCI driver is not appropriate for Java applets, because it depends on a C library.

    JDBC Thin client-side driver: This is a JDBC Type 4 driver that uses Java to connect directly to Oracle. It implements Oracle's SQL*Net Net8 and TTC adapters using its own TCP/IP based Java socket implementation. The JDBC Thin driver does not require Oracle client software to be installed, but does require the server to be configured with a TCP/IP listener.

    Because it is written entirely in Java, this driver is platform-independent. The JDBC Thin driver can be downloaded into any browser as part of a Java application. (Note that if running in a client browser, that browser must allow the applet to open a Java socket connection back to the server.)

    JDBC Thin server-side driver: This is another JDBC Type 4 driver that uses Java to connect directly to Oracle. This driver is used internally within the Oracle database. This driver offers the same functionality as the client-side JDBC Thin driver (above), but runs inside an Oracle database and is used to access remote databases.
        从上面的解释可以得出以下结论:
         1)oci必须安装客服端才能连接oracle,而thin不需要,可以直接连接oracle
         2)thin是通过java实现的tcp/ip的socket通信,可以直接连接oracle服务端;oci是通过java 本地方法调用C library跟oracle服务端通信,这个C library就叫 oci,需要客户端提供
         3)两种连接方式:jdbc:oracle:thin:@10.1.1.2:1521:shdb   
     jdbc:oracle:oci:@shdb
    2. DB link
        
    database link是定义一个数据库到另一个数据库的路径的对象,database link允许你查询远程表及执行远程程序。在任何分布式环境里,database都是必要的。另外要注意的是database link是单向的连接。下面是一个DBA写的关于DB link的基础知识,通俗易懂
    http://www.dbabeta.com/2008/oracle_database_link_basics.html?1341415384#sec1

猜你喜欢

转载自yaomeone.iteye.com/blog/1577052