如何将SQL Server数据库配置到TNSNAME.ora中?

nfeuvbwi  于 2022-11-28  发布在  SQL Server
关注(0)|答案(2)|浏览(147)

我已经创建了指向SQL Server数据库的到Oracle数据库的数据库链接。如果已为此SQL Server数据库正确配置ODBC,我还在Oracle数据库服务器上安装了Oracle Gateways for SQL Server。
当我尝试在Oracle数据库上执行此SQL请求时:

SELECT * FROM obbud@qualiactst

(qualiactst is my DBLink :
-- PROMPT CREATE DATABASE LINK qualiactst
CREATE DATABASE LINK qualiactst
  CONNECT TO iac IDENTIFIED BY ***** USING 'RIATST';

)

错误信息显示如下:

ORA-12154: TNS : could not resolve the connect identifier specified

我已经使用以下命令配置了Oracle数据库服务器的tnsname.ora文件:

RIATST =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = grensql2k12R2-1)(PORT = 14539))
    )
    (CONNECT_DATA = (SID = RIATST))
    (HS=OK)
  )

(but我真的不知道是否必须将非oracle数据库添加到tnsname.ora中)
我不明白我做错了什么,是否缺少了一些东西。
你能帮我吗?非常感谢
让娜

wvmv3b1j

wvmv3b1j1#

看起来您没有在目标主机(grensql 2k 12 R2 -1)上设置侦听器,或者没有配置HS初始化文件。
一般来说,试着按照这个指南去做。有太多的细节不能在一个答案中检查每一个。

ru9i0ody

ru9i0ody2#

用于与异类MSSQL数据库通信。有两个选项。
1)为SQL Server使用专用的Oracle数据库网关。为SQL Server配置Oracle数据库网关2)为ODBC配置Oracle数据库网关。为ODBC配置Oracle数据库网关
为SQL Server配置Oracle数据库网关的简单示例
系统管理员

HS_FDS_CONNECT_INFO=host_name:port_name//database_name

ORACLE_HOME\网络\管理\监听程序.ora

SID_LIST_LISTENER=

############# MS SQL ####################
   (SID_LIST=
      (SID_DESC= 
         (SID_NAME=dg4msql)
         (ORACLE_HOME=oracle_home_directory)
         (PROGRAM=dg4msql)
      )
   )
##########################################

重新启动监听程序

lsnrctl stop
lsnrctl start

ORACLE_HOME\网络\管理员\tnsnames.ora

connect_descriptor_mssql=
   (DESCRIPTION=
      (ADDRESS=
         (PROTOCOL=TCP)
         (HOST=host_name_oracle_gateway_host)
         (PORT=port_number_listener_1521)
      )
      (CONNECT_DATA=
         (SID=dg4msql))
      (HS=OK))


SQL> CREATE PUBLIC DATABASE LINK name_dblink CONNECT TO "user" IDENTIFIED BY "password" USING 'connect_descriptor_mssql';
 SQL> SELECT * FROM DUAL@dblink;

来自生产服务器Oracle www.example.com的示例11.2.0.4
/主目录/Oracle/应用程序/Oracle/产品/11.2.0/数据库主目录_1/dg 4 msql/管理员/初始化

HS_FDS_CONNECT_INFO=[10.89.250.87]:1433/

/主目录/Oracle/应用程序/Oracle/产品/11.2.0/数据库主目录_1/dg 4 msql/管理员/初始化

HS_FDS_CONNECT_INFO=[10.89.250.88]:1433/

/主目录/Oracle/应用程序/Oracle/产品/11.2.0/数据库主目录_1/网络/管理员/监听器.ora

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1525))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.89.251.242)(PORT = 1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
        (GLOBAL_DBNAME = ssps)
        (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
        (SID_NAME = ssps)
    )
     (SID_DESC=
        (SID_NAME=tch8)
        (ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1)
        (PROGRAM=dg4msql)
          )
    (SID_DESC=
         (SID_NAME=tch7)
         (ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1)
         (PROGRAM=dg4msql)
         )

  )
ADR_BASE_LISTENER = /home/oracle/database

/主目录/Oracle/应用程序/Oracle/产品/11.2.0/数据库主目录_1/网络/管理员/事务名称.ora

SSPS_1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.89.251.242)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ssps)
    )
  )


atch7 =
  (DESCRIPTION=
      (ADDRESS=(PROTOCOL=tcp)(HOST= 10.89.251.242)(PORT=1521))
      (CONNECT_DATA=(SID=tch7))
      (HS=OK)
    )

atch8 =
  (DESCRIPTION=
      (ADDRESS=(PROTOCOL=tcp)(HOST=10.89.251.242)(PORT=1521))
      (CONNECT_DATA=(SID=tch8))
      (HS=OK)
    )



 CREATE DATABASE LINK ATCH7.GIFT.KRSK.MPS
      CONNECT TO "asuzm_link" IDENTIFIED BY <ENTER USER PASSWORD HERE>
      USING 'atch7'
    /

CREATE DATABASE LINK ATCH8.GIFT.KRSK.MPS
  CONNECT TO "asuzm_link" IDENTIFIED BY <ENTER USER PASSWORD HERE>
  USING 'atch8'
/

相关问题