TOAD for Oracle 和 Windows 7:无法初始化 OCI。错误 -1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12185690/
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-10 04:26:48  来源:igfitidea点击:

TOAD for Oracle and Windows 7: Can't initialize OCI. Error -1

oraclewindows-732-bittoad

提问by DMolinaVzla

I have a problem with TOAD for Oracle 9.1 running on Windows 7 32-bit, described as follows:

我在 Windows 7 32 位上运行 TOAD for Oracle 9.1 时遇到问题,描述如下:

I have Oracle OraClient10g 10.0.2 installed on my PC, and I need to use Toad 9.1. When I try to log into a server, I specify the database via TNS, I type the user name and password, but I get a message with the following error:

我的 PC 上安装了 Oracle OraClient10g 10.0.2,我需要使用 Toad 9.1。当我尝试登录服务器时,我通过 TNS 指定了数据库,我输入了用户名和密码,但是我收到一条包含以下错误的消息:

Can't initialize OCI. Error -1

无法初始化 OCI。错误 -1

Googling around I got several options which include: check that the ORACLE_HOME environment variable is set right, run TOAD as administrator, check that the user name and password are correct, install Oracle and TOAD for 32-bit system... I have checked all those options but I am still getting the error.

谷歌搜索我得到了几个选项,其中包括:检查 ORACLE_HOME 环境变量设置是否正确,以管理员身份运行 TOAD,检查用户名和密码是否正确,为 32 位系统安装 Oracle 和 TOAD……我已经检查了所有这些选项,但我仍然收到错误消息。

There is, however, a detail I should mention: In my start menu, there are two Oracle Homes (Home1 and Home2). Home 2 points to an empty folder because I reinstalled Oracle during my attempts to solve the problem, and the short cut is still in my start menu. I don't think this is important, though, because ORACLE_HOME is pointing to the right home.

但是,我应该提到一个细节:在我的开始菜单中,有两个 Oracle Homes(Home1 和 Home2)。Home 2 指向一个空文件夹,因为我在尝试解决问题时重新安装了Oracle,并且快捷方式仍然在我的开始菜单中。不过,我认为这并不重要,因为 ORACLE_HOME 指向正确的家。

I really need help with this. I need to solve this error and log in using TOAD.

我真的需要这方面的帮助。我需要解决这个错误并使用 TOAD 登录。

采纳答案by DMolinaVzla

The problem got solved: I modified the environment variables, including those in the Windows registry, and Toad showed the Oracle home in red in the the TNS menu. I Put the environment variables to the way they where and Toad could connect... It's strange but it works now.

问题解决了:我修改了环境变量,包括 Windows 注册表中的环境变量,Toad 在 TNS 菜单中以红色显示 Oracle 主页。我把环境变量放到它们和 Toad 可以连接的地方......这很奇怪,但它现在可以工作了。

回答by beery

For me, This problem was caused by me setting ORACLE_HOMEwindows environment variable (permanently). I set this whilst trying to get "emctl"to work.

对我来说,这个问题是由我设置ORACLE_HOMEwindows 环境变量(永久)引起的。我在尝试"emctl"上班时设置了这个。

Once removed, TOAD worked fine.

删除后,TOAD 工作正常。

回答by Sergio P. H.

I opened toad with administrator privilege (Right click -> Run as Administrator). The problem solved.

我以管理员权限 ( Right click -> Run as Administrator)打开了 toad 。问题解决了。

Thanks a lot!

非常感谢!

回答by Jose Pedro Almeida

Removing the ORACLE_HOME from the environment variables (system) worked for me.
TOAD is now working fine.

从环境变量(系统)中删除 ORACLE_HOME 对我有用。
TOAD 现在工作正常。

回答by BB-on-StackOverflow

Not sure what other stuff is installed on your laptop / desktop. But I had Toad 11.6 and then I installed other oracle realted product that created another homes. Below suggestions did NOTwork for me :

不确定您的笔记本电脑/台式机上还安装了哪些其他东西。但是我有 Toad 11.6,然后我安装了其他 Oracle Realted 产品,创建了另一个家庭。下面的建议也不要对我来说有效:

  • Regedit -> Softerware -> Wow6432Node -> Oracle -> KEY_ORA_WF_NK has correct ORACLE_HOME
  • Environment variable ORACLE_HOME on local system also has the same.
  • Regedit -> 软件 -> Wow6432Node -> Oracle -> KEY_ORA_WF_NK 有正确的 ORACLE_HOME
  • 本地系统上的环境变量 ORACLE_HOME 也有相同的。

Instead, I tried below and that worked for me and here's just another suggestion :

