Solved

Trouble installing DBD::Oracle Perl module through CPAN

Posted on 2008-06-19
6
3,395 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle Pivot Question 8 71
Oracle Listener Not Starting 11 51
oracle RMAN - trying to duplicate a database 5 38
Trying to get a Linked Server to Oracle DB working 21 67
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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

809 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