?
Solved

Session ID

Posted on 2005-03-14
5
Medium Priority
?
575 Views
Last Modified: 2008-01-09
Hi all,

Thanks for your continued support.

When a user logs in through the application i need to get his session id (which should be unique) and whenever he makes a change to the data i should be able to identify him through this session id . how do i do it , how can identify the session id and use it later on when that user makes some changes.

Please let me know if i am not clear enough.

many thanks.
0
Comment
Question by:crishna1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:jonva13
ID: 13540099
If you have access to it, all of this information is on the v$session view.  
(DESC v$session)
0
 
LVL 1

Accepted Solution

by:
jonva13 earned 2000 total points
ID: 13540136
0
 

Author Comment

by:crishna1
ID: 13540357
That was helpful, but the USERS who login through the application does not have DBA privilage.

How to hadle it when the user does not have access to the v$ tables ? How to get information like OS_USER, USER_ENV, SESSION ID etc.

many thanks.
0
 

Author Comment

by:crishna1
ID: 13540442
never mind "SELECT SYS_CONTEXT('USERENV','OS_USER') UserId FROM Dual" answers all my questions.
0
 
LVL 25

Expert Comment

by:jrb1
ID: 13540498
Some info from v$session is availble through functions:

USERNAME - function USER : select USER from dual;
AUDSID - function USERENV: select USERENV('SESSIONID') from dual;
TERMINAL - function USERENV: select userenv('TERMINAL') from dual;

Also, there is a UID function which gives you the number that matches a user on DBA_USERS:

select UID from dual;

Another way would be to create a function that returns the information you desire.  For session ID,

create or replace function GetSID return number is
   sessn number;
begin
  select sid
  into sessn
  from v$session;
  return sessn;
end;
/

You could create a whole package of these types of functions.  You have to have direct access to v$session to create the function (not through a role).  Then if you grant access to the functions to the users (or PUBLIC) they will be able to retrieve these results.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

777 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