ORCLE建立ODBC数据源后建立database link 访问SQLServer

在客户现场有个需求,A系统为oracle11g64位,B系统为sqlserver2008。现在需要A系统通过oracle创建database link连接的方式访问B系统的数据库。因两个数据库类型不一样。经过查询资料后有两种方式可以满足此种需求:第一种通过按照oracle版本对应的gateway。建立透明连接的方式。这种方式研究了一下没有做成。第二种方式:通过oracle的ODBC管理员创建ODBC数据源,使用该数据圆访问B系统;
    如何建立odbc连接的数据源此处不再描述,以下介绍第二种的配置方法:
    网上关于这个的配置方法很多,但是按照其配置后总是出现这样或者那样的问题。现在把配置文件内容贴出来供以后配置使用:
  
    listener.ora(D:\oarcle\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora)---开始:
   
    # listener.ora Network Configuration File: D:\oarcle\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.

   SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = D:\oarcle\app\Administrator\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = erp_bom)
      (ORACLE_HOME = D:\oarcle\app\Administrator\product\11.2.0\dbhome_1)
      (PROGRAM = dg4odbc) --10g数据库时此处应该为(PROGRAM = hsodbc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = USER-20140615NL)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = D:\oarcle\app\Administrator

listener.ora(D:\oarcle\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora)---结束

tnsnames.ora (D:\oarcle\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora)---开始
# tnsnames.ora Network Configuration File: D:\oarcle\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.

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

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


ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )
erp_bom =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = erp_bom)
    )
    (HS=OK)
  )
tnsnames.ora (D:\oarcle\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora)---结束

listener.ora( D:\oarcle\app\Administrator\product\11.2.0\dbhome_1\hs\admin\initerp_bom.ora )----开始

# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC

#
# HS init parameters
#
HS_FDS_CONNECT_INFO = erp_bom
HS_FDS_TRACE_LEVEL = OFF


#
# Environment variables required for the non-Oracle system
#
#set <envvar>=<value>
listener.ora( D:\oarcle\app\Administrator\product\11.2.0\dbhome_1\hs\admin\initerp_bom.ora )----结束 

你可能感兴趣的:(orale,sqlserver,database link,odbc)