mediocremorsov has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to debug performance issues with a perl file that runs a snippet of code similar to psuedo code like below. This script is running on a Unix machine with a db connection to a local Oracle 11.2.0 database.
my $sth1 = $localDB->prepare("< Some select query that returns mor +e 100000 records (1 column) >"); my $sth2 = $localDB->prepare("< Inner select query that uses the v +alues (id) from the previous sql >"); $sth1->execute(); my ($id); $sth1->bind_columns( undef, \$id); while ( $sth1->fetch() ) { ... $sth2->execute($id); my $dblinkname; while (($dblinkname) = $sth2->fetchrow_array()) { my $dblink_sql = "<Innermost select query that dynamically + creates a sql query with $dblinkname>"); E.G. <select * from table@dblinkname;> eval { my $dblink_sth = $localDB->prepare($dblink_sql); <-- +INV CURSOR HERE $dblink_sth->execute($id); <-- +EXECUTE FAILED HERE ... $dblink_sth->finish(); }; if ($@) { <log errors> next; } } ... $sth2->finish(); ... } $sth1->finish();
There are some machines that do not exist and executing the dblink query for those sql statements would throw the database not reachable error. However, every time I run the perl file the prepare statement marked above throws an invalid cursor (ORA-01001: invalid cursor) error and some times the execute statement right below throws an execute failed (DBD::Oracle::st fetchrow_array failed: ERROR no statement executing). I am currently at a loss on how to troubleshoot this script. Any pointers would be greatly appreciated.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Oracle Db Link Error ORA-01001: invalid cursor
by GotToBTru (Prior) on Jan 09, 2017 at 21:56 UTC | |
by mediocremorsov (Initiate) on Jan 10, 2017 at 13:24 UTC | |
by poj (Abbot) on Jan 10, 2017 at 18:53 UTC | |
by mediocremorsov (Initiate) on Jan 11, 2017 at 13:58 UTC | |
by poj (Abbot) on Jan 11, 2017 at 14:34 UTC |