Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBD::Oracle 'make test' fails - ORA-24327: need explicit attach before authenticating a user

3,812 views
Skip to first unread message

Alexander Saip

unread,
Feb 1, 2011, 10:58:25 AM2/1/11
to dbi-...@perl.org

Hi Everybody,

I am trying to install DBD::Oracle 1.27 on Red Hat Enterprise Linux Server release 5.5 (Tikanga), Linux 2.6.18-194.17.1.el5 x86_64 x86_64 x86_64 GNU/Linux. I have already deployed the latest Oracle InstantClient and can connect to the Oracle server (running on a different box) via sqlplus. Since I'm not allowed to log on as 'root', I am installing everything in my home directory. I set the ORACLE_HOME, TNS_ADMIN, ORACLE_SID, ORACLE_USERID, LD_LIBRARY_PATH, C_INCLUDE_PATH and PERL5LIB environment variables to include everything needed for the Perl module to be happy, as well as creating tnsnames.ora and sqlnet.ora files. I can 'make' DBD::Oracle okay, but "make test" fails with the following error:

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01base................# Test loading DBI, DBD::Oracle and version
t/01base................ok
t/10general.............DBI connect('','user/password',...) failed: ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin) at t/10general.t line 22
FAILED--Further testing stopped: Unable to connect to Oracle (ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin))
make: *** [test_dynamic] Error 9

Of course, the real username and password are sent to the Oracle server, the same that allow me to connect to it from sqlplus. I wonder what could cause that error? I have done some search on the Internet, but was unable to find any definitive solution.

Thanks in advance,

Alexander Saip

Peter Hitchman

unread,
Feb 2, 2011, 4:29:13 AM2/2/11
to dbi-...@perl.org
Hi,
I have seeen this error when the ORACLE_SID being used is not a TNS alias in
the tnsnames.ora. Given that you are using the instant client, make sure
first that you can connect to the database using sqlplus and the TNS alias.
Then you should check what value is being used to connect to the database by
the test code.

Regards
Pete

Martin J. Evans

unread,
Feb 2, 2011, 4:45:35 AM2/2/11
to dbi-...@perl.org

export ORACLE_USERID=username/password
export TWO_TASK=//myoraclemachine.domain.com/sid

always works for me and you don't need to set up tnsnames.

I don't think you need ORACLE_HOME set with instant client, just LD_LIBRARY_PATH.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Alexander Saip

unread,
Feb 2, 2011, 9:44:33 AM2/2/11
to martin...@easysoft.com, dbi-...@perl.org

Martin,

setting the TWO_TASK environment variable did the trick, thanks for your advice. For some strange reason, the EZconnect format didn't work, so I had to specify the fully qualified connection string, but that got me through.

Furst, Carl

unread,
Feb 3, 2011, 11:05:39 AM2/3/11
to dbi-...@perl.org
I'm wondering if just using the username@SIDSTRING would have worked without
TWO_TASK being set? It did for me on Solaris Sparc. If TNS_ADMIN or
ORACLE_HOME is set correctly, it should lookup SIDSTRING in tnsnames.ora for
connection info.

Carl Furst


-----Original Message-----
From: Alexander Saip [mailto:as...@msn.com]
Sent: Wednesday, February 02, 2011 9:45 AM
To: martin...@easysoft.com
Cc: dbi-...@perl.org
Subject: Re: DBD::Oracle 'make test' fails - ORA-24327: need explicit attach
before authenticating a user

Joseph Koral

unread,
Feb 9, 2011, 5:02:01 PM2/9/11
to dbi-...@perl.org
On Feb 1, 10:58 am, as...@msn.com (Alexander Saip) wrote:

> I am trying to install DBD::Oracle 1.27 on Red Hat Enterprise Linux Server release 5.5 (Tikanga), Linux 2.6.18-194.17.1.el5 x86_64 x86_64 x86_64 GNU/Linux.
> I have already deployed the latest Oracle InstantClient and can connect to the Oracle server (running on a different box) via sqlplus. Since I'm not allowed to log
> on as 'root', I am installing everything in my home directory. I set the ORACLE_HOME, TNS_ADMIN, ORACLE_SID, ORACLE_USERID, LD_LIBRARY_PATH,
> C_INCLUDE_PATH and PERL5LIB environment variables to include everything needed for the Perl module to be happy, as well as creating tnsnames.ora and
> sqlnet.ora files. I can 'make' DBD::Oracle okay, but "make test" fails with the following error
>

>t/10general.............DBI connect('','user/password',...) failed: ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin)...

I had the exact same problem but I ignored it because I could connect
successfully through a Perl DBI test script. Sure enough, TWO_TASK
fixed it for me too.

However I came across this thread because I'm getting the same error
when I attempt to connect while running under mod_perl. The same code
(simple test connection) runs fine from a standalone perl script, but
I get "ORA-24327: need explicit attach before authenticating a user
(DBD ERROR: OCISessionBegin)" when attempting to connect while running
under mod_perl.

Sorry to hijack this thread, but any suggestions appreciated.

Joe

Joseph Koral

unread,
Feb 10, 2011, 11:04:11 AM2/10/11
to dbi-...@perl.org
On Feb 9, 5:02 pm, joseph.ko...@gmail.com (Joseph Koral) wrote:

> However I came across this thread because I'm getting the same error
> when I attempt to connect while running under mod_perl.  The same code
> (simple test connection) runs fine from a standalone perl script, but
> I get "ORA-24327: need explicit attach before authenticating a user
> (DBD ERROR: OCISessionBegin)" when attempting to connect while running
> under mod_perl.

Replying to myself in case others run into this problem, I found the
solution. That error message is really a simple "can not connect"
error (same error if you shutdown the listener). If using
tnsnames.ora (I was), under mod_perl I had to explicitly add the
environment variables to the mod_perl startup.pl script where I
preload the modules (even though they were already set in shell).
Alternatively, I would also expect to be able to set them in the
httpd.conf using PerlSetEnv, but I had tried that earlier to no avail.

0 new messages