Posted on 2009-09-27 14:56
波波^_^ 阅读(382)
评论(0) 编辑 收藏
1.安装好Oracle 9.0.1 Database for Windows后,会发现在%ORACLE_HOME%下有目录tg4msql,以及网关程序$ORACLE_HOME\BIN\tg4msql;
2. 确保在c:\winnt\system32下有ntwdblib.dll,若没有则安装SQL Server2000(安装类型选择“仅连接”)。此文件是访问SQL Server的DB-Library;
3. ping SQLDB看是否通,若不通则在\winnt\system32\drivers\etc\hosts文件中增加一行,用来解析SQLDB的IP地址,很简单不多说了。
4. 修改%ORACLE_HOME%\tg4msql\inittg4msql.ora,这是网关进程启动时需要的初始化文件。只需改下面这一行即可:
HS_FDS_CONNECT_INFO=SQLDB.luck #此处的SQLDB是SqlServer数据库的实例名,luck是要访问的数据库名
5. Listener的配置如下
# LISTENER.ORA Network Configuration File: d:\oracle\ora92\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MICROSOF-E676C1)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = d:\oracle\ora92)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = luck)
(ORACLE_HOME = d:\oracle\ora92)
(SID_NAME = luck)
)
(SID_DESC=
(SID_NAME=tg4msql)
(ORACLE_HOME=d:\oracle\ora92) #用你的%ORACLE_HOME%
(PROGRAM=tg4msql) # 必须指向‘tg4msql’
)
)
/************************/以下为新增加内容
(SID_DESC=
(SID_NAME=tg4msql)
(ORACLE_HOME=d:\oracle\ora92) #用你的%ORACLE_HOME%
(PROGRAM=tg4msql) # 必须指向‘tg4msql’
)
/************************/
5. 修改tnsnames.ora
在原来的服务名称下面增加一个服务名,代码如下:
TG4MSQL =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST= localhost) #透明网关所在机器地址
(PORT = 1521)
)
(CONNECT_DATA =
(SID = tg4msql) #tg4msql必须要和GATEWAY上listener.ora中的SID一致
)
(HS = OK) #这很重要,告诉Oracle Server要调用异构服务模块来处理
)
6. 修改initora9i.ora(数据库初始化文件)
global_names=true,重启数据库。
7. create public database link test connect to sa identified by luckserver using 'TG4MSQL';
8. select * from usertable@test;
通过如上步骤就可以再oracle中访问SqlServer了。