oracle gateway11g透明网关连接sql server2005

时间:2021-11-01 20:45:53

oracle 10g要与SqlServer 2005数据同步,采用透明网关的方式可以在oracle端直接访问SqlServer。

1、背景:

    oracle数据库:oracle 10g(端口号1521)

    透明网关: oracle gateway11g(端口号1522)

    SqlServer: 2005(端口号1433)

注:透明网关跟oracle端口号不能一样

  三个在同一台机器上

2、安装透明网关:

    安装路径最好跟oracle一致;填写一下主机名和数据库名

3、配置initdg4msql.ora文件:

 路径是:E:\oracle\product\11.2.0\tg_1\dg4msql\admin\initdg4msql.ora(gateway下的)

HS_FDS_CONNECT_INFO=192.168.0.88:1433//zyCenter   #主机名:端口号//数据库名
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER

注:文件名是initSID.ora,即我的SID为dg4msql,SID后面会用到

4、配置listener.ora

路径:E:\oracle\product\11.2.0\tg_1\NETWORK\ADMIN\listener.ora(gateway下的)

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = dg4msql)
      (ORACLE_HOME = E:\oracle\product\11.2.0\tg_1)
      (PROGRAM = dg4msql)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = MS-201409091029)(PORT = 1522))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
    )
  )

ADR_BASE_LISTENER = E:\oracle\product\11.2.0\tg_1
      

注:SID_NAME=SID;ORACLE_HOME是gateway的路径;PROGRAM=dg4msql不要更改

5、配置listener.ora:

路径:E:\oracle\product\10.2.0\db_1\network\admin\listener.ora(oracle服务器路径下的)

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME =
dg4msql)
      (ORACLE_HOME =
E:\oracle\product\10.2.0\db_1)
      (PROGRAM = dg4msql)
    )

  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = MS-201409091029)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

注:SID_NAME = SID;ORACLE_HOME oracle服务器路径;PROGRAM = dg4msql不需要更改

6、配置tnsnames.ora:

   路径是:E:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora(oracle服务器路径下的)

    添加以下代码:

     dg4msql =      #SID名称
   (DESCRIPTION = 
     (ADDRESS_LIST = 
       (ADDRESS = (PROTOCOL = TCP)(HOST=MS-201409091029)(PORT=1522))    #gateway端口号
     ) 
     (CONNECT_DATA = 
       (SID = dg4msql)  #SID名称
     ) 
     (HS=OK) 
   )

7、创建DBLink

create database link DG4MSQL connect to SA identified by sa using 'dg4msql';

8、测试:

select * from dbo.area@dg4msql