Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How can I get UNIX ID from PLSQL?

Re: How can I get UNIX ID from PLSQL?

From: Srinivasa R Kamabathula <srnvk_at_yahoo.com>
Date: Thu, 10 Feb 2000 17:19:41 GMT
Message-ID: <87urv9$ipt$1@nnrp1.deja.com>


Hello:
There are two solutions to the issue. If you want to find out the UserID (Integer) stored in the /etc/passwd file on the UNIX systems, you need to use DBMS_PIPE package, supplied by Oracle. Using this you can execute any OS command. So after getting the username from V$SESSION, you grep the /etc/passwd file for the UserID. That is one solution. Another solution is to using to use UTL_FILE package. What you could do is copy /etc/passwd file into the dir where INITsid.ORA's parameter UTL_FILE_DIR is pointing. And then you can parse the file using the Username you got from V$SESSION.

-Srini

In article <87uc7p$6ul$1_at_nnrp1.deja.com>,   Gonzalo <GSegarra_at_iname.com> wrote:
> In article <38a1b8e0.87080656_at_news.evli.fi>,
> aarre.heikkila_at_evli.fi (Aarre Heikkilä) wrote:
> > Try this:
> >
> > column 'Sid' format 9999
> > column 'OsUser' format a8
> > column 'User' format a7
> > Column 'U_PID' format A5
> > Column 'Program' format A50
> > SELECT ALL SYS.V_$SESSION.SID,
> > SYS.V_$SESSION.SERIAL#,
> > SYS.V_$PROCESS.SPID "U_PID",
> > SYS.V_$SESSION.LOCKWAIT,
> > SYS.V_$SESSION.OSUSER "OsUser",
> > SYS.V_$SESSION.USERNAME "User",
> > SYS.V_$SESSION.TERMINAL,
> > SYS.V_$SESSION.PROGRAM "Program",
> > SYS.V_$SESSION.SADDR
> > FROM
> > SYS.V_$PROCESS, SYS.V_$SESSION
> > WHERE
> > SYS.V_$PROCESS.ADDR=SYS.V_$SESSION.PADDR order by
> > V_$SESSION.OSUSER;
> >
> > SYS.V_$PROCESS.SPID is what your want.
> >
> > Aarre
> >
> > On Wed, 09 Feb 2000 17:53:02 GMT, Gonzalo <GSegarra_at_iname.com>
wrote:
> >
> > >Hi,
> > >I want to create a trigger that saves in the table the UNIX user
that
> is
> > >updating or inserting.
> > >The problem is that I don´t know ho to get the UNIX id of the user.
> > >
> >
> I´ve tried this, but in SYS.V_$PROCESS.SPID I get the procees ID,
> not the unix user ID. In the view V$SESSION I get the name of the UNIX
> user (V$SESSION.OSUSER) but not the ID.
>
> Is there any way to set a variable (e.g. with the UNIX ID) when an
user
> begins and oracle session and then get it from any procedure?

>

> Thanks again
>

> session, an
>

> Sent via Deja.com http://www.deja.com/
> Before you buy.

>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Feb 10 2000 - 11:19:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US