perl5-dbi / DBD-Oracle

Oracle database driver for the DBI module
http://search.cpan.org/dist/DBD-Oracle
17 stars 25 forks source link

Calling ping against disconnected handle encounters error ORA-01041 #39

Open jmhess opened 7 years ago

jmhess commented 7 years ago

I'm trying to rebuild a legacy system running on RHEL 5 to a new CentOS 7.2.1511 system. After copying the perl library directories from the RHEL 5 system to the CentOS system, I had trouble getting DBI, DBD::Oracle, and other compiled perl libraries to work under CentOS, so I opted to start rebuilding/reinstalling them within CentOS using the latest stable versions of the libraries.

So far everything works well except that when calling the ping method after disconnecting from Oracle, the calling program crashes with this:

    OCISessionEnd(2acc6e8,2a81ab8,2a06e90,mode=DEFAULT 0)=SUCCESS
    OCIServerDetach(2bdda20,2a81ab8,mode=DEFAULT,0)=SUCCESS
    **OCIOCIServerRelease(2acc6e8)=ERROR
    OCIErrorGet(2a81ab8,1,"<NULL>",7fff70e055ac,"ORA-01041: internal error. hostdef extension doesn't exist

",1024,2)=SUCCESS OCIErrorGet(2a81ab8,2,"",7fff70e055ac,"ORA-01041: internal error. hostdef extension doesn't exist ",1024,2)=NO_DATA OCIOCIServerVersion_log_stat(2acc6e8,Ca)=ERROR DBD::Oracle::db ping failed: ORA-01041: internal error. hostdef extension doesn't exist (DBD ERROR: OCISessionServerRelease) at ./my_test line 79.** OCIHandleFree(2a06e90,OCI_HTYPE_SESSION)=SUCCESS OCIHandleFree(2acc6e8,OCI_HTYPE_SVCCTX)=SUCCESS OCIHandleFree(2bdda20,OCI_HTYPE_SERVER)=SUCCESS OCIHandleFree(2a81ab8,OCI_HTYPE_ERROR)=SUCCESS

I have $dbh->{dbd_verbose}=99 enabled above just prior to disconnecting the dbh.

perl version: 5.16.3 for x86_64-linux-thread-multi Oracle client: 12c Oracle version: 12.1.0.2.0 64 bit DBD::Oracle version: 1.74 DBI version: 1.636

The problem also happens when connecting to a 11g database. It also happens from another partially rebuilt RHEL 5 test system. It does NOT happen within our production system which has DBD::Oracle and DBI that is MANY years out of date.

I suspect there is something bungled with my installation, but I used the cpan utility to install DBI, DBD::Oracle, and many dependent libraries to the latest stable version. Is this a known problem but not yet reported? How can I further troubleshoot?

Thank you!

mjegh commented 7 years ago

It is an internal error - just search for "hostdef extension doesn't exist". It probably means there is something wrong with your Oracle environment.

jmhess commented 7 years ago

I only came here because I've googled to no avail. None of the hits seem to apply to DBD::Oracle or DBI. Also I can connect and disconnect just fine via perl or sqlplus. The problem is calling ping against a disconnected handle. Seems that ping tries to get the Oracle server release version number and that fails.

djzort commented 5 years ago

I still get the same: DBD::Oracle::db ping failed: ORA-01041: internal error. hostdef extension doesn't exist (DBD ERROR: OCISessionServerRelease) at /tmp/zzzzzz.t line 93.

In mysql, ping reconnects if needed. See https://metacpan.org/source/DVEEDEN/DBD-mysql-4.050/mysql.xs

It's pod doesnt define its behaviour.

Postgresql is as follows:

https://metacpan.org/pod/DBD::Pg#ping

djzort commented 5 years ago

Heres details on the error message http://www.dba-oracle.com/t_ora_01041_internal_error_hostdef_extension_doesnt_exist.htm

djzort commented 5 years ago

Looking at the code of ping in DBD::Oracle, it is always masking warn and die signals. Which i think is defying PrintError and RaiseError.

In DBD::pgsql, warn is being masked conditionally based upon PrintError

djzort commented 5 years ago

This is also interesting https://metacpan.org/source/DWHEELER/DBIx-Connector-0.56/lib/DBIx/Connector/Driver/Oracle.pm#L8