Ошибка oracle initializing oci environment handle

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

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:

Can’t initialize OCI. Error -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.

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.

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

У меня проблема с жабой для Oracle 9.1, работающей на Windows 7 32-бит, описывается следующим образом:

на моем ПК установлен Oracle OraClient10g 10.0.2, и мне нужно использовать Toad 9.1. Когда я пытаюсь войти в сервер, я указываю базу данных через TNS, я ввожу имя пользователя и пароль, но я получаю сообщение со следующей ошибкой:

не удается инициализировать OCI. Ошибка -1

Googling around у меня есть несколько вариантов, которые включают в себя: проверьте, что ORACLE_HOME переменная среды установлена правильно, запустите TOAD как администратор, проверьте правильность имени пользователя и пароля, установите Oracle и TOAD для 32-битной системы… Я проверил все эти параметры, но я все еще получаю ошибку.

есть, однако, деталь, которую я должен упомянуть: в моем меню «Пуск» есть два дома Oracle (Home1 и Home2). Home 2 указывает на пустую папку, потому что я переустановил Oracle во время моих попыток решить проблему, и короткий путь все еще находится в моем начале меню. Я не думаю, что это важно, потому что ORACLE_HOME указывает на правильный дом.

Мне действительно нужна помощь с этим. Мне нужно решить эту ошибку и войти в систему с помощью TOAD.

10 ответов


Я открыл жабу с правами администратора (Right click -> Run as Administrator). Проблема решена.

Спасибо большое!


для меня эта проблема была вызвана меня задание ORACLE_HOME переменная среды windows (постоянно). Я установил это, пытаясь получить "emctl" на работу.

после удаления жаба работала нормально.


удаление ORACLE_HOME из переменных среды (системы) работало для меня.
Жаба теперь работает нормально.

2

автор: Jose Pedro Almeida


проблема решена: я изменил переменные среды, в том числе в реестре Windows, и жаба показала Oracle home красным цветом в меню TNS. Я поставил переменные среды так, как они могли бы соединиться с Toad… Странно, но сейчас это работает.


в моем случае я получал ту же ошибку с клиентом Oracle 10g, Toad 10 Commercial, установленным на моем ПК с Windows 7. Я пытался получить доступ к серверу Oracle 10G с моего ПК.
Я получал эту ошибку, пытаясь получить доступ от Toad.

наконец, решение, которое я нашел, было :
Я открыл toad с правами администратора (щелкните правой кнопкой мыши -> Запуск от имени администратора). Проблема решена.


Не уверен, что другие вещи установлена на вашем ноутбуке / рабочий стол.
Но у меня была жаба 11.6, а затем я установил другой продукт oracle realted, который создал другие дома. Ниже предложения сделали не работать на меня :

  • Regedit — > программное обеспечение — > Wow6432Node — > Oracle — > KEY_ORA_WF_NK имеет правильный ORACLE_HOME
  • переменная среды ORACLE_HOME в локальной системе также имеет то же самое.

вместо этого я попытался ниже, и это сработало для меня и вот еще одно предложение:

  • когда вы открываете жабу, вам обычно предлагается, какую БД подключить, и есть возможность выбрать («…») рядом со списком установленных домов, как только вы нажмете там, он укажет ошибку (при нажатии кнопки), поэтому я попробовал это и что-то жаловался на то, что путь не установлен, как только я исправил путь, и он работал. После этого жаба открывается нормально (т. е. не нужно использовать опцию Run As Admin).

BTW: Прежде чем пытаться исправить выше , я попытался запустить как администратор, и это сработало.

надеюсь, это поможет, если не извините меня.

1

автор: BB-on-StackOverflow


великолепно!!

он работает после того, как эти две вещи синхронизированы:

  1. Regedit -> Softerware -> Wow6432Node -> Oracle -> KEY_ORA_WF_NK has correct ORACLE_HOME
  2. переменные среды ORACLE_HOME в локальной системе также есть то же самое.

Я получил эту ошибку «OCI_INVALID_HANDLE» во время подключения к удаленной базе данных после удаления одной из моих избыточных установок клиента Oracle 12c DB. ОС моей машины-Windows 10 Enterprise. Проблема устранена путем добавления ключа ORACLE_HOME в путь к системной среде.

