感谢作者:Tim Ford. 图文并茂。

原帖地址:

http://www.mssqltips.com/sqlservertip/1433/how-to-setup-linked-servers-for-sql-server-and-oracle-64-bit-client/

Problem
We have two SQL 2005 64-bit clusters in our organization:  a four-node production cluster and a two-node dev/test cluster.  We recently migrated a database from SQL 2000 that relied on an Oracle linked server for some of it's computations.  No big deal, right?  Install the Oracle client software and create the linked server just like in SQL 2000 right?  Be sure to repeat the process on both nodes for failover-sake, right?  Wrong.  In the case of 64-bit SQL instances we have a few extra steps we need to take to get an Oracle linked server configured and working properly.

Solution
64-bit computing is coming of age.  In most cases, our installation and configuration processes do not change from 32-bit to 64-bit: setting up logins, creating SQL Agent jobs; nothing inherently different there.  Inconsistencies do exist however.  Take for example linked servers - more specifically linked servers to Oracle databases.  In 32-bit environments we simply install the Oracle client software, create the linked server, add remote logins and move on to the next project.  In the 64-bit world the process is slightly more difficult - and in the case of one critical step it impacts any existing users on the instance!

Process Creating Oracle Linked Server on a 64-bit SQL Instance:

  • Install Oracle 10g Release 2 64-bit client software (available from Oracle website)
  • Install Oracle 10g Release 2 64-bit ODAC software (available from Oracle website)
  • Restart SQL services
  • Configure OraOLEDB.Oracle provider
  • Create linked server
  • Add remote logins for linked server

The complete process is presented below:


Step One:  Installation of the Oracle 10g Release 2 64-bit client software

I will leave it up to you to secure the software by either download from their site or media available via any licensing agreements you may have with Oracle.  The important steps are outlined below.  You only need the barest install of the client.  Simply go ahead and select the InstantClient option from the opening dialog form and click Next.

The following screens simply require you to click Next when enabled.  These are in place to present the internal checks and summaries of work to be completed once you accept the install parameters.  Proceed through the screens, click Install, and then Finish once the installation is complete.


Step Two:  Installation Oracle 10g Release 2 64-bit ODAC software

Once you have an installed 64-bit Oracle Home you can proceed with installing the ODAC drivers for a 64-bit environment.  The OraOLEDB.Oracle driver installed in this step is what you need to set up your linked server.  You'll find the setup.exe for this installation located in the unzipped Install folder.  I strongly suggest you review your previous installation of the client software via selecting the Installed Products button.  You want to verify that you have a valid 64-bit Oracle Home that you'll be installing against during this process.  We would not be DBAs if we were not overly cautious.  It's quite Darwinian:  the brash and risky don't last long as Database Administrators.

If you accepted the defaults during the client installation, your "Installed Products" Inventory should appear as follows.  If so, then close the dialog and click Next to continue.  If not, then I suggest you revisit your installation of the client software, possibly de-installing and performing all steps presented previously once again.

We will be installing the OraOLEDB.Oracle driver that is included in the Oracle Data Access Components option below.  Select Next to continue.

Using the drop-down box provided, select the existing Oracle Home you just verified was created as a part of your 64-bit Oracle client installation.  The Path will automatically change accordingly.  Continue by clicking Next.

You will be presented with the following sub-components.  I've selected all three (you never know when these items may be useful and they are extremely lightweight) though you only really need to install the first two items.

If you do decide to install the Oracle Services for Microsoft Transaction Server component, you'll be prompted for the port number to use.  The default is 2030.

Click Next and you'll be presented with the familiar summary screen, listing all components to be installed.  Review, make changes if necessary and then click Install.  Once completed we can move back to familiar territory:  SQL Server Management Studio.


Step Three:  Restart SQL Service

This is the most unfortunate step in the entire process.  This is usually the last thing a DBA wants to do.  It is the option of last resort whenever there is an issue on a SQL Server instance.  However, it is necessary in this case, so be sure to follow your corporate procedures for downtime notifications and process.  That being said, let's move past this horrid step!


