Re: Identify PID for remote database handle



I don't know of any way to do this using DBI or DBD::Oracle.
You might get better answers on an Oracle DBA list
(try http://www.freelists.org/list/oracle-l or http://www.lazydba.com )

This seems to work in Oracle 9.2, but I just hacked it together in a couple of minutes and
it's not thoroughly tested (i.e. testcases = 1 with 100% success). Also, there are probably
better ways to find your own SID. This of course assumes that the user has access to the
V$ tables (which they probably shouldn't have).

select vp.spid from v$process vp, v$session vs
where vs.sid = (select sid from v$mystat where rownum = 1)
and vp.addr = vs.paddr;


I've been thinking about why you might want this and now I'm not sure it's the answer
you want anyway. Running sqlplus inside of perl seems redundant for most purposes.
And now that I think about it I'm sure DBI/DBD::Oracle can't help you here because it is not
going to know anything about the sqlplus connection, just the DBI handle.
So it really is off-topic for this list.

-Chris

On May 22, 2006, at 6:07 PM, Drozdowski, Catharine wrote:
How can I find the server pid for a sqlplus session which is logged on
remotely inside a perl program... I can find the local PID using $$ or
$PID, but how can I find the pid for the statement/database handle which
is actually logged onto the database doing the work...

Env: Oracle, Solaris


Catharine Drozdowski
Mentor Graphics Corporation
IT Systems Services
1 503 685 7906







.



Relevant Pages

  • RE: oracle win2k ORA-1222 problems
    ... AS does not provide a package, but you can and should install both DBI and DBD::Oracle from ftp.esoftmatic.com. ... Oracle is listed as "failed" if I recall correctly. ... Data Source is DBI:Oracle:Space ...
    (perl.dbi.users)
  • RE: DBI problem
    ... I had Oracle 8 all along, I upgraded to ActiveState Perl 5.8.7 from ... DBD 1.16 and DBI 1.48. ... Did you install DBD::Oracle? ...
    (perl.dbi.users)
  • RE: (Fwd) DBD:: Oracle Problems
    ... The error is being thrown inside the pl/sql procedure itself not the DBI! ... Subject: DBD:: Oracle Problems ... are receiving the following error when we execute any stored procedures. ... This email has been scanned by the MessageLabs Email Security System. ...
    (perl.dbi.users)
  • Re: OCIEnvNlsCreate error with DBD::Oracle 1.21 and Oracle 10g client in Cygwin
    ... If not: you could reinstall DBI and DBD::Oracle and make sure that your Oracle environment is set correctly. ... If you have multiple Oracle installations: set your $ENVusing the ORACLE_HOME with which you compiled your DBD::Oracle. ... If you have multiple perl installations (with DBI, DBD::Oracle) you may have to set the correct path to perl (first line of your script). ...
    (perl.dbi.users)
  • RE: Unix: Oracle User Identified Externally
    ... Subject: Unix: Oracle User Identified Externally ... use DBI; ... intended recipient, please be aware that any disclosure, copying, distribution ... sender of the delivery error by replying to this message, or notify us by ...
    (perl.dbi.users)