поскольку у меня нет ключа ORACLE_HOME в моем пути к системной среде, я создаю его, выполнив следующие шаги:

  1. щелкните правой кнопкой мыши на «этот ПК»
  2. клик «Свойства» — > » расширенная система
    настройки»
  3. нажимаем «переменные среды…»в вкладке «Дополнительно»
  4. Нажать «Новая…»в разделе» системные переменные»
  5. поместите «ORACLE_HOME» в
    Поле «имя переменной» и укажите путь установки oracle db
    клиент (ex: C:oracleproduct12.1.0client_1) в разделе » значение переменной»
    поле
  6. Нажмите «Ok».

enter image description here


возможно, у вас будут установлены Oracle и Oracle Express, поэтому любые переменные среды конфигурации могут быть изменены, если это так, вход прямой, а не TNSNAME и настройки будут localhost 1521 вариант serviceName: xe, оставляя подключение с использованием всегда клиента oracle, например Instant Client — 11.2


Windows 7 блокирует диск C вот почему работает как администратор.


@jerome-peng

I use the root user to install

# yum install oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm 
# yum install oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm 

I use the report user which is the owner of the PG server.
I can use sqlplus to login to oracle server as user report.

here is my error:

report=> SELECT oracle_diag('server_ora_99');
ERROR:  error connecting to Oracle: OCIEnvCreate failed to create environment handle
DETAIL:  
report=> select oracle_diag();
                                             oracle_diag                                              
------------------------------------------------------------------------------------------------------
 oracle_fdw 2.0.0, PostgreSQL 9.5.12, Oracle client 11.2.0.4.0, ORACLE_HOME=/opt/oracle/instantclient
(1 row)

@laurenz

Oh no, the dreaded «OCIEnvCreate failed to create environment handle».

It means that something is wrong with your Oracle setup. Oracle does not tell you what. Often some environment variable.

As a first step, you can check all Oracle related environment variables you have set in the shell where sqlplus works. Perhaps some of them are not set in the environment of the PostgreSQL server.

Which naming method do you use to connect to Oracle? Can I see the connection string?

You might want to look through all the past issues that mention OCIEnvCreate, maybe you get a clue there.

Sometimes using strace to trace the PostgreSQL backend is helpful; it might show you where Oracle goes wrong.

@jerome-peng

thanks a lot.

my problem is solved by reboot the server.

below is my environment variable.

LD_LIBRARY_PATH=/opt/oracle/instantclient:/home/jerome/work/pgsql/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
OCI_INC_DIR=/opt/oracle/instantclient/sdk/include
OCI_LIB_DIR=/opt/oracle/instantclient
ORACLE_HOME=/opt/oracle/instantclient

@laurenz

Glad to hear, thanks for the feedback.

I don’t think it can have been these environment variables, so this incident can be added to the sad collection of unclear OCIEnvCreate problems …

@kumakichi

I came cross the same problem, and solved, with ubuntu 18.04.1(docker)

paste the steps here, may help somebody with the same problem:

  1. find out how to start server
  • start server with service postgresql start or /etc/init.d/postgresql start
  • find the command ps ax | grep postgres, you will get something like

/usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf

  1. prepare
  • stop server firstly
    service postgresql stop
  • su(root user is not allowed to start server by default)
    su - postgres
  1. add environment variables
export ORACLE_HOME=/opt/oracle/instantclient_12_2

export LD_LIBRARY_PATH=$ORACLE_HOME:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
  1. start server
    run command got from step 1 , here, it is:
    /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf

then, connect server again, you will find this problem solved.

@laurenz

For the record: On Linux, it is better to put Oracle on the library path by adding the directory to /etc/ld.so.conf and running ldconfig.

Repository owner

locked as resolved and limited conversation to collaborators

May 8, 2019

Toad World® Forums

Loading

Toad World by Quest

Stefan

unread,

Sep 22, 2018, 3:16:43 PM9/22/18

to mapi…@googlegroups.com

Hi there,

i’m experiencing a strange Problem here.

I’ve developed an MS-Access-application in VBA that starts MiPro in the Background via 

