Hi all, I tried to make use of the afork procedure with a DBI call but I don't know why it kept gives me this lost contact error at the end. What would you suggest? I kindly appreciate your input. Thank you ben
--- test.pl --- use DBI; use DBD::Oracle qw(:ora_session_modes); my $tbs_name='T2010'; my $dbh = DBI->connect("DBI:Oracle:","","",{ora_session_mode => ORA_SY +SDBA,RaiseError=>1,AutoCommit=>1,PrintError=>1}); my $sql = sprintf qq{SELECT DISTINCT TABLE_OWNER,TABLE_NAME FROM SYS.D +BA_TAB_PARTITIONS WHERE TABLESPACE_NAME=? AND TABLE_OWNER='FOO'}; my $sql_h = $dbh->prepare($sql); $sql_h->execute($tbs_name); $sql_ref = $sql_h->fetchall_arrayref; afork ($sql_ref,10,\&initialize_control_data,$dbh); $dbh->disconnect(); exit(0); sub afork (\@$&&) { my ($data,$max,$code,$cdbh) = @_; my $c = 0; foreach my $data (@$data) { wait unless ++$c <= $max; die "Fork failed: $!\n" unless defined (my $pid = fork); $cdbh->{InactiveDestroy} = 1 if ($pid); exit $code->($cdbh,@$data[0],@$data[1]) unless $pid; } 1 until -1 == wait; } sub initialize_control_data { my ($edbh,$schema,$table) = @_; print "$schema,$table\n"; } --- end --- % test.pl FOO,TABLE1 ... FOO,TABLEn DBD::Oracle::db disconnect failed: ORA-03135: connection lost contact +(DBD ERROR: OCISessionEnd) at ./test.pl line 20. DBD::Oracle::db disconnect failed: ORA-03135: connection lost contact +(DBD ERROR: OCISessionEnd) at ./test.pl line 20.

In reply to help with afork and dbi by bplegend

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.