SqlServer链接服务器连接ORACLE,安装ORACLE client,配置odbc与tnsnames

1、安装ORACLE client,从官网下载;

2、tnsnamse配置:

tnsnames路径



配置tnsnames,多个节点代表多个服务器

3、odbc配置

使用搜索功能查询到对应版本的odbc数据源
输入在tnsnameszhong中配置的tns service name
点击Test Connection,输入密码点击ok,测试成功则

4、建立链接服务器

USE [master]

GO

/****** Object:  LinkedServer [ORCL]    Script Date: 2019/10/16 9:59:32 ******/

EXEC master.dbo.sp_addlinkedserver @server = N'ORCL', @srvproduct=N'ORACLE', @provider=N'MSDASQL', @datasrc=N'192.168.0.66/ORCL'

/* For security reasons the linked server remote logins password is changed with ######## */

EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'ORCL',@useself=N'False',@locallogin=NULL,@rmtuser=N'TEST20190122',@rmtpassword='TEST20190122'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'collation compatible', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'data access', @optvalue=N'true'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'dist', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'pub', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'rpc', @optvalue=N'true'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'rpc out', @optvalue=N'true'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'sub', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'connect timeout', @optvalue=N'0'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'collation name', @optvalue=null

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'lazy schema validation', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'query timeout', @optvalue=N'0'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'use remote collation', @optvalue=N'true'

GO

EXEC master.dbo.sp_serveroption @server=N'ORCL', @optname=N'remote proc transaction promotion', @optvalue=N'true'

GO


建立成功

5、测试查询

大功告成

你可能感兴趣的:(SqlServer链接服务器连接ORACLE,安装ORACLE client,配置odbc与tnsnames)