What are the best practices for troubleshooting Heterogeneous ODBC connections? - oracle

I am trying to establish a heterogeneous ODBC connection from an Oracle 21c XE database to a Progress OpenEdge 11.7 database. I have installed a 32 bit ODBC driver on the Windows 2019 server where the 21c XE DB resides. I have set up an ODBC System DSN, tested it and it works.
I created a initTIMEDATA.ora file in the C:\app\Administrator\product\21c\homes\OraDB21Home1\hs\admin folder.
It contains;
HS_FDS_CONNECT_INFO = TimeData
HS_FDS_TRACE_LEVEL = 4
HS_FDS_TRACE_FILE_NAME = TimeData.trc
Where TimeData matches the ODBC System DSN name.
I modified the listener.ora adding;
(SID_DESC=
(SID_NAME=TimeData)
(ORACLE_HOME=C:\app\Administrator\product\21c\dbhomeXE)
(PROGRAM=C:\app\Administrator\product\21c\dbhomeXE\bin\dg4odbc)
(ENVS = LD_LIBRARY_PATH=C:\Progressx86\OpenEdge\lib:C:\app\Administrator\product\21c\dbhomeXE\bin)
)
I modified my tnsnames.ora file adding;
TIMEDATA=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=10.254.10.41)
(PORT=4621)
)
(CONNECT_DATA=
(SID=TimeData))
(HS=OK))
I created a DBLink like;
CREATE PUBLIC DATABASE LINK time_data_link CONNECT TO "sqluser" IDENTIFIED BY "myPassword" USING 'TIMEDATA';
After restarting everything (DB, Listener...) the listener shows;
Service "TimeData" has 1 instance(s).
Instance "TimeData", status UNKNOWN, has 1 handler(s) for this service...
When I try to run a query;
SELECT * FROM employee_view#time_data_link;
I get;
ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from TIME_DATA_LINK
28545. 0000 - "error diagnosed by Net8 when connecting to an agent"
*Cause: An attempt to call an external procedure or to issue SQL
to a non-Oracle system on a Heterogeneous Services database link
failed at connection initialization. The error diagnosed
by Net8 NCR software is reported separately.
*Action: Refer to the Net8 NCRO error message. If this isn't clear,
check connection administrative setup in tnsnames.ora
and listener.ora for the service associated with the
Heterogeneous Services database link being used, or with
'extproc_connection_data' for an external procedure call.
Error at Line: 1 Column: 29
I see no errors in the listener.log, I cannot find TimeData.trc. In poking around the DB trace files I found a trace file related with multiple copies of;
HS connect: nscall returned status ffffffff (-1)
ns main err code: 12569
ns (2) err code: 0
nt main err code: 0
nt (2) err code: 0
nt OS err code: 0
*** 2022-04-03T17:01:07.758909-04:00 (XEPDB1(3))
HS: Unable to establish RPC connection to HS Agent...
HS: ... Agent SID = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.254.10.41)(PORT=4621))(CONNECT_DATA=(SID=TimeData))), NCR error = 65535 Unable to retrieve text of NETWORK/NCR message 65535
I have reached the end of my troubleshooting skills and hope someone else may be able to point me in the right direction.

I had two problems.
The TNSNAMES.ORA file needed to point to the Oracle DB server, running on localhost in my case. Once I changed this, the error changed to
Error;
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application {IM014}
New TNSNAMES.ORA;
TIMEDATA=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=localhost)
(PORT=1521)
)
(CONNECT_DATA=
(SID=TimeData))
(HS=OK))
Once I saw this error it became apparent I needed the 64 bit version of the ODBC driver which I acquired.
After making these changes everything seems to work.

Related

Resolving ORA-02019 error during DBMS_FILE_TRANSFER.PUT_FILE()

I am using DBMS_FILE_TRANSFER.PUT_FILE() on a local Oracle Express instance to transfer a local file to a remote AWS RDS Oracle instance, but I am receiving the following error:
ERROR at line 1:
ORA-02019: connection description for remote database not found
ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 60
ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 168
ORA-06512: at line 2
I receive this error while executing the following SQL script:
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE(
'DATA_PUMP_DIR',
'some_file.txt',
'DATA_PUMP_DIR',
'some_file.txt',
'MY_DATABASE_LINK'
);
END;
/
MY_DATABASE_LINK is a public database link located in my local Oracle Express instance:
CREATE PUBLIC DATABASE LINK MY_DATABASE_LINK CONNECT TO example_schema IDENTIFIED BY "example_user" USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=example_host_info)(PORT=1521))(CONNECT_DATA=(SID=example_sid)))';
I'm fairly confident that the connection string behind the database link is correct, but I'm not sure how to be 100% sure.
The ORA-02019: connection description for remote database not found error does not make sense because the connection description is defined by the database link. It is not present in tnsnames.ora, and I am confident that it doesn't have to be for DBMS_FILE_TRANSFER.PUT_FILE() to work.

Create a Datatabase link to Google BigQuery in Oracle fails with an ORA-28511

