Home » Open Source » Programming Interfaces » out of memory issue (oracle10g)
out of memory issue [message #685656] |
Tue, 01 March 2022 06:59 |
|
arun888
Messages: 100 Registered: June 2015 Location: INDIA
|
Senior Member |
|
|
I have tried the below query and it is consuming more time and Out of memory issues.
Out of memory!
can you please let me know to avoid the out of memory issues.
my $dbh = DBI->connect ('dbi:Oracle:usbmfs', 'US', 'states', {AutoCommit => 0, RaiseError => 1});
my $sth = $dbh->prepare (qq{ select cpu_id, system, gen, vendor, item, week_first_moved, week_last_moved from us_item_tbl });
$sth->execute;
$sth->bind_columns (\(my( $cpu, $sys, $gen, $vend, $item, $wad, $wlm)));
while ($sth->fetch) {
my $ean = sprintf "%02s%05s%05s", $sys, $vend, $item;
$cpu = sprintf "%014s", $cpu;
$lookup{$nae}{$cpu} = [$wad, $wlm];
}
$dbh->disconnect;
$$self{'SANE'} = \%lookup;
}
[Updated on: Tue, 01 March 2022 07:02] Report message to a moderator
|
|
|
out of memory issue [message #685666 is a reply to message #685656] |
Tue, 01 March 2022 21:22 |
|
arun888
Messages: 100 Registered: June 2015 Location: INDIA
|
Senior Member |
|
|
I have tried to use fetchall_arrayref function for fetching all the records from the oracle and currently getting out of memory issue. any idea how to clear the cache to get rid of the out of the memory issue.
sub sane {
my $self = shift;
my %lookup;
my $dbh = DBI->connect ('dbi:Oracle:usbmfs', 'US', 'states', {AutoCommit => 0, RaiseError => 1});
my $sth = $dbh->prepare (qq{ select cpu_id, system, gen, vendor, item,
week_first_moved, week_last_moved
from us_item_tbl });
$sth->execute ();
$sth->bind_columns (\(my( $cpu, $sys, $gen, $vend, $item, $wad, $wlm)));
my $rows = $sth->fetchall_arrayref({});;
for my $row (@$rows) {
my $nae = sprintf "%02s%05s%05s", $sys, $vend, $item;
print "$nae\n";
$upc = sprintf "%014s", $cpu;
$lookup{$ean}{$cpu} = [$wad, $wlm];
}
# }
$dbh->disconnect;
$$self{'SANE'} = \%lookup;
}
|
|
|
|
Re: out of memory issue [message #685668 is a reply to message #685667] |
Tue, 01 March 2022 22:06 |
|
arun888
Messages: 100 Registered: June 2015 Location: INDIA
|
Senior Member |
|
|
I am getting error from oracle. Please find the message below.
Error:
Out of memory!
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Oracle::db handle ukbmfp at /opt/acc_perl/lib/site_perl/5.14.2/PA-RISC2.0/DBI.pm line 2061.
2061 line code.
if (not defined $max_rows) {
push @rows, { %row } while ($sth->fetch); # full speed ahead!
}
else {
push @rows, { %row } while ($max_rows-- and $sth->fetch);
}
return \@rows;
}
my $rows = $sth->fetchall_arrayref($slice, my $MaxRows = $attr->{MaxRows});
$sth->finish if defined $MaxRows;
if (my $max = $attr->{MaxRows}) {
by including a 'C<MaxRows>' attribute in \%attr. In which case finish()
'C<MaxRows>' attribute in \%attr.
[Updated on: Tue, 01 March 2022 22:18] Report message to a moderator
|
|
|
|
|
|
Re: out of memory issue [message #685674 is a reply to message #685673] |
Wed, 02 March 2022 20:25 |
|
arun888
Messages: 100 Registered: June 2015 Location: INDIA
|
Senior Member |
|
|
Do you have any other easy way to store the records into the array values.
Query to fetch all records from the table.
select cpu_id, system, generation, vendor, item, week_first_moved, week_last_moved from us_item_tbl
Rows :5812750
Fetching all records through below code and getting out of memory:
sub sane {
my $self = shift;
my %lookup;
my $dbh = DBI->connect ('dbi:Oracle:usbmfs', 'US', 'states', {AutoCommit => 0, RaiseError => 1});
my $sth = $dbh->prepare (qq{ select cpu_id, system, generation, vendor, item, week_first_moved, week_last_moved from us_item_tbl});
$sth->execute();
my $rows = @{$dbh->selectall_arrayref('select upc_id, system, generation, vendor, item, week_first_moved, eek_last_moved from uk_item_tbl')};
foreach my $row (@$rows) {
my($cpu, sys, $gen, $vend, $item, $wad, $wlm) =@$rows;
my $ean = sprintf "%02s%05s%05s", $sys, $vend, $item;
$cpu = sprintf "%014s", $cpu;
$lookup{$nae}{$cpu} = [$wad, $wlm];
}
}
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Dec 21 10:24:49 CST 2024
|