Investigating an "ORA 028513" DG4ODBC Error

Connecting Oracle to SQL Server is one of the most common use cases for the Easysoft SQL Server ODBC driver. Supporting this combination not only involves providing assistance with setting up our driver. It also means helping resolve Oracle configuration issues that prevent Oracle Heterogeneous Services from getting as far as loading our driver.

Recently, a SQL Server ODBC driver customer reported the following error to us:

ORA-28513: internal error in heterogeneous remote agent

The customer was able to supply us with a DG4ODBC trace log, which told us two things:

  1. The Oracle configuration files (.ora) had been set up correctly. If these files contain an error (e.g. a missing or extraneous bracket), no DG4ODBC trace log would get generated.
  2. DG4ODBC was not even attempting to load the unixODBC Driver Manager.

In situations like these where the Oracle DG4ODBC log does not identify the problem (it will normally always contain more information than the ORA-NNNNN error reported by the application), and ODBC logging is not yet possible, we reach for strace or truss. For example:

  1. Start two shell sessions as the Oracle user.
  2. In shell 1, stop the Oracle listener.
  3. Start the listener with this command:
    strace -f -o /tmp/easysoft.log -s 512 lsnrctl start


    truss -wall -rall -o /tmp/easysoft.log lsnrctl start
  4. In shell 2, start SQL*PLus and run a SQL statement against the DG4ODBC / SQL Server database link.
  5. In shell 2, stop the Oracle listener.

However the system library tracing tool (truss in the customer's case) still did not reveal the cause of the problem.

In the end, it turned out that the customer was setting the ORA_NLS10 environment variable, and a side-effect of doing this was to prevent DG4ODBC from working. As the variable didn't need to be set on this machine, unsetting it and removing it from a profile file was the solution to the customer's problem.