Step Four:  Configure OraOLEDB.Oracle provider

I confess.  I was not aware of this process existing until I had to do this the first time.  In Object Explorer, navigate down the tree of the SQL instance we've been working with until you're able to view the list of Providers under Linked Servers.  Select OraOLEDB.Oracle and right-click.

SQL Server Management Studio.

The Provider Options dialog box appears.  Enable the "Allow inprocess" option and close the dialog.  Now ask yourself:  "Self, what did I just do?  Some Internet Guy said click this and it will work."  Let's take a quick look at exactly what enabling this option does for a provider.  By default, OLE DB providers are instantiated outside of the SQL Server process.  While this protects SQL from any OLE DB errors, Microsoft SQL Server requires that the OLE DB provider run in-process for handling BLOB-ish data types (text and images).


Step 5:  Create Linked Server and Add Logins

Finally, something we're all familiar with.  The T-SQL is simple, and identical to the 32-bit platform.

--Create the Oracle Linked Server:  
EXEC sp_addlinkedserver @server, @srvproduct, @provider, @datasrc

--For example: If I want to create a linked server called LK_TIPS to the ORATIPS 
--database on the SRVORA1 server, listening on the default port of 1521 my query 
--would look like this: 
EXEC sp_addlinkedserver 'LK_TIPS', 'Oracle', 'OraOLEDB.Oracle', 'SRVORA1:1521/ORATIPS' 

A quick explanation about the @datasrc parameter.  Since our environment is clustered I do not like relying on an Oracle TNSname.ora file for our connection information.  It is far cleaner to specify the data source in terms of the SERVER:PORT/DB_NAME format.

As for creating an associated login the format is:

--Create the Remote Login for the Oracle Linked Server: 
EXEC sp_addlinkedsrvlogin @rmtsrvname, @useself, @rmtuser, @rmtpassword

Briefly, the @useself parameter determines whether the current user in connects to the linked server source under its current context or via impersonation.  By setting the value to FALSE you're stating that you wish to connect to the linked server with a supplied login/password combination that is being identified in the @rmtuser and @rmtpassword parameters respectively.  A value of TRUE would suggest that a login will use it's own (current) credentials to connect to the linked server.

Creating a login for the LK_TIPS linked server we just created with a login of 'sa' and a password set to 'password' would look like this:

EXEC sp_addlinkedsrvlogin 'LK_TIPS', 'FALSE', 'sa', 'password'

Before you get any crazy ideas, I don't suggest using sa/password as a combination for any system!

Next Steps

  • Tweak T-SQL code provided to fit your environment
  • If this is being configured in a cluster, be sure to install the Oracle client and ODAC components identically on all nodes in the cluster.
  • Review related tips on linked servers on MSSQLTips.com.

Last Update: 2/13/2008

转载于:https://www.cnblogs.com/snake-hand/p/3159649.html

