Monday, 7 April 2014

[IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed [ISQL]ERROR: Could not SQLConnect

]#   isql -v MYPGDB

[IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
[ISQL]ERROR: Could not SQLConnect

Cause

Either odbc drivers are not mentioned properly or environment variable are not set ODBCSYSINI ODBCINI

Solution

1 ) Set driver in /etc/odbc.ini file

Driver                = /usr/lib64/psqlodbc.so
Description           = PostgreSQL ODBC

2) Export path of odbc.ini file

]# export ODBCSYSINI=/etc
]# export ODBCINI=/etc/odbc.ini
]#   isql -v MYPGDB
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>

WARNING: Error starting Database Control.Execute the following command(s). 1) Set the environment variable ORACLE_UNQNAME to Database unique name 2) /home/oracle/db_1/bin/emctl start dbconsole


If at  time of EM configuration we get below warning it means EM is not configure properly . Reason behind it some thing is missing or wrong in listener or host file .

WARNING: Error starting Database Control.Execute the following command(s).

 1) Set the environment variable ORACLE_UNQNAME to Database unique name
 2) /home/oracle/db_1/bin/emctl start dbconsole
Apr 26, 2013 12:42:31 AM oracle.sysman.emcp.EMConfig restoreOuiLoc
CONFIG: Restoring oracle.installer.oui_loc to /home/oracle/db_1/oui
Apr 26, 2013 12:42:31 AM oracle.sysman.emcp.EMConfig perform
CONFIG:

Error starting Database Control.Execute the following command(s).

 1) Set the environment variable ORACLE_UNQNAME to Database unique name
 2) /home/oracle/db_1/bin/emctl start dbconsole
Apr 26, 2013 12:42:31 AM oracle.sysman.emcp.EMConfig perform
CONFIG: Passing warning to the caller:
Apr 26, 2013 12:42:31 AM oracle.sysman.emcp.EMConfig restoreOuiLoc
CONFIG: Restoring oracle.installer.oui_loc to /home/oracle/db_1/oui

Below the steps to resolve the issue:

1 check listener is up if not the up it

#lsnrctl status
#lsnrctl start

2. Check if IP address or machine name is mentioned in listener.ora if IP address is mentioned then replace it  with machine name.

3. restart the listener

#lsnrctl reload

4. Replace in tnsnames.ora file from an IP number to a machine name.

5. Check if entries are correct in /etc/hosts add hostname into this file if not exists

127.0.0.1       localhost
172.16.113.128  MYDBmachine MYDBmachine.domain.com

6. recreate the em repository

 emca -config dbcontrol db -repos recreate

STARTED EMCA at Sep 3, 2012 7:40:07 PM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: orcl
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:

Do you wish to continue? [yes(Y)/no(N)]: y

7. Check status of EM

emctl status deconsole

No comments:

Post a Comment