Home » SQL & PL/SQL » SQL & PL/SQL » Retriving OS User Name using Job ID
Retriving OS User Name using Job ID [message #260651] Mon, 20 August 2007 11:01 Go to next message
sanka_yanka
Messages: 184
Registered: October 2005
Location: Kolkata
Senior Member

Is that possible to retrive Os User Name using Job id and using which table/view?

Cheers
Sanka
Re: Retriving OS User Name using Job ID [message #260677 is a reply to message #260651] Mon, 20 August 2007 12:30 Go to previous messageGo to next message
joy_division
Messages: 4641
Registered: February 2005
Location: East Coast USA
Senior Member
You could user USERENV('TERMINAL') and then use this value against TERMINAL in V$SESSION.
Re: Retriving OS User Name using Job ID [message #260684 is a reply to message #260651] Mon, 20 August 2007 12:52 Go to previous messageGo to next message
Michel Cadot
Messages: 64121
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> select sys_context('userenv','os_user') from dual;
SYS_CONTEXT('USERENV','OS_USER')
-----------------------------------------------------------
Michel

1 row selected.

SQL> select osuser from v$session where sid=sys_context('userenv','sid');
OSUSER
------------------------------
Michel

1 row selected.

Regards
Michel
Re: Retriving OS User Name using Job ID [message #260899 is a reply to message #260684] Tue, 21 August 2007 04:14 Go to previous messageGo to next message
sanka_yanka
Messages: 184
Registered: October 2005
Location: Kolkata
Senior Member

I need to show which OS User run the job.
That means I have to mapped the dba_jobs with such a table/view so that I can see the OS User Name for that perticular job_id.

Regards
Sanka
Re: Retriving OS User Name using Job ID [message #260903 is a reply to message #260899] Tue, 21 August 2007 04:21 Go to previous messageGo to next message
Michel Cadot
Messages: 64121
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The OS user that executes a job is the OS user that starts the instance.

Regards
Michel
Re: Retriving OS User Name using Job ID [message #260910 is a reply to message #260903] Tue, 21 August 2007 04:30 Go to previous messageGo to next message
sanka_yanka
Messages: 184
Registered: October 2005
Location: Kolkata
Senior Member

No this user is a client machine user.

Regards
Sanka
Re: Retriving OS User Name using Job ID [message #260912 is a reply to message #260910] Tue, 21 August 2007 04:34 Go to previous messageGo to next message
Michel Cadot
Messages: 64121
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes, the OS user that executes the job in dba_jobs is the OS user that started the instance.
This is not a question, this is an assertion.

Regards
Michel
Re: Retriving OS User Name using Job ID [message #260915 is a reply to message #260912] Tue, 21 August 2007 04:44 Go to previous message
sanka_yanka
Messages: 184
Registered: October 2005
Location: Kolkata
Senior Member

Ok. I've got it.
Thanks Michel.

Cheers
Sanka
Previous Topic: what tools can write select statement better?
Next Topic: create trigger on Sequence
Goto Forum:
  


Current Time: Wed Dec 07 03:11:25 CST 2016

Total time taken to generate the page: 0.22294 seconds