Solved

Trouble installing DBD::Oracle Perl module through CPAN

Posted on 2008-06-19
6
3,424 Views
Last Modified: 2013-12-18
I'm trying to install the DBD::Oracle module for Perl.  I'm doing this through the command line on a Suse Linux box.  

First I enter: perl -MCPAN -e shell

Once the CPAN shell comes up, I enter: install DBD::Oracle

Afterwards, the installation fails.  From looking at the output I see this error repeated over and over again: DBI connect('','scott/tiger',...) failed: ORA-12162: TNS:net service name is incorrectly specified (DBD ERROR: OCIServerAttach)

I should also mention that it first looks for an Oracle client when I try to install it the first time.  I'm using the Oracle Instant Client 10.2.  Once it prompts me with the error the first time I provide a means for it to find the client.  I exit out of the CPAN shell and they enter: export LD_LIBRARY_PATH=/this/directory/instantclient_10_2.  Afterwards, it doesn't give me trouble with that and leads me to the problem at hand.

I've looked around for hours today and I still don't understand what the problem is.  I saved the entire output, so I can provide more information if needed.

Thanks.
0
Comment
Question by:ryan_bender
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:sentner
ID: 21828139
Prior to doing the install of DBD::Oracle, you need to set some environment variables.  Some of these are likely in your oracle user's .profile, so you can source that .profile first.  

Try doing something like this first:

PATH1=$PATH
LPATH=$LD_LIBRARY_PATH
. ~oracle/.profile
export TNS_ADMIN=$INSTALLPATH
export PATH=$PATH1:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LPATH
export ORACLE_USERID="user/password@MYDB"
ORACLE_SID=MYDB

Then enter the CPAN shell and try the install.  I've never done it through the CPAN shell (I usually just download and make install), nor have I used the Oracle Instant Client, but the premise is the same.  The reason it's failing is on the make test portion, because the ORACLE_USERID isn't set.  You can use tnsping to verify that you can connect to the DB prior to doing the install, to make sure you have your variables correct.
0
 
LVL 48

Expert Comment

by:schwertner
ID: 21829131
Look here

http://jeanchristophe.duber.free.fr/dbd_oracle_instantclient_linux/
http://www.dba-oracle.com/t_dbi_interface1.htm

Mr. Sentner is correct. In Linux you have to set environment
and kernel variables and parameters very carefully.
0
 

Author Comment

by:ryan_bender
ID: 21832899
I played with the environmental variables a bit.  Changing the ORACLE_USERID and ORACLE_SID seemed to address the problem.  When I tried to install it again, it was using those usernames and passwords that I provided rather than the scott/tiger credentials.  But it still was failing the tests, preventing it from installing correctly.

First I ran:
          export ORACLE_USERID=username/password@THE_DB
          export ORACLE_SID=THE_DB
and saw this error repeatedly during the attempted installation:
          ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach)

Then I ran:
          export ORACLE_USERID=username/password
          export ORACLE_SID=THE_DB
and saw this error repeatedly during the attempted installation:
          ORA-12545: Connect failed because target host or object does not exist (DBD ERROR: OCIServerAttach)

Thinking I just needed to point where the I ran:
          export ORACLE_USERID=username/password
          export ORACLE_SID=THE_DB
          export TNS_ADMIN=/this/directory/instantclient_10_2
and saw this error repeatedly during the attempted installation:
          ORA-12545: Connect failed because target host or object does not exist (DBD ERROR: OCIServerAttach)

Then I tried:
          export ORACLE_SID=THE_DB
          export ORACLE_USERID=username/password@THE_DB
          export TNS_ADMIN=/this/directory/instantclient_10_2
and this time there wasn't any dominating problem, but there were multiple instances of these errors:
          ORA-03237: Initial Extent of specified size cannot be allocated in tablespace
          ORA-00942: table or view does not exist

So it looks like this is the right track, but not quite there yet.  Any clues?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Accepted Solution

by:
sentner earned 250 total points
ID: 21833758
Sounds like the user you're using doesn't have rights to write to the DB to create a table.  If it installed correctly, then you may be ok anyway, you can just treat those as warnings.  If it still failed to install, then you need to make sure the DB user is a DBA.
0
 
LVL 14

Expert Comment

by:sentner
ID: 21833826
Also, add ORACLE_HOME to your list of exports, and set it to the instantclient directory.   Not sure if that's causing your problem, but it can't hurt.  TNS_ADMIN should point to whereever your tnsnames.ora file is.  

See:  http://eldapo.lembobrothers.com/2007/03/16/oracle-instantclient-and-dbdoracle/

0
 

Author Comment

by:ryan_bender
ID: 21834831
So I went against my instincts and installed it anyway.  And it worked!  I'll remember that one for next time.  Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question