Solved

Trouble installing DBD::Oracle Perl module through CPAN

Posted on 2008-06-19
6
3,371 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
Comment Utility
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 47

Expert Comment

by:schwertner
Comment Utility
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
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 14

Accepted Solution

by:
sentner earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL query of Oracle 10g database. 8 56
Oracle Syntax 8 38
dates - loop 12 39
Extract the first word (before the , ) 2 19
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to recover a database from a user managed backup

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now