?
Solved

In Oracle sql how can write a query to show my current session details

Posted on 2007-10-08
4
Medium Priority
?
2,329 Views
Last Modified: 2013-12-07
Hi All,
In Oracle sql how can write a query to show the current session details, i.e. there are many people logged into the database but i want the pl/sql routine to just pickup the session details of the user currently executing the plsql;

please help

thanks
H
0
Comment
Question by:hraja77
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20036367
to find the session id:

declare
v_par1 NUMBER;
BEGIN
v_par1 :=SYS_CONTEXT('USERENV','SESSIONID');
dbms_output.put_line ('Session ID = '|| v_par1);
end;
/
0
 
LVL 1

Author Comment

by:hraja77
ID: 20036386
thanks for the quick response angel;

i just need to know how do i get the machine info that the user is comming from ?
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20036405
with the information you got in the above step, query the v$session table, and retrieve the TERMINAL column.
that's the field you are looking for
0
 
LVL 35

Expert Comment

by:johnsone
ID: 20036437
You can also use:

sys_context('USERENV', 'HOST')

to get the value of V$SESSION.MACHINE.

Due to security audit reasons, some places may not allow access to the V$SESSION view.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question