Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Trouble installing DBD::Oracle Perl module through CPAN

Posted on 2008-06-19
6
Medium Priority
?
3,478 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
  • 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 1000 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

Independent Software Vendors: 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

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

876 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