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

Posted on 2007-10-08
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

Question by:hraja77
    LVL 142

    Expert Comment

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

    v_par1 NUMBER;
    dbms_output.put_line ('Session ID = '|| v_par1);
    LVL 1

    Author Comment

    thanks for the quick response angel;

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

    Accepted Solution

    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
    LVL 34

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
    This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now