How to setup linked servers for SQL Server and Oracle 64 bit client相关推荐

  1. sql查询oracle数据,sql-server – 从SQL Server查询Oracle数据库

    我有一个Oracle 11g XE数据库,我想将其转移到SQL Server Express 2005中. 起初我以为我只是在Oracle中生成表作为SQL,操纵数据格式,并在SQL Server中运 ...

  2. SQL Server 与 ORACLE 的区别

    sql server 与  oracle的区别:    DBMS 数据库管理系统 1.数据类型不同.   sql server 的数据类型:int ,smallint ,char,varchar,nc ...

  3. sql server转oracle需要注意的几点

    sql server转oracle需要注意的几点 1.  字符型的字段相加需要用"||",如果用"+"的话,会报"无效的数字"的错误. 2. ...

  4. C#连接4种类型数据库(Access、SQL Server、Oracle、MySQL)

    C#连接4种类型数据库(Access.SQL Server.Oracle.MySQL) 1.C#连接连接Access using System.Data; using System.Data.OleD ...

  5. sql server配置连接oracle数据库,MS SQL Server连接Oracle

    MS SQL Server连接Oracle 1.  安装oracle 10G客户端 要访问oracle数据库必须安装oracle客户端.安装oracle客户端有两种方式,即完整安装和立即安装,这两种方 ...

  6. SQL Server与Oracle、DB2三种数据库比较

    开发数据库应用,选择一个好的数据库是非常重要的.本文从一些方面比较了SQL Server与Oracle.DB2三种数据库,为你选择数据库提供一些参考. 开放性 SQL Server 只能在Window ...

  7. oracle+循环插入sql,SQL server,Oracle循环插入百万数据

    SQL server,Oracle循环插入百万数据 SQL server,Oracle循环插入百万数据 压测时常需要往数据库插入大量数据,下面是我往两个数据库插入数据时用的脚本 declare @ma ...

  8. Sql Server和oracle的函数区别总结

    最近要对之前的项目从Sql Server数据库转化为Oracle数据库,期间遇到的一些问题总结一下: S代表SQL Server,O代表Oracle 1.取当前系统时间 S:Select Getdat ...

  9. MS SQL Server和Oracle对数据库事务处理的差异性

    背景 在吉日嘎拉的软件编程走火入魔之:数据库事务处理入门(适合初学者阅读)文章中关于MS SQL Server和Oracle对数据库事务处理的差异性引起一些争论,因此记录我对数据库事务处理的想法. 简 ...

最新文章

  1. 500万张图片,20万处地标风景,谷歌又放出大型数据集
  2. 完全理解python迭代对象_完全理解Python迭代对象、迭代器、生成器
  3. Windows Pe 第三章 PE头文件-EX-相关编程-2(RVA_FOA转换)
  4. 揭秘富人的22种习惯与风格
  5. 直播预告 | 长文本知识抽取:基于语义分割的文档级三元组关系抽取
  6. python---[列表]lsit
  7. 上位机与基恩士plc以太网通讯_2020湛江AB罗克韦尔PLC主机回收二手或全新
  8. 谷歌大脑推出视觉领域任务自适应基准:VTAB
  9. 常用类中的方法 —— java.util.Map
  10. shell脚本批量生成配置文件
  11. Oracle新建用户、角色,授权,建表空间
  12. JavaScript 的语法(网摘)
  13. 住在我隔壁储藏室的大学刚毕业的小夫妻[转载]
  14. uniapp app 腾讯云 IM 通讯 UserSig 加密协议方案
  15. Spirent TestCenter指定端口上配置OSPFv2 Router
  16. 计算机音乐谱子十年,十年曲谱钢琴曲_十年 钢琴谱
  17. 高效的中文字符串截取函数
  18. 计算机机房管理系统 数据库课设,学校机房管理系统数据库课程设计.doc
  19. [DFS/递推/DP] 2327 [SCOI2005] 扫雷 ( 普及+/提高
  20. 【服务器数据恢复】VMFS文件系统RAID5硬盘故障的数据恢复案例

热门文章

  1. 一文尽览 CVPR 2022 workshop 所有算法竞赛
  2. 当时尚遇上AI!港中文MMLab开源MMFashion工具箱
  3. 厉害了!谷歌新发布的半监督学习算法降低4倍错误率
  4. numpy.random随机数模块常用函数总结
  5. linux系统安装升级win10双系统,Win10 安装Linux ubuntu-18.04双系统(安装指南)
  6. android复位机器人图片_Universal-Image-Loader 图片异步加载类库还不熟?
  7. 为什么要 conda 作用_烤箱预热有什么作用?为什么烘焙一定要预热烤箱?怎么正确预热?...
  8. 华为已经升级鸿蒙系统的机型,鸿蒙系统名单已确认!覆盖55款机型,这些手机将被淘汰!...
  9. java3d曲面图开发_web三维图表的开发
  10. Realsense的使用