Registration "Oracle Provider for OLE DB" and create a linked server

      Sql server database created on the linked server, connect oracle database access interface needs to be set: " the Oracle Provider for OLE DB."

If the computer does not have this, the installation procedure is a complete Oracle11gR2 an effective method, but the 64-bit version of the application has more than 2 G,

It is enormous, if only to establish a link server, absolutely no need to install such a monster. In fact, we only need to download the compressed package to ODAC .

How to sum up the following registration: "Oracle Provider for OLE DB" this drive:

 

Part1.注册“Oracle Provider for OLE DB”:

1. Download ODAC112030Xcopy_x64.zip:

  Download: http://download.csdn.net/detail/u014019244/9061209

 

2. Extract ODAC112030Xcopy_x64.zip (I extract to the C drive):

 

3. At the command line interface into operation unzip the folder "install.bat oledb c: \ oracle odac" Installation:

 

4. In the system environment variable, add Path "C: \ oracle; C: \ oracle \ bin;"

(Computer Properties - Advanced System Settings - Advanced - Environment Variables - System environment variables -Path):

 

 

Select the "Environment Variables" in the "system variables" in the "Path", click on the "Edit" button,

Add on top "C: \ oracle; C: \ oracle \ bin;"

 

 

5. Restart your computer.

 

After finish the above operations, turn on the machine SQL Server Management Studio, when New Linked Server,

"Provider" drop-down box "Oracle Provider for OLE DB" appears.

 

 

Part2.新建链接服务器:

  1. 打开本机SQL Server Management Studio连接到本机数据库;
  2. 展开“服务器对象”;
  3. 选择“链接服务器”-右键-“新建链接服务器”;
  4. 在“新建链接服务器”的窗口里,选择“常规”;
  5. 输入“链接服务器名称”(检验用英文字符名称);
  6. “服务器类型”选择“其他数据源”;
  7. “访问接口”选择“Oracle Provider for OLE DB”;
  8. “产品名称”输入“oracle”;
  9. “数据源”输入:(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.xxx.xxx)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = orcl)))

其中host是oracle数据库所在的服务器的ip;

 

 

10.在“安全性”界面,勾选“使用此安全上下文建立连接”,输入“远程登录”和“使用密码”(oracle的登录名和密码):

 

11.“服务器选项”的界面的设置如下图:

 

 

 

查询测试“链接服务器”是否成功创建,如下图:

 

sql server数据库使用链接服务器查询oracle数据库的语法:

  SELECT * FROM OPENQUERY(SWAPDB,'select xxx from 表名')

 

如果出现错误“无法创建链接服务器 "xxx" 的 OLE DB 访问接口 "OraOLEDB.Oracle" 的实例。 (Microsoft SQL Server,错误: 7302)”

,请参考下面这篇文章解决:

http://www.cnblogs.com/527289276qq/p/5917351.html

Guess you like

Origin www.cnblogs.com/jijm123/p/12275987.html