相反,我在下面尝试过,这对我有用,这只是另一个建议:

  • When you open Toad, you are normally prompted which DB to connect and there is an option to select ("...") next to list of homes installed, once you click there, it will specify error (upon clicking button), so I tried that and something it complained about the PATH being not set, once I fixed the PATH and it worked. After this Toad opens normally (i.e. one does not have to use Run As Admin option).
  • 当您打开 Toad 时,通常会提示您连接哪个数据库,并且在安装的家庭列表旁边有一个选择(“...”)的选项,一旦您点击那里,它会指定错误(点击按钮),所以我试过了,它抱怨 PATH 没有设置,一旦我修复了 PATH 并且它起作用了。此 Toad 正常打开后(即不必使用“以管理员身份运行”选项)。

BTW: Before trying above fix , I tried to Run as Admin and it worked.

顺便说一句:在尝试上述修复之前,我尝试以管理员身份运行并且它有效。

Hope this helps, if not please excuse me.

希望这会有所帮助,如果没有,请原谅。

回答by Shyamkkhadka

In my case, I was getting same error with Oracle 10g client, Toad 10 Commercial installed in my Windows 7 PC. I was trying to access Oracle 10g server from my PC. I was getting that error while trying to access from Toad.

就我而言,我在 Windows 7 PC 中安装了 Oracle 10g 客户端 Toad 10 Commercial 时遇到了同样的错误。我试图从我的 PC 访问 Oracle 10g 服务器。尝试从 Toad 访问时遇到该错误。

Finally, the solution I found was : I opened toad with administrator privilege (Right click -> Run as Administrator). The problem solved.

最后,我找到的解决方案是:我以管理员权限打开 toad(右键单击 -> 以管理员身份运行)。问题解决了。

回答by User1111

Great!!

伟大的!!

It works after these two things are in sync:

在这两件事同步后它就可以工作了:

  1. Regedit -> Softerware -> Wow6432Node -> Oracle -> KEY_ORA_WF_NK has correct ORACLE_HOME
  2. Environment variable ORACLE_HOMEon local system also has the same.
  1. Regedit -> Softerware -> Wow6432Node -> Oracle -> KEY_ORA_WF_NK has correct ORACLE_HOME
  2. ORACLE_HOME本地系统上的环境变量也有相同的。

回答by Sazzad Hussain

I got this error "OCI_INVALID_HANDLE" at the time of connecting to the remote database after I removed one of my redundant installations of Oracle 12c DB Client. My machine's OS is Windows 10 Enterprise. The problem is fixed by adding ORACLE_HOME key in the system environment path.

在删除 Oracle 12c 数据库客户端的冗余安装之一后,我在连接到远程数据库时收到此错误“OCI_INVALID_HANDLE”。我机器的操作系统是 Windows 10 Enterprise。通过在系统环境路径中添加 ORACLE_HOME 键来修复该问题。

Since I don't have any ORACLE_HOME key in my system environment path, I create this one by following the steps:

由于我的系统环境路径中没有任何 ORACLE_HOME 键,因此我按照以下步骤创建了这个键:

  1. Right click on "This PC"
  2. Click "Properties" -> "Advanced system settings"
  3. Click "Environment variables..." in "Advanced" tab
  4. Click "New..." in "System variables" section
  5. Put "ORACLE_HOME" in "Variable name" field and put your installation path of oracle db client (ex: C:\oracle\product\12.1.0\client_1) in "Variable value" field
  6. Click "Ok".
  1. 右键单击“此电脑”
  2. 点击“属性”->“高级系统设置”
  3. 单击“高级”选项卡中的“环境变量...”
  4. 单击“系统变量”部分中的“新建...”
  5. 在“变量名”字段中输入“ORACLE_HOME”,在“变量值”字段中输入你的oracle db客户端安装路径(例如:C:\oracle\product\12.1.0\client_1)
  6. 单击“确定”。

enter image description here

在此处输入图片说明

回答by Jeremy Thompson

Check your ORACLE HOME Environment Variable is pointing to the correct version.

检查您的 ORACLE HOME 环境变量是否指向正确的版本。

When starting TOAD v8 it worked when our Oracle HOME was pointing at the c:\Apps\Oracle\9.2.

启动 TOAD v8 时,它在我们的 Oracle HOME 指向c:\Apps\Oracle\9.2 时工作

When I changed the ORACLE HOME Environment Variable to c:\Apps\Oracle\12.2\client_1using TOAD to connect to a database it failed with the error:

当我使用 TOAD 将ORACLE HOME 环境变量更改为c:\Apps\Oracle\12.2\client_1以连接到数据库时,它失败并显示错误:

Can't initialize OCI. Error -1

无法初始化 OCI。错误 -1

回答by Maz

Windows 7 locks down C drive this is why running as Admin works.

Windows 7 锁定 C 驱动器,这就是以管理员身份运行的原因。