I want to connect my Oracle database (11.2) with a BigQuery table with the Database Gateway for ODBC. The ODBC driver (Test after the configuration is successful) is configured as in the tutorial:
initdg4odbc.ora:
HS_FDS_CONNECT_INFO = "Google BigQuery"
HS_FDS_TRACE_LEVEL = 4
Following entry was added to the listener.ora:
(SID_DESC=
(SID_NAME=DG4ODBC)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM=dg4odbc)
And to the tnsnames.ora:
BIGQUERY =
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=localhost)
(PORT=1521))
(CONNECT_DATA=
(SID=DG4ODBC))
(HS=OK)
)
So far it looks good and I can do successful tnsping:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1521)) (CONNECT_DATA= (SID=DG4ODBC)) (HS=OK))
OK (10 msec)
Afterwards I have created a database link on the Oracle DB:
CREATE DATABASE LINK google USING 'BIGQUERY';
But once I query the table (the query in Bigquery works find and name is in upper case) via sqlPlus I get the following error message:
SQL> select * from TABLE#bigquery;
select * from TABLE#bigquery
ERROR at line 1:
ORA-28511: lost RPC connection to heterogeneous remote agent using
SID=ORA-28511: lost RPC connection to heterogeneous remote agent using
SID=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DAT
A=(SID=DG4ODBC)))
ORA-02063: preceding line from BIGQUERY
Process ID: 16180
Session ID: 49 Serial number: 51
Any ideas why the error occurs or where I can find more details for it?
Your tutorial is inconsistent. At one point he has you create a DSN named "BigQuery", but then has you set credentials for a DSN named "Google BigQuery". Pick a DSN and stick with it. And this carries back HS_FDS_CONNECT_INFO in your init. ora file.
Also, I'd not name the gateway SID as 'DG4ODBC'. It will work, but is a very mis-leading name. What will you name the next one you have to create? I'd name the SID the same as the target database - BigQuery in this case.
You might find this link to be more helpful .. https://edstevensdba.wordpress.com/2018/09/19/the-oracle-transparent-gateway/

Greenplum connector giving hostname resolution error in ibm Datas stage

GreenPlum Connection error:
Greenplum_Connector_1,0: The following SQL statement failed: INSERT INTO GPCC_ET_20200903233319813_84175_0 select * from table .
The statement reported the following reason: [SQLCODE=HY000][Native=56,966,976] [IBM(DataDirect OEM)][ODBC Greenplum Wire Protocol driver][Greenplum]ERROR: could not translate host name "hostname_of_machine", port "8001" to address: Name or service not known (cdbutil.c:819)
(seg5 192.168.111.240:6005 pid=38339) (cdbdisp.c:254)(File cdbdisp.c; Line 254; Routine cdbdisp_finishCommand; )
(CC_GPCommon::checkThreadStatusThrow, file CC_GPCommon.cpp, line 808)
As Jon mentioned, "hostname_of_machine" needs to be updated to the real hostname

cx_Oracle connection by python3.5

I've tried several attempt to connect Oracle DB but still unable to connect. Following is my code to connect. However, I could connect Oracle DB through the terminal like this:
$ sqlplus64 uid/passwd#192.168.0.5:1521/WSVC
My evironment: Ubuntu 16.04 / 64bit / Python3.5
I wish your knowledge and experience associated with this issue to be shared. Thank you.
import os
os.chdir("/usr/lib/oracle/12.2/client64/lib")
import cx_Oracle
# 1st attempt
ip = '192.168.0.5'
port = 1521
SID = 'WSVC'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
# dsn_tns = cx_Oracle.makedsn(ip, port, service_name=SID)
db = cx_Oracle.connect('uid', 'passwd', dsn_tns)
cursor = db.cursor()
-------------------------------------------------
# 2nd attempt
conn = "uid/passwd#(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.5)(PORT=1521)))(CONNECT_DATA=(SID=WSVC)(SRVR=DEDICATED)))"
db = cx_Oracle.connect(conn)
cursor = db.cursor()
------------------------------------------------------
# ERROR Description
cx_Oracle.InterfaceError: Unable to acquire Oracle environment handle
The error "unable to acquire Oracle environment handle" is due to your Oracle configuration being incorrect. A few things that should help you uncover the source of the problem:
when using Instant Client, do NOT set the environment variable ORACLE_HOME; that should only be set when using a full Oracle Client or Oracle Database installation
the value of LD_LIBRARY_PATH should contain the path which contains libclntsh.so; the value you selected looks like it is incorrect and should be /usr/lib/oracle/12.2/client64/lib instead
you can verify which Oracle Client libraries are being loaded by using the ldd command as in ldd cx_Oracle.cpython-35m-x86_64-linux-gnu.so

ORA-12170 Timeout error occured with sqlnet.log

I am getting error ORA-12170 while connecting from C# application to Oracle database. I searched and found somewhere that the error description can be found in sqlnet.log file. What I am pasting is the sqlnet.log content. How can I overcome this problem?
Fatal NI connect error 12170.
VERSION INFORMATION:
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 10.2.0.1.0 - Production
Time: 08-JUN-2016 18:49:09
Tracing not turned on.
Tns error struct:
ns main err code: 12535
TNS-12535: TNS:operation timed out
ns secondary err code: 12560
nt main err code: 505
TNS-00505: Operation timed out
nt secondary err code: 60
nt OS err code: 0
Client address:
main err code: 12535
This only tells there is a time-out
secondary err code: 12560
A quick look-up tells us this is "ORA-12560: TNS:protocol adaptor error".
Have you started the Oracle service yet?
To check the Oracle services, you can use command line to run "services.msc", then locate the Oracle services and start them.

Resources