oracle实现异种数据库连接服务的技术叫做透明网关(transparent gateway)。
目前oracle利用透明网关可以实现和sql server、sybase、db2等多种主流数据库的互联。
现在通过oracle访问sybase数据库,把配置oracle9i transparent gateway for sybase
的步骤写成文档,供需要的网友参考!
配置transparent gateway for sybase步骤
1.
oracle所在服务器上安装sybase client(或者在同一台server上安装oracle、sybase服务器)
确保能够访问sybase数据库
2.
安装transparent gateway for sybase选件,要用自定义安装。
正确选择sybase的安装目录
3.
选择一个sid字符串准备赋给sybase数据库。如:tg4sybs
设置sybase的dll路径到环境变量path(这一步很重要)
4.
修改初始化文件,默认的是:
oracle_home\tg4sybs\admin\inittg4sybs.ora
设置参数
hs_fds_connect_info
格式:hs_fds_connect_info= server_name. database_name[,interface= interface_file]
server_name. database_name是大小写敏感的。
interface可选
例子:如下
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
# this is a sample agent init file that contains the hs parameters that are
# needed for the transparent gateway for sybase
#
# hs init parameters
#
hs_fds_connect_info=migration_serv.tax
hs_fds_trace_level=off
hs_fds_recovery_account=recover
hs_fds_recovery_pwd=recover
#
# environment variables required for sybase
#
set sybase=d: ybase
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
上例中
server_name是migration_serv
database_name是tax
5.
配置oracle网络服务的listener,配置文件是:listener.ora
默认路径:oracle_home\network\admin
加入如下
sid_list_listener=
(sid_list=
(sid_desc=
(sid_name= gateway_sid)
(oracle_home= oracle_home_directory)
(program=tg4sybs)
)
)
gateway_sid就是3选择的sid字符串
oracle_home_directory是oracle_home
tg4sybs若是sybase是特定的。如果是其他数据库,会不同。
例子如下:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
(sid_desc=
(sid_name=tg4sybs)
(oracle_home = d:\oracle\ora92)
(program=tg4sybs)
)
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
6.
停止监听
lsnrctl stop
重新启动监听程序
lsnrctl start
7.
配置oracle server的tnsnames.ora使其能够访问sybase
connect_descriptor=
(description=
(address=
(protocol=tcp)
(host= host_name)
(port= port_number)
)
(connect_data=
(sid= gateway_sid))
(hs=ok))
connect_descriptor是连接串,任取,一般为sybs
host_name:oracle server的name
port_number:oracle监听端口
gateway_sid就是3选择的sid字符串
例子如下:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
sybs=
(description=
(address_list =
(address=(protocol=tcp)(host= dw-server1)(port= 1521))
)
(connect_data=
(sid= tg4sybs)
)
(hs=ok)
)
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
8.建立database link
如:
create database link sybs connect to sa
identified by prient
using sbys ;
即可访问sybase 数据库。
需要注意的是,sybase数据库的表名,字段名,如果是小写的,那么在oracle里访问的时候要加上双引号””
如:
sql〉select “a” from “b”@sybs;