DBD::Oracle test failure under DBI 1.49
DBD::Oracle 1.16 fails a test for me when building under DBI 1.49. All was fine with the identical build under DBI 1.48. This is on SuSE Linux 9.3, 32-bit Athlon. In a nutshell: Can't bind a reference (DBI::st=HASH(0x82df350)) at t/50cursor.t line 91. A full transcript is attached, please let me know if any further info would be useful. Many thanks -- Michael Gray Computer Officer Cambridge University Engineering Department, Cambridge CB2 1PZ dbd-oracle-build Description: typescript (lightly edited)
DBI:Oracle failure ORA-12154
I run locally a client script which fails with the following message: ORA-12154: TNS:could not resolve service name (DBD ERROR: OCIServerAttach) at ... DBI::connect('DBI','dbi:Oracle:abc','batman','secret','HASH(0x82d7910)') called at ... The datasource seems ok to me, and I checked from 'tnsnames.ora' that the port is set up to the default 1521 and the name is 'abc'. Any idea of what could be the problem? -- Claude
Re: DBI:Oracle failure ORA-12154
Is $ORACLE_HOME set to the correct path? If the tnsnames.ora is not in $ORACLE_HOME/network/admin/, is $TNS_ADMIN set to the actual location of the file? On 09 Dec 2005 15:37:33 +0200, Claude [EMAIL PROTECTED] wrote: I run locally a client script which fails with the following message: ORA-12154: TNS:could not resolve service name (DBD ERROR: OCIServerAttach) at ... DBI::connect('DBI','dbi:Oracle:abc','batman','secret','HASH(0x82d7910)') called at ... The datasource seems ok to me, and I checked from 'tnsnames.ora' that the port is set up to the default 1521 and the name is 'abc'. Any idea of what could be the problem? -- Claude -- It all comes down to a choice really. You can get busy living, or get busy dying. --Stephen King
Re: problems using DBI:Proxy
On Thu, 2005-12-08 at 14:25 +0200, Claude wrote: I have problems using DBI:Proxy / DBI:Proxyserver with an Oracle database. In fact, I am not sure that I start the proxy properly. I'd like to connect to a remote Oracle database (called 'abc') running on machine A (ip=1.2.3.4), port 1521. Port 1521 is used by Oracle (if setup that way) for tnslistener. You can't bind to that port since it is already in use. As the error message indicated. On the server that has Oracle use the dbiproxy command that is installed when DBI is is installed. something like dbiproxy --port ...then you can connect to this proxy server from other servers. i.e. $ENV{DBI_AUTOPROXY} = 'hostname=srvA;port='; my $dbh = DBI-connect('dbi:Oracle:sid', 'user', 'passwsd'); ...etc. Do some reading :-) perldoc dbiproxy First, on A, I created a proxy startup file: - $ cat ./testProxy0.pl #!/usr/bin/perl -- # -*-Perl-*- use DBI::ProxyServer; use strict; use diagnostics; DBI::ProxyServer::main(@ARGV); - Then I run it, and... get an error: - $ ./testProxy0.pl -localaddr 1.2.3.4 --localport 1521 running... Uncaught exception from user code: Cannot create socket: Address already in use at /usr/lib/perl5/vendor_perl/5.8.0/Net/Daemon.pm line 548. at /usr/lib/perl5/vendor_perl/5.8.0/Net/Daemon/Log.pm line 136. Net::Daemon::Log::Fatal('DBI::ProxyServer=HASH(0x8275980)','Cannot create socket: Address already in use') called at /usr/lib/perl5/vendor_perl/5.8.0/Net/Daemon.pm line 548 Net::Daemon::Bind('DBI::ProxyServer=HASH(0x8275980)') called at /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/DBI/ProxyServer.pm line 234 DBI::ProxyServer::main('-localaddr',1.2.3.4,'--localport',1521) called at ./testProxy0.pl line 5 - Now, changing the port to a free value (1521 is used by Oracle) gets rid of the error. Is this the way to go? Is this 'free' port the value that the DBI:Proxy should send a request to? But then, I don't understand how to tell the proxy what port is the database running at. Can you help? Thanks for your time. -- Scott T. Hildreth [EMAIL PROTECTED]
RE: Oracle failure ORA-12154
Can you connect to this database using SQL*Plus in the same manner? From the error docs: $ oerr ora 12154 12154, 0, TNS:could not resolve service name // *Cause: The service name specified is not defined correctly in the // TNSNAMES.ORA file. // *Action: Make the following checks and correct the error: // - Verify that a TNSNAMES.ORA file exists and is in the proper // place and accessible. See the operating system specific manual // for details on the required name and location. // - Check to see that the service name exists in one of the // TNSNAMES.ORA files and add it if necessary. // - Make sure there are no syntax errors anywhere in the file. // Particularly look for unmatched parentheses or stray characters. // Any error in a TNSNAMES.ORA file makes it unusable. See // Chapter 4 in the SQL*Net V2 Administrator's Guide. If // possible, regenerate the configuration files using the Oracle // Network Manager. -- Ron Reidy Lead DBA Array BioPharma, Inc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Claude Sent: Friday, December 09, 2005 6:38 AM To: dbi-users@perl.org Subject: DBI:Oracle failure ORA-12154 I run locally a client script which fails with the following message: ORA-12154: TNS:could not resolve service name (DBD ERROR: OCIServerAttach) at ... DBI::connect('DBI','dbi:Oracle:abc','batman','secret','HASH(0x82d7910)') called at ... The datasource seems ok to me, and I checked from 'tnsnames.ora' that the port is set up to the default 1521 and the name is 'abc'. Any idea of what could be the problem? -- Claude This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
Re: DBD::Oracle test failure under DBI 1.49
On Fri, Dec 09, 2005 at 11:45:44AM +, Michael Gray wrote: DBD::Oracle 1.16 fails a test for me when building under DBI 1.49. All was fine with the identical build under DBI 1.48. This is on SuSE Linux 9.3, 32-bit Athlon. In a nutshell: Can't bind a reference (DBI::st=HASH(0x82df350)) at t/50cursor.t line 91. A full transcript is attached, please let me know if any further info would be useful. I think I know what this is. (DBD::Oracle uses a shortcut to check if a ref is a DBI handle - that's no longer reliable now handles also have weak reference magic.) Although the best fix would be to DBD::Oracle (which I'll do for the next release), I'll see if I can fix it from the DBI side to avoid a lot of inconvenience for people. Tim.
Re: DBD::Oracle 2nd insert of row into table with 2 CLOBs hangs
On Tue, 2005-12-06 at 15:43 -0800, Joe Slagel wrote: Hi Tim Folks, We've found a interesting problem when inserting multiple rows into a table containing two CLOB columns. The second execute() hangs and Oracle never responds. The execute() hangs only when the character sizes of the two strings are larger than 4000 characters each, and even then not always. Code is below which demonstrates problem. Any clues as to whether this is in the DBD layer or in Oracle? A few questions: * Can you reproduce this in SQL*Plus or PL/SQL? If so, then you have a problem with the database, possibly a bug. * Have you traced the session via 10046 to see exactly what the session is doing? * Have you checked v$sesstat to see what the session is waiting on? select s.username username, e.event event, s.sid, e.p1text, e.p1, e.p2text, e.p2, e.wait_time, e.seconds_in_wait, e.state from v$session s, v$session_wait e where s.username is not null and s.sid = e.sid and s.username like upper('uusername') order by s.username, upper(e.event) This should help determine if the problem is in the db or somewhere else. HTH Jared
RE: Oracle 10g and DBD::Oracle
This does not look the same. Where are the bind variables? -Original Message- From: Peter Santos [mailto:[EMAIL PROTECTED] Sent: Friday, December 09, 2005 7:32 AM To: Reidy, Ron Cc: dbi-users@perl.org Subject: Re: Oracle 10g and DBD::Oracle No this issue is not repeatable in SqlPlus. Here is the test case for sqlplus. First I updated the table to include 3 records with distinct date_left columns. Just to make it easier to test. DATE_LEFT === 11/28/05 12:13 11/29/05 15:30 11/30/05 19:22 Then I setup my test script which I will show you shortly, but I also executed the following query to give me the total parse and hard parses before and after my query block. QUERY1: select decode(statistic#,299,'Total parse count (299)', 300,'Hard parse count (300)',statistic#)statistic#, value from v$mystat where statistic# in (299,300) So QUERY1 was executed before and after my little script... Here is the actual sql block. DECLARE col1 varchar2(10); col2 varchar2(10); BEGIN for x in (select to_char(date_left,'MMDD')dt from PETER_T1) LOOP SELECT /*SQL-TEST4 */ column1,column2 INTO col1,col2 FROM PETER_T1 WHERE DATE_LEFT BETWEEN TO_DATE(x.dt, 'MMDD') AND TO_DATE(x.dt || ' 235959', 'MMDD HH24MISS'); END LOOP; END; / The above SQL Block creates only 1 cursor not 2. I also confirmed by running QUERY1 before and after my block that the first time I have a hard parse, but subsequent times, it's a soft parse. The parsing behavior is the same with perl ... meaning the 2nd time the query is executed it's a soft parse, but there is that 1 extra cursor from the prepare() in perl, but not via sqlplus. --peter Reidy, Ron wrote: Peter, Can you repeat this same issue in SQL*Plus? -- Ron Reidy Lead DBA Array BioPharma, Inc. -Original Message- From: Peter Santos [mailto:[EMAIL PROTECTED] Sent: Thursday, December 08, 2005 9:00 AM To: dbi-users@perl.org Subject: re: Oracle 10g and DBD::Oracle Dear users, I'm hoping to get some insight into why oracle creates 2 cursors for the same sql query when I execute a SELECT statement via my small little perl script. Here is what is happening .. My query uses 2 bind variables and when it is prepared oracle generates 1 cursor for my query. When I execute that prepared statement with actual input bind variables, it generates a 2nd cursor for the same query. The problem here is that during the prepare, oracle identifies my 2 bind parameters as 2000 character bytes max. When I actually execute the query with the binds, it calculates the bind parameters as 32 characters. So because of bind peeking it thinks it's 2 different queries and generates 2 cursors... where the first cursor has executions=0. I can turn off bind peeking with the parameter _optim_peek_user_binds, but then instead of just having a cursor mismatch on user_bind_peeking I have a cursor mismatch on bind_mismatch. Does anyone know how to get around this? This to me is a waste of shared pool resources..and we have lots of this happening in our database. I've asked oracle for help, but I'm getting nowhere... Here is the complete test case. My env: Solaris 8 - Oracle 10.1.0.4 DBI (version 1.48) and DBD::Oracle (version 1.6) ** *TEST TABLE * === CREATE TABLE TEST_T1 (column1 varchar2(10), column2 varchar2(10), date_left date); insert into TEST_1 values('Fname','Lname',to_date('20051130 153015','MMDD HH24MISS'); insert into TEST_1 values('Fname','Lname',to_date('20051130 203015','MMDD HH24MISS'); *PERL PROGRAM * == #!/bin/perl use DBI; my $dbh = DBI-connect( 'dbi:Oracle:;[mydb]', '[username]', '[password]',) || die Database connection not made: $DBI::errstr; my $date1 = 20051130; my $date2 = 20051130; my $sql = qq{SELECT column1,column2\nfrom TEST_T1\n}; $sql .= qq{WHERE\ndate_left between to_date( :p1 , 'MMDD') and }; $sql .= qq{to_date( :p2 || ' 235959', 'MMDD HH24MISS')}; *# prepare select query * my $sth = $dbh-prepare($sql);*# generates cursor1* $sth-bind_param(:p1,$date1); $sth-bind_param(:p2,$date2); $sth-execute(); *# generates cursor2* print COLUMN1\tCOLUMN2\n; print ===\t===\n; $sth-bind_columns( \$column1, \$column2); while( $sth-fetch() ) { print $column1\t$column2\n; } $dbh-disconnect; exit; *Here is what's in the Oracle data dictionary* HASH_VALUE|SQL_ID | ROWSP| EXECS| CHILD#|CHILD_ADDRESS |MODULE --|-|--|--|||-- --|-|--|--|||- --|-|--|--|||-- - --|-|--|--|||--- 3546516858|2jwh16z9q73bu| 0| 0|0 |040144BD2140|[EMAIL PROTECTED] 3546516858|2jwh16z9q73bu| 2| 1|1 |04012CECAAF0|[EMAIL PROTECTED] ** So, 1 query and 2 representations of that same
Re: Oracle 10g and DBD::Oracle
No this issue is not repeatable in SqlPlus. Here is the test case for sqlplus. First I updated the table to include 3 records with distinct date_left columns. Just to make it easier to test. DATE_LEFT === 11/28/05 12:13 11/29/05 15:30 11/30/05 19:22 Then I setup my test script which I will show you shortly, but I also executed the following query to give me the total parse and hard parses before and after my query block. QUERY1: select decode(statistic#,299,'Total parse count (299)', 300,'Hard parse count (300)',statistic#)statistic#, value from v$mystat where statistic# in (299,300) So QUERY1 was executed before and after my little script... Here is the actual sql block. DECLARE col1 varchar2(10); col2 varchar2(10); BEGIN for x in (select to_char(date_left,'MMDD')dt from PETER_T1) LOOP SELECT /*SQL-TEST4 */ column1,column2 INTO col1,col2 FROM PETER_T1 WHERE DATE_LEFT BETWEEN TO_DATE(x.dt, 'MMDD') AND TO_DATE(x.dt || ' 235959', 'MMDD HH24MISS'); END LOOP; END; / The above SQL Block creates only 1 cursor not 2. I also confirmed by running QUERY1 before and after my block that the first time I have a hard parse, but subsequent times, it's a soft parse. The parsing behavior is the same with perl ... meaning the 2nd time the query is executed it's a soft parse, but there is that 1 extra cursor from the prepare() in perl, but not via sqlplus. --peter Reidy, Ron wrote: Peter, Can you repeat this same issue in SQL*Plus? -- Ron Reidy Lead DBA Array BioPharma, Inc. -Original Message- From: Peter Santos [mailto:[EMAIL PROTECTED] Sent: Thursday, December 08, 2005 9:00 AM To: dbi-users@perl.org Subject: re: Oracle 10g and DBD::Oracle Dear users, I'm hoping to get some insight into why oracle creates 2 cursors for the same sql query when I execute a SELECT statement via my small little perl script. Here is what is happening .. My query uses 2 bind variables and when it is prepared oracle generates 1 cursor for my query. When I execute that prepared statement with actual input bind variables, it generates a 2nd cursor for the same query. The problem here is that during the prepare, oracle identifies my 2 bind parameters as 2000 character bytes max. When I actually execute the query with the binds, it calculates the bind parameters as 32 characters. So because of bind peeking it thinks it's 2 different queries and generates 2 cursors... where the first cursor has executions=0. I can turn off bind peeking with the parameter _optim_peek_user_binds, but then instead of just having a cursor mismatch on user_bind_peeking I have a cursor mismatch on bind_mismatch. Does anyone know how to get around this? This to me is a waste of shared pool resources..and we have lots of this happening in our database. I've asked oracle for help, but I'm getting nowhere... Here is the complete test case. My env: Solaris 8 - Oracle 10.1.0.4 DBI (version 1.48) and DBD::Oracle (version 1.6) ** *TEST TABLE * === CREATE TABLE TEST_T1 (column1 varchar2(10), column2 varchar2(10), date_left date); insert into TEST_1 values('Fname','Lname',to_date('20051130 153015','MMDD HH24MISS'); insert into TEST_1 values('Fname','Lname',to_date('20051130 203015','MMDD HH24MISS'); *PERL PROGRAM * == #!/bin/perl use DBI; my $dbh = DBI-connect( 'dbi:Oracle:;[mydb]', '[username]', '[password]',) || die Database connection not made: $DBI::errstr; my $date1 = 20051130; my $date2 = 20051130; my $sql = qq{SELECT column1,column2\nfrom TEST_T1\n}; $sql .= qq{WHERE\ndate_left between to_date( :p1 , 'MMDD') and }; $sql .= qq{to_date( :p2 || ' 235959', 'MMDD HH24MISS')}; *# prepare select query * my $sth = $dbh-prepare($sql);*# generates cursor1* $sth-bind_param(:p1,$date1); $sth-bind_param(:p2,$date2); $sth-execute(); *# generates cursor2* print COLUMN1\tCOLUMN2\n; print ===\t===\n; $sth-bind_columns( \$column1, \$column2); while( $sth-fetch() ) { print $column1\t$column2\n; } $dbh-disconnect; exit; *Here is what's in the Oracle data dictionary* HASH_VALUE|SQL_ID | ROWSP| EXECS| CHILD#|CHILD_ADDRESS |MODULE --|-|--|--|||--- --|-|--|--|||--- --|-|--|--|||--- 3546516858|2jwh16z9q73bu| 0| 0|0 |040144BD2140|[EMAIL PROTECTED] 3546516858|2jwh16z9q73bu| 2| 1|1 |04012CECAAF0|[EMAIL PROTECTED] ** So, 1 query and 2 representations of that same query in the database. The execute did not shared the cursor prepared by the prepare() call. SQL select * from v$sql_shared_cursor where sql_id='2jwh16z9q73bu'; CHILD_ADDRESS |CHILD#|U|S|O|O|S|L|S|E|B|P|I|S|T|A|B|D|L|T|R|I|I|R|L|I|O|S|M|*U*|T| |--|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
DBI::Oracle questions
I know you are probably swamped with dumb questions, I will try to be brief and to the point. Any help would be appreciated. 1. I would like to install a PRECOMPILED version of the DBD package for Windows? Does such a thing exist - I looked at Oracle and saw nothing. I read groups saying it was in the works. 2. I am attempting to install on client machines (Windows) without having to install any oracle client software (hence trying to use a precompiled version) 3. My machine with 10g works fine connecting with perl (it seems to use all the junk the oracle install put on the machine). I have tried to move the associated .pm files from that machine to a clean machine (without oracle). It doesn't seem to work, but that could be my fault. 4. Thanks in advance for any pointers. Sincerely, Daryl Pietrocarlo Director Advanced Technology 10e Solutions [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.10esolutions.com
Re: Oracle 10g and DBD::Oracle
The bind variable is x.dt which will contain 3 different values for every iteration of the loop. I'll be more explicit.. Here is what I have in the database: --select to_char(date_left,'MMDD')dt from test_t1; 20051129 20051130 20051128 Now for the sql script... ---START-OF-SCRIPT--- var p1 varchar2(100); var p2 varchar2(100); exec :p1:='20051128'; :p2:='20051128'; SELECT /*BIND-TEST */ column1,column2,date_left FROM TEST_T1 WHERE DATE_LEFT BETWEEN TO_DATE(:p1, 'MMDD') AND TO_DATE(:p2 || ' 235959', 'MMDD HH24MISS') / exec :p1:='20051129'; :p2:='20051129'; SELECT /*BIND-TEST */ column1,column2,date_left FROM TEST_T1 WHERE DATE_LEFT BETWEEN TO_DATE(:p1, 'MMDD') AND TO_DATE(:p2 || ' 235959', 'MMDD HH24MISS') / exec :p1:='20051130'; :p2:='20051130'; SELECT /*BIND-TEST */ column1,column2,date_left FROM TEST_T1 WHERE DATE_LEFT BETWEEN TO_DATE(:p1, 'MMDD') AND TO_DATE(:p2 || ' 235959', 'MMDD HH24MISS') / ---END-OF-SCRIPT--- So before each SELECT I set the bind variables to a new value. This gives me 1 hard parse and 2 soft parses and ONLY 1 cursor in the database (V$SQL). HTH --peter Reidy, Ron wrote: This does not look the same. Where are the bind variables? -Original Message- From: Peter Santos [mailto:[EMAIL PROTECTED] Sent: Friday, December 09, 2005 7:32 AM To: Reidy, Ron Cc: dbi-users@perl.org Subject: Re: Oracle 10g and DBD::Oracle No this issue is not repeatable in SqlPlus. Here is the test case for sqlplus. First I updated the table to include 3 records with distinct date_left columns. Just to make it easier to test. DATE_LEFT === 11/28/05 12:13 11/29/05 15:30 11/30/05 19:22 Then I setup my test script which I will show you shortly, but I also executed the following query to give me the total parse and hard parses before and after my query block. QUERY1: select decode(statistic#,299,'Total parse count (299)', 300,'Hard parse count (300)',statistic#)statistic#, value from v$mystat where statistic# in (299,300) So QUERY1 was executed before and after my little script... Here is the actual sql block. DECLARE col1 varchar2(10); col2 varchar2(10); BEGIN for x in (select to_char(date_left,'MMDD')dt from PETER_T1) LOOP SELECT /*SQL-TEST4 */ column1,column2 INTO col1,col2 FROM PETER_T1 WHERE DATE_LEFT BETWEEN TO_DATE(x.dt, 'MMDD') AND TO_DATE(x.dt || ' 235959', 'MMDD HH24MISS'); END LOOP; END; / The above SQL Block creates only 1 cursor not 2. I also confirmed by running QUERY1 before and after my block that the first time I have a hard parse, but subsequent times, it's a soft parse. The parsing behavior is the same with perl ... meaning the 2nd time the query is executed it's a soft parse, but there is that 1 extra cursor from the prepare() in perl, but not via sqlplus. --peter Reidy, Ron wrote: Peter, Can you repeat this same issue in SQL*Plus? -- Ron Reidy Lead DBA Array BioPharma, Inc. -Original Message- From: Peter Santos [mailto:[EMAIL PROTECTED] Sent: Thursday, December 08, 2005 9:00 AM To: dbi-users@perl.org Subject: re: Oracle 10g and DBD::Oracle Dear users, I'm hoping to get some insight into why oracle creates 2 cursors for the same sql query when I execute a SELECT statement via my small little perl script. Here is what is happening .. My query uses 2 bind variables and when it is prepared oracle generates 1 cursor for my query. When I execute that prepared statement with actual input bind variables, it generates a 2nd cursor for the same query. The problem here is that during the prepare, oracle identifies my 2 bind parameters as 2000 character bytes max. When I actually execute the query with the binds, it calculates the bind parameters as 32 characters. So because of bind peeking it thinks it's 2 different queries and generates 2 cursors... where the first cursor has executions=0. I can turn off bind peeking with the parameter _optim_peek_user_binds, but then instead of just having a cursor mismatch on user_bind_peeking I have a cursor mismatch on bind_mismatch. Does anyone know how to get around this? This to me is a waste of shared pool resources..and we have lots of this happening in our database. I've asked oracle for help, but I'm getting nowhere... Here is the complete test case. My env: Solaris 8 - Oracle 10.1.0.4 DBI (version 1.48) and DBD::Oracle (version 1.6) ** *TEST TABLE * === CREATE TABLE TEST_T1 (column1 varchar2(10), column2 varchar2(10), date_left date); insert into TEST_1 values('Fname','Lname',to_date('20051130 153015','MMDD HH24MISS'); insert into TEST_1 values('Fname','Lname',to_date('20051130 203015','MMDD HH24MISS'); *PERL PROGRAM * == #!/bin/perl use DBI; my $dbh = DBI-connect( 'dbi:Oracle:;[mydb]', '[username]', '[password]',) || die Database connection not made: $DBI::errstr; my $date1 = 20051130; my $date2 = 20051130; my $sql = qq{SELECT
DBI::db and invisibility
hey, I've been writing a DBD plugin for DBI, and was wondering why the DBI::db object that I've been creating doesn't show its contents either via Dumper or via 'x' in the database. Is this a consequence of how DBI is programmed? Would it be easy to change to remove this limitation? After all, it would be a lot easier to program/debug my driver if I could use all of perl's debugging tools.. Ed