ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 通过透明网关访问MSQL

通过透明网关访问MSQL

原创 Linux操作系统 作者:jifei0611 时间:2009-04-01 20:20:19 0 删除 编辑
        ORACLE从8i起开始提供Transparent Gateway实现异构数据库之间的互访.在ORACLE 8i和ORACLE 9i中Transparent Gateway可以从oracle server安装盘安装,从ORACLE 10g开始Transparent Gateway
作为一个单独的组件提供下载,ORACLE 10gR2 Transparent Gateway 下载地址为:
http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201winsoft.html
ORACLE 11g提供了Linux下for msql的Transparent Gateway,下载地址为: http://www.oracle.com/technology/software/products/database/oracle11g/111060_linuxsoft.html
环境说明:
ORACLE Version: ORACLE 10g R2
ORACLE DB主机10.182.15.55:  OS:Linux AS4U2 Software:Oracle
Transparent Gateway主机10.182.16.143:  OS:Windows 2003 Software: Transparent Gateway
MSQL Version:2005
MSQL主机:10.182.15.80:  OS:Windows 2003 Software:msql 2005
配置Transparent Gateway初始参数文件
目录:ORACLE_HOME\tg4msql\admin(ORACLE_HOME:Transparent Gateway安装目录)
文件命名格式init.ora
inittest.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Transparent Gateway for SQL Server
#
# HS init parameters
#
HS_FDS_CONNECT_INFO="SERVER=10.182.15.80;DATABASE=oak"
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
在安装完Transparent Gateway的后会生成一个初始化参数文件inittg4msql.ora你可以复制这个文件进行修改,如果要访问多个MSQL DB就需要多个初始化参数文件
配置Transparent Gateway listener文件
# listener.ora Network Configuration File: d:\oracle\product\10.2.0\tg_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = test)
      (ORACLE_HOME = d:\oracle\product\10.2.0\tg_1)
      (PROGRAM =tg4msql)
    )   
  )
LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.16.143)(PORT = 1521))
  )
SID_NAME:为Transparent Gateway初始化参数中的SID
Transparent Gateway主机不需要tnsnaes.ora文件
在ORACLE DB主机的tnsnames.ora文件中添加下面的内容
TEST =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.16.143)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = test)
    )
    (HS = OK)
  )
创建DB Link
create public databse link msql connect to “oak” identified by “oak” using ‘test’;
在创建DB Link时密码必须用双引号引号起来,否会报下面的错误:
ERROR 在行 1:
ORA-28500: 从 ORACLE 到非 Oracle 系统的联机传回如下讯息:
[Transparent gateway for MSSQL][Microsoft][ODBC SQL Server Driver][SQL
Server]使用者 'OAK' 的登入失败。 (SQL State: 00000; SQL Code: 18456)
ORA-02063: 在 2 lines 之前, 自 MSQL
验证是否成功
SQL> select * from test@msql;
若Windows上相应的端口,如1521,1433没有打开会报下面的错误,建议把防火墙关掉
ERROR at line 1:
ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from MSQL
SQL> select * from test@msql;
运行上的SQL后没有反应,按Ctrl +c报下的错                   *
ERROR at line 1:
ORA-28522: error initializing heterogeneous capabilities
ORA-28522: error initializing heterogeneous capabilities
ORA-28559: FDS_CLASS_NAME is MSSQL10.2.0.1.0_200, FDS_INST_NAME is test
ORA-02063: preceding 3 lines from MSQL
ORA-00604: error occurred at recursive SQL level 1
ORA-24274: no row exists in the HS$_FDS_CLASS table for these parameters
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_HS_UTL", line 431
ORA-06512: at "SYS.DBMS_HS_CHK", line 147
ORA-06512: at "SYS.DBMS_HS_UTL", line 46
ORA-06512: at "SYS.DBMS_HS", line 38
ORA-06512: at line 1
解决方法:
运行$ORACLE_HOME/rdbms/admin下的caths.sql
若还是不能解决,先运行$ORACLE_HOME/rdbms/admin下的catnohs.sql,再运行caths.sql

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7419833/viewspace-584293/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-01-12

  • 博文量
    143
  • 访问量
    276309