oracle 如何修复 SSIS 中的错误“Ora-12154 TNS 无法解析服务名称”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1058500/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 18:28:59  来源:igfitidea点击:

How to fix error 'Ora-12154 TNS could not resolve service name' in SSIS?

sql-serveroraclessis

提问by

When MS-SQL Server 2000 dtsx job tries to run, gets error Ora-12154 TNS could not resolve service nameTnsping to the oracle service to connect replies OK. The Windows 2003 x64 Server that runs the dtsx jobs has 32 bit Oracle Server, ODAC 32 bit and Oracle Client 32 bit installed.

当 MS-SQL Server 2000 dtsx 作业尝试运行时,获取错误Ora-12154 TNS could not resolve service nameTnspi​​ng 到 oracle 服务以连接回复 OK。运行 dtsx 作业的 Windows 2003 x64 服务器安装了 32 位 Oracle 服务器、32 位 ODAC 和 32 位 Oracle 客户端。

回答by Bill

The TNSNames setting on a machine may be user specific. i.e. The connection might work logged in as you, but fail when it runs under the SQLAgent user. At our location, we use a networked TNS Names file, and set a system environment variable on the server. This forces it to use the same TNS names file for all users:

机器上的 TNSNames 设置可能是用户特定的。即连接可能以您的身份登录,但在 SQLAgent 用户下运行时会失败。在我们的位置,我们使用联网的 TNS Names 文件,并在服务器上设置系统环境变量。这会强制它为所有用户使用相同的 TNS 名称文件:

TNS ADMIN = \\server\path\ORACLE

TNS 管理员 = \\服务器\路径\ORACLE

回答by Raj

Kayhan YüKSEL,

凯汉·尤克塞尔,

  1. You have mention SQL 2000 and dtsx. Which one is it?
  2. You have mentioned 64 bit server. Is SQL also 64 bit?
  3. You have also mentioned "job". Is this SQL Agent job?
  1. 您提到了 SQL 2000 和 dtsx。哪一个?
  2. 您提到了 64 位服务器。SQL 也是 64 位的吗?
  3. 您还提到了“工作”。这是 SQL 代理的工作吗?

If this is SQL 2005/8 64 bit and this is indeed a scheduled job, then you are having the famous 64 bit Vs. 32 bit issue.

如果这是 SQL 2005/8 64 位并且这确实是预定作业,那么您将拥有著名的 64 位 Vs。32位问题。

The SQL agent will run in 64 bit and cannot see any of your 32 bit drivers. Do you have the 64 bit Oracle data provider installed?

SQL 代理将在 64 位上运行并且看不到您的任何 32 位驱动程序。您是否安装了 64 位 Oracle 数据提供程序?

If the tnsnames.ora is not in the default location, you will need the TNS_NAMES environmental variable set. Also make sure that you are referring to the Oracle server with the correct registered name in your SSIS package.

如果 tnsnames.ora 不在默认位置,您将需要 TNS_NAMES 环境变量集。还要确保在 SSIS 包中使用正确的注册名称引用 Oracle 服务器。

Raj

拉吉