Set objMapInfo = CreateObject(«Mapinfo.Application.x64»)

Now i’ve three Computers running that app, but it does so only on one machine, on the other two i get this error 

OCI_Error_Message.png

Oracle-Error: Allocating OCI Environment handle.

Searching the Internet i found a short article on the PB Website About that Problem with MiPro 32-Bit, explaining that the Problem may be solved by reinstalling the Oracle Client matching the MiPro-Version. In my case that would mean: reinstall the whole Oracle DB, — no way!

I checked the machines for differences.

All running Windows 10 Pro 64-Bit / 1803 / German / MiPro 15.03 DE / MiPro 17.01 Advanced / Oracle 12.2 32-Bit Instant Client / Oracle 12C Enterprise DB / same MS-Office Version.

Setup is the same, 32-bit MiPro can Access the Oracle db as well.

In the path on all machines the 64-bit Oracle bin-path Comes before the 32-bit instant Client path. The Oracle global variables are the same.

On all three machines it’s no Problem to load a spatial layer from the local Oracle instance in MiPro 17.01 when started regulary via Windows startmenu, but when i issue the vba-codeline above, on two machine i get that error message instantly, on one of the machine everything runs as expected.

Attached you will find an MS-Access Database demonstrating the strangeness of that problem. To make it work you will have to edit the query- and connection-parameters in the function «EO_Get_Value_List» in Module1. The function generates a delimited list of  the string values of an oracle table column.

If you managed to make that work, you can click on the button «Get Oracle Values» on the main form, that will fill the oracle-values listbox.

So, if you now close the database and open it again, you can try to click on the buton «Start MiPro64», that will try to create a MiPro object in the background.

In my case i get a «General protection fault» some 30 seconds later, and a nice MiPro.dmp file in my temp-Directory.

BUT

if i close the database and open it up again, and click first on the button «Get Oracle Values» and click afterwards on the button «Start MiPro64» the above errormessage appears instantely, and no oralce connection with this instance of MiPro is possible.

After many Hours of searching i’m lost, and any thoughts are highly welcome.

Thanks and have a nice Weekend

Stefan

Eric Blasenheim

unread,

Sep 23, 2018, 9:26:36 PM9/23/18

to MapInfo-L

Stefan,

The key is that you need a 64-bit Oracle OCI client on every machine where Pro (or any other 64-bit client) is installed for us to talk to Oracle.  Those client dlls can just be the «instant client» but they need to be there and be accessible (via the system path) for MapInfo Pro to load.  This is not a MapInfo limitation, this is the way 32 and  64 bit machine software works on all systems.

It seems you have the Oracle database on the same machine but that should not matter other than the fact that the 64-bit client dlls may already be there. 

But what you need to do is:

Make sure the 64-bit version of oci.dll and its dependent dlls (what comes with the instant or full client) are on the machine. 

Make sure that location is on the system path when MI Pro is running. Since you are launching Pro via COM/VBA this may mean it needs to be on the true system level path as we are being launched by the system and not directly your VBA program.  You can see what path an executable truly has at run time via tools like Windows Process Explorer. 

Note that some people think there is an issue with having the 32 and 64 bit versions on the path. In general, this is not true. When MI Pro tries to load OCI via the Windows API, the 64-bit OS completely ignores any 32 bit DLLs that happen to have the name OCI.DLL.  So the order on the path does not matter.  (if you try programmatically to point a 64-bit program to a 32 bit dll with an explicit path, Windows tells you this is not an executable).

When the loading of a particular Oracle table uses a SSID whose description is in the tnsnames.ora file, for OCI to locate those and know what they mean., their code uses the TNS_ADMIN environment variable to locate that file.  So it should be set to the location of  the tnsnames.ora file. 

But really it is just making sure Pro can load the 64-bit OCI.DLL 

I hope this helps.

Eric Blasenheim

Pitney Bowes Software.

On Saturday, September 22, 2018 at 8:16:43 AM UTC-4, Stefan wrote:

Hi there,

i’m experiencing a strange Problem here.

I’ve developed an MS-Access-application in VBA that starts MiPro in the Background via 

