DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: DBD::Oracle

  1. #1
    Join Date
    Oct 2008
    Posts
    69

    DBD::Oracle

    Hey folks,

    On our test server (Solaris 10) we have numerous test and train databases at 10g.

    We now have an 11g database set up on the server aswell.

    Does anyone have any experience with perl DBI (DBD::Oracle)?

    Some of our test interface scripts are not running on this new 11g database with problems at the DBI connect part of the script. I have written a little test connect script to try and get working

    Code:
    #!/usr/local/bin/perl -w
    
    #use  strict;
    
    use DBI;
    
    
    
    
    open(OUTP,">test_out.txt") || die("Could not open the test file\n");
    
    my $dbh = DBI->connect("DBI:Oracle:testdb","user", "pass")
      or die "error occured   $DBI::errstr\n";
    
    $sql = "select table_name from user_tables  ";
       $sth = $dbh->prepare( $sql );
        $sth->execute or die "Can't execute SQL Statement: $DBI::errstr\n";
    
       while ( @row = $sth->fetchrow_array() ) {
          print OUTP "@row\n";
      }
    
    
    #   $sth->finish;
       $dbh->disconnect();
       print "Disconnected from Oracle\n";
    
    
    exit;
    I can successfully run this against my 10g test database but get errors trying to run against 11g train database.

    Error as follows

    DBI connect('mydb','user',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME env var, NLS settings, permissions, etc. at ./dbconnectIFSTEST.pl line 12
    error occured ERROR OCIEnvNlsCreate. Check ORACLE_HOME env var, NLS settings, permissions, etc.

    10g Environment (which works) looks like this
    Code:
    oracle@testserver$ env
    _=/usr/bin/env
    LC_MONETARY=en_GB.ISO8859-1
    LC_TIME=en_GB.ISO8859-1
    SQLPATH=/home/oracle
    SSH_TTY=/dev/pts/10
    PATH=/ifs/app/oracle/test/10.2.0/bin:/ifs/app/oracle/test/10.2.0/lib32:/ifs/app/oracle/test/10.2.0/lib:/usr/ccs/bin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/openwin/bin
    ORACLE_BASE=/ifs/app/oracle
    EDITOR=vi
    LOGNAME=oracle
    LIBPATH=/ifs/app/oracle/test/10.2.0/lib32:/ifs/app/oracle/test/10.2.0/lib
    MAIL=/usr/mail/oracle
    ORACLE_SID=IFSTEST
    USER=oracle
    LC_MESSAGES=C
    TNS_ADMIN=/var/opt/oracle
    LC_CTYPE=en_GB.ISO8859-1
    SHELL=/usr/bin/ksh
    ORACLE_TERM=vt220
    HOME=/home/oracle
    LC_COLLATE=en_GB.ISO8859-1
    LC_NUMERIC=en_GB.ISO8859-1
    SSH_CONNECTION=*****************
    SSH_CLIENT=********************
    LD_LIBRARY_PATH=/ifs/app/oracle/test/10.2.0/lib32:/ifs/app/oracle/test/10.2.0/lib
    TERM=vt220
    ORACLE_HOME=/ifs/app/oracle/test/10.2.0
    PWD=/home/oracle/phil/IFSTRAIN
    TZ=GB
    11g environment (not working with DBI) looks like this

    Code:
    oracle@testserver$ env
    _=/usr/bin/env
    LC_MONETARY=en_GB.ISO8859-1
    LC_TIME=en_GB.ISO8859-1
    SQLPATH=/home/oracle
    SSH_TTY=/dev/pts/9
    PATH=/usr/ccs/bin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/openwin/bin:/ifs/app/oracle/general/product/11.2.0/dbhome_1/bin:
    ORACLE_BASE=/ifs/app/oracle
    EDITOR=vi
    LOGNAME=oracle
    MAIL=/usr/mail/oracle
    ORACLE_SID=IFSTRAIN
    USER=oracle
    LC_MESSAGES=C
    TNS_ADMIN=/var/opt/oracle
    LC_CTYPE=en_GB.ISO8859-1
    SHELL=/usr/bin/ksh
    ORACLE_TERM=vt220
    HOME=/home/oracle
    LC_COLLATE=en_GB.ISO8859-1
    LC_NUMERIC=en_GB.ISO8859-1
    SSH_CONNECTION=***********************
    SSH_CLIENT=******************
    LD_LIBRARY_PATH=/usr/lib:/usr/ucblib:/ifs/app/oracle/general/product/11.2.0/dbhome_1/lib
    TERM=vt220
    ORACLE_HOME=/ifs/app/oracle/general/product/11.2.0/dbhome_1
    PWD=/home/oracle/phil/IFSTRAIN
    TZ=GB
    Do i have to reinstall DBD::Oracle within my 11g environment to get it to work?
    Could this affect the numerous other test systems on this server that are using perl to connect to their oracle databases?

    Thanks
    Phil

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Wild guess... are you pointing to the right ORACLE_HOME?

    Can you connect sqlplus using the same environmentals?
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  3. #3
    Join Date
    Oct 2008
    Posts
    69
    Quote Originally Posted by PAVB View Post
    Wild guess... are you pointing to the right ORACLE_HOME?

    Can you connect sqlplus using the same environmentals?
    Yeah, sqlplus works fine, just using perl dbi.

    I am assuming i have to install DBD::Oracle against this database. I am confused as to how many DBD::Oracle drivers you can have. I was thinking you just had one in your perl installation that would connect to all your databases but perhaps this is not the case.

  4. #4
    Join Date
    Jan 2001
    Posts
    515

    Path

    in your PATH for 10g you are pointing to you ORACLE 10g bin , lib and lib32. You are not pointing to all of those things in your 11g PATH

  5. #5
    Join Date
    Oct 2008
    Posts
    69
    Quote Originally Posted by lesstjm View Post
    in your PATH for 10g you are pointing to you ORACLE 10g bin , lib and lib32. You are not pointing to all of those things in your 11g PATH
    Hi, yeah i have since put these in my PATH but same error.
    Although there is no lib32 in the 11g home

  6. #6
    Join Date
    Apr 2001
    Location
    Bangalore, India
    Posts
    727
    may be you can use 'truss' command and see where the script is failing.

    See Jeff's notes on 'truss' ing

    http://www.idevelopment.info/data/Un...nSolaris.shtml
    Thomas Saviour(royxavier@yahoo.com)
    Technical Lead (Databases)
    Thomson Reuters (Markets)

    http://ora600tom.wordpress.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width