oracle 11g的sqlserver透明网关已经可以装在任何机器上了,不用再装在sqlserver端了
一、环境:
gateway与oracle数据库装在同一台机器上,ip:10.10.10.1
sqlserver在另一台机器上,ip:10.10.10.10
oracle版本10.2
gateway版本11.2
oracle安装目录:/u01/app/oracle/product/10.2.1/db_1
gateway安装目录:/home/gateway/gwhome
二、创建用户gateway,用户组与oracle用户组相同就形
uid=501(gateway) gid=206(oinstall) groups=206(oinstall),207(dba)
修改环境变量
export ORACLE_HOME=/home/gateway/gwhome
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$ORACLE_HOME/bin:$PATH
三、创建/home/gateway/gwhome目录
四、安装gateway软件,选择相应的sqlserver组件,最后配置监听的时候选择执行典型配置就可以了
五、配置网关
1.修改监听/home/gateway/gwhome/network/admin/listener.ora
注意(SID_NAME=test)的test必须对应参数文件的名称,也就是参数文件名称应该为inittest.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC=
(SID_NAME=test)
(ORACLE_HOME=/home/gateway/gwhome)
(PROGRAM=dg4msql)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.1)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /home/gateway/gwhome
2.修改参数文件/home/gateway/gwhome/dg4msql/admin/inittest.ora
HS_FDS_CONNECT_INFO=[10.10.10.10]:1433//test
# alternate connect format is hostname/serverinstance/databasename
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
3.修改数据库tns文件/u01/app/oracle/product/10.2.1/db_1/network/admin/tnsnames.ora,加入以下内容
dg4msql =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.1)(PORT=1521))
(CONNECT_DATA=(SID=test))
(HS=OK)
)
4.创建DBLINK测试
create database link test connect to sa identified by test using 'dg4msql';
六、监听共享问题
数据库可以和网关用同一个监听,如果想用不同监听那把网关监听端口和tns里的端口改一下就行了