Set objMapInfo = CreateObject(«Mapinfo.Application.x64»)

Now i’ve three Computers running that app, but it does so only on one machine, on the other two i get this error 

OCI_Error_Message.png

Oracle-Error: Allocating OCI Environment handle.

Searching the Internet i found a short article on the PB Website About that Problem with MiPro 32-Bit, explaining that the Problem may be solved by reinstalling the Oracle Client matching the MiPro-Version. In my case that would mean: reinstall the whole Oracle DB, — no way!

I checked the machines for differences.

All running Windows 10 Pro 64-Bit / 1803 / German / MiPro 15.03 DE / MiPro 17.01 Advanced / Oracle 12.2 32-Bit Instant Client / Oracle 12C Enterprise DB / same MS-Office Version.

Setup is the same, 32-bit MiPro can Access the Oracle db as well.

In the path on all machines the 64-bit Oracle bin-path Comes before the 32-bit instant Client path. The Oracle global variables are the same.

On all three machines it’s no Problem to load a spatial layer from the local Oracle instance in MiPro 17.01 when started regulary via Windows startmenu, but when i issue the vba-codeline above, on two machine i get that error message instantly, on one of the machine everything runs as expected.

The only difference i was able to find is, that the machine without Errors is running Oracle DB 12.1 while the other failing machines are running 12.2.

I would think that it’s quite unprobable that this is the source of this Problem, — but what else?

Stefan

unread,

Sep 24, 2018, 10:38:30 AM9/24/18

to MapInfo-L

Good morning Eric,

thanks for this fast reply.

But as i wrote: On all machines i can launch MiPro from the start menu and load Oracle layers just fine. On all machines a full Oracle Enterprise 64-bit database installation is present and the bin directory in the path, — as well as the 32-bit instant client directory.

Loading Oracle spatial layers from 32-bit MiPro 15 on the same machines works as well.

So this cannot be the issue, — from my point of view.

The strange thing is, that starting MiPro 64-Bit via COM/VBA does work on these two machines, but not if you made an oracle 32-bit connection from within ms-access before (as explained above).

You mentioned process explorer. i used that yesterday to see, what’s going on there and found, that when i get that error message, the access to the oci.dll looks different, — but i’m not expert enough to know, if that means anything.

Everytime, and i tested that many times, — that error comes up, MiPro doesn’t actually read the oci.dll (the marked red part), — as it does, when successfully started.

Successfull load:

OCI_access_successfull.png

Unsuccessfull load attempt:

OCI_access_unsuccessfull.png

And as you can see: MiPro can find the correct oci.dll.

… and on the machine running version 12.1 of Oracle enterprise, even that lauch works.

Thanks in advance for any further help

and

Best regards

Stefan

Stefan

unread,

Sep 25, 2018, 4:53:55 PM9/25/18

to MapInfo-L

Found the solution by myself:

Everything works as expected, if you set on ORACLE_HOME-Variable to point at your 64-Bit Installation.

It stays a bit strange, that running MiPro from windows start menu works flawless with oracle connections but starting via COM doesn’t.

Anyway, it works now, — great.

Stefan

Sidhu Sidvester

unread,

Apr 21, 2020, 8:41:53 AM4/21/20

to MapInfo-L

Hi Stefan,

Good Day!

Could you please share the screenshot of the below ORACEL_HOME Variable .am also facing the same issue.

-Sidhu

After normal installation of Oracle Client or Oracle DB, open Toad, click Connet, and report Can’t initialize oci. error-1.

Solutions:
(1) Environment variable: Simply set path and add the path of Oracle Client to path
(2) Network /admin: add tnsnames.ora and find one or copy one
(3) The key step: Copy Toad’s entire folder to the Oracle Client path

Read More:

Hi,
I am using PL/SQL Developer version 11 on Windows 10 64bit and I keep getting the following error message:

«Initialization error
Could not initialize
C:Oracleproductinstantclient_12_1oci.dll

OCIDLL forced to C:Oracleproductinstantclient_12_1oci.dll
LoadLibrary(C:Oracleproductinstantclient_12_1oci.dll)
returned 0
«

. I have installed the following versions of the Oracle Client:
— Instant Client 11.3 (32bit)
— Instant Client 12.1 (32bit)
— Oracle client 11.2 (32bit)
I configure the IDE under tools/preferences to set the Oracle home and OCI library to point to the above client.
I also set the TNS_ADMiN environment variable.
All of the above to no avail. Please help.

Support Info below:

PL/SQL Developer
Version 11.0.4.1788 (64 bit)
02.100339 — 100 user license
Service Contract: 4/1/2016
Windows 10 Build 10586

Physical memory : 16,696,464 kB (13,123,296 available)
Paging file : 19,186,832 kB (15,484,372 available)
Virtual memory : 137,438,953,344 kB (137,438,645,220 available)

Parameters
C:Program FilesPLSQL Developerplsqldev.exe

Preferences
Session mode: Multi
OCI Library: C:Oracleproductinstantclient_12_1oci.dll
Use OCI7: False
Allow Multiple Connections: True

Preference Files
C:UsersRolandAppDataRoamingPLSQL DeveloperPreferencesdefaultDefault.ini
C:UsersRolandAppDataRoamingPLSQL DeveloperPreferencesRolanddefault.ini

License File
C:UsersRolandAppDataRoamingPLSQL Developeraalf.dat

Debug file
C:UsersRolandAppDataRoamingPLSQL DeveloperPlSqlDev.elf

Plug-Ins
*Active Query Builder (C:Program FilesPLSQL DeveloperPlugInsActiveQueryBuilder.dll)
*PL/SQL Documentation (plsqldoc) (C:Program FilesPLSQL DeveloperPlugInsplsqldoc.dll)
*Red Gate Deployment Plug-In (C:Program FilesPLSQL DeveloperPlugInsRedGate.dll)
(* is Active)

Aliases

Homes

DLLs
C:Oracleproductinstantclient_12_1oci.dll

TNS File

Using
Home:
DLL: C:Oracleproductinstantclient_12_1oci.dll
OCI: not initialized

Monitor
PixelsPerInch = 120

Id = 0
Primary = True
Handle = 65537
Left = 0
Top = 0
Width = 1920
Height = 1080

MainFormOnTaskbar = False

I was able to install oracle_fdw, between Postgresql and Oracle. I’ve installed Oracle Instant client on the Linux machine.

On the Postgresql server, I’ve installed Oracle Client, and configured it to connect to the Oracle database. sqlplus name/password@ORCL is working on the command line.

My tnsnames.ora is:

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.148.51.2)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
    )
  )

I’ve copied tnsnames.ora to $ORACLE_HOME/network/admin/tnsnames.ora

My environment variables are:

export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$ORACLE_HOME/bin:/usr/pgsql-9.1/bin/:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

On the postgresql init script, /etc/init.d/postgresql, I’ve also set the variables:

export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin

I’ve also changed the file /etc/ld.so.conf.d/postgresql-9.1-libs.conf

$ cat /etc/ld.so.conf.d/postgresql-9.1-libs.conf
/usr/pgsql-9.1/lib/
/usr/lib/oracle/11.2/client64/lib/

$ sudo ldconfig
$ sudo /etc/init.d/postgresql restart

To use oracle_fdw, I used:

$ psql ide

ide=# CREATE EXTENSION oracle_fdw;
ide=# CREATE SERVER medidata FOREIGN DATA WRAPPER oracle_fdw OPTIONS (dbserver '//192.148.51.2:1521/ORCL');

I already have a small table in Oracle called ‘zonas’. To use ‘zonas’ in Postgresql, I’ve done:

ide=# CREATE FOREIGN TABLE zonas (
    COD_ZONA text,
    ZONA    text,
    RESPONSAVEL       numeric
    ) 
SERVER medidata
OPTIONS (table 'zonas');

ide=# select * from zonas;
 cod_zona | zona | responsavel 
----------+------+-------------
 2        | 2    |           2
 1        | 1    |           1
(2 rows)

I hope it helps.

Понравилась статья? Поделить с друзьями:
  • Ошибка overload ресивер pioneer
  • Ошибка overload на магнитоле
  • Ошибка over indented
  • Ошибка output speed sensor
  • Ошибка output path