How to identify current session id (SID)?

How can a user identify their current session id if auditing is not enabled and account has connect role only? select * from v$mystat where rownum = 1; Fails (ora-942).

I think this is going to be difficult. I've included a completely convoluted idea I thought of using just CONNECT accessible objects (looking on a 9.2 database). You can't make this a stored procedure though (no direct privileges). I'll be interested to see if someone can come up with something easier.
declare
  rindex binary_integer := dbms_application_info.set_session_longops_nohint;
  slno binary_integer;
  usid varchar2(24) := dbms_session.unique_session_id;
  mysid number;
begin
  dbms_application_info.set_session_longops(rindex, slno, 'get_sid:' || usid);
  select sid
  into mysid
  from v$session_longops
  where opname = 'get_sid:' || usid
    and rownum = 1;
  dbms_output.put_line(mysid);
end;Richard

Similar Messages

  • How to get current session language ?

    Hi,
    I want to get the current session's language.
    I'm using pageContext.getOANLSServices().toString() but its output is oracle.apps.fnd.framework.OANLSServices@f55137
    Any ideas ?
    Thanks

    Hi,
    Use the below code in CO for getting the Language.
    pageContext.getCurrentLanguage();Regards,
    Gyan

  • How to identify current row in table from selectOneChoice compact mode

    Hi,
    I have an af:table in which one of the columns is selectOneChoice in compact mode.  Upon selecting item in this selectOneChoice, valueChangeListener is triggered and do some work based on that row.  However, my issue is that it's hard to identify the current row since the selectOneChoice is in compact mode.  If the selectOneChoice is not in compact mode, when user selects item in selectOnechoice, selectionListener of af:table is triggered to identify the current row.  But if selectOneChoice is in compact mode, user is able to select from selectOneChoice and valueChangeListener is triggered before selectionListener of af:table is triggered.  Hence, not able to identify current row. 
    As a not so ideal workaround, I tried to put the row identifier (in my case, it's DetailSeq) in shortDesc, and get it from there.  But users is complaining seeing this not user friendly in shortDesc/hintText.  I tried to put DetailSeq as the id of the selectOneChoice, but it didn't work (Cannot get Id of selectOneChoice in table)
    <af:table>
      <af:column headerText="Action" id="c5" width="30">
            <af:selectOneChoice id="a${row.DetailSeq}" autoSubmit="true" valueChangeListener="#{viewScope.backing_requestOverview.onSelectAction}" label="Action" mode="compact" shortDesc="#{row.DetailSeq}">
                <f:selectItems value="#{backing_requestOverview.requestActionsMap[row.StatusUid]}" id="si333"/>
                </af:selectOneChoice>
        </af:column>
    </af:table>
    In the valueChangeListener:
      public void onSelectAction(ValueChangeEvent valueChangeEvent) {
    RichSelectOneChoice actionChoice = (RichSelectOneChoice)valueChangeEvent.getComponent();
    LOGGER.info("Short Desc: " + actionChoice.getShortDesc());
            LOGGER.info("Component Id: " + actionChoice.getId());
    Any advice?
    Thanks
    -Mina

    Hi,
    what about using an f:attribute tag to add the "DetailSeq" to the component. Should work similar to the shortDesc but is invisible. You can then get this attribute value by its name among the component attributes
    Frank

  • How to display current session parameter value

    Hi,
    How can a db user know value of a session parameter, if he doen't have privilege to access v$parameter?
    SQL> conn hr/hr
    Connected.
    SQL> show parameter QUERY_REWRITE_ENABLED
    ORA-00942: table or view does not exist
    SQL> alter session set QUERY_REWRITE_ENABLED=true ;
    Session altered.
    -- how can the user HR know the value of QUERY_REWRITE_ENABLED

    You can code a PL/SQL function and grant only execute privilege to the user:
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    SQL> drop user admin cascade;
    User dropped.
    SQL> create user admin identified by admin;
    User created.
    SQL> grant create session, create procedure to admin;
    Grant succeeded.
    SQL> grant select on sys.v_$parameter to admin;
    Grant succeeded.
    SQL> connect admin/admin
    Connected.
    SQL> show user;
    USER is "ADMIN"
    SQL> create or replace function get_parm (p_pn in varchar2) return varchar2
      2  as
      3  l_val v$parameter.value%type;
      4  begin
      5   if ( UPPER(p_pn) = 'QUERY_REWRITE_ENABLED' )
      6   then
      7        execute immediate 'select value from v$parameter where name = :1 '
      8        into l_val using p_pn;
      9        return l_val;
    10   else
    11      raise_application_error(-20000,'Invalid parameter');
    12      return null;
    13   end if;
    14  end;
    15  /
    Function created.
    SQL> grant execute on get_parm to test;
    Grant succeeded.
    SQL> connect test/test
    Connected.
    SQL> show parameter query
    ORA-00942: table or view does not exist
    SQL> select admin.get_parm('query_rewrite_enabled') from dual;
    ADMIN.GET_PARM('QUERY_REWRITE_ENABLED')
    TRUE
    SQL> select admin.get_parm('compatible') from dual;
    select admin.get_parm('compatible') from dual
    ERROR at line 1:
    ORA-20000: Invalid parameter
    ORA-06512: at "ADMIN.GET_PARM", line 11

  • How to Identify database sessions used by forms sso user sessions?

    Hi:
    When using forms with SSO, all database sessions are opened by the same OSUSER (usually oracle), from the same machine (usually the forms server) and by the same program (usually [email protected] [TNS V1-V3]).
    I need a way to identify the database session (v$session) that is beeing used by a specific SSO user. By using SSO, we say implicitly that all users using that SSO resource will be connect to the database by a specific database user.
    So, what can I do to identify the database session that a specific forms user is using ?
    Thanks
    Joao Oliveira

    You could try something like the following in a when new form instance trigger:
    declare
    authenticated_username varchar2(30);
    begin
    authenticated_username := get_application_property(`sso_userid');
    DBMS_APPLICATION_INFO.SET_CLIENT_INFO (
    client_info IN VARCHAR2);
    end;
    This will store the sso userid in the client_info field of v$session.
    I hope this works for you.
    Randy McGregor

  • How to identify current webapp

    On a current JSP page how can you extract the WebAPP name?

    Hi,
    what about using an f:attribute tag to add the "DetailSeq" to the component. Should work similar to the shortDesc but is invisible. You can then get this attribute value by its name among the component attributes
    Frank

  • How to terminate current session before ITS_BROWSER_REDIRECT

    hi buddies,
    i'm curious, when i redirected to new url and created a sesiion, the last url's session did not be terminated.
    step 1 -  i open an ITS url which TCODE is ZTESTPLF the last entry in SM04,
    step 2 -  i clicked a button redirect to another url which TCODE is ZBR16,
    step 3 -  i want to return to ZTESTPLF so i redirect to the first url
    step 4 -  redirect to ZBR16
    step 5 -  redirect to ZTESTPLF
    step 6 -  redirect to ZBR16
    step 7 -  redirect to ZTESTPLF
    step ......
    Does any body know how to do this?

    Hello,
    May check note 959417 and note 2025109 for hints.
    Best regards,
    Yuki
    Message was edited by: Oisin ONidh
    Add note links

  • How to Identify ODBC sessions

    This is on 10g. I need to derive session information for all uses who are connected to Oracle using ODBC connections. How can I achieve this? Thanks, R

    NKU wrote:
    Select username,status,program from v$session;Program will let you know the type through which connection is made.
    RegardsWouldn't this be a bit indirect and depend on one's knowledge of the connecting program's methods?
    SQL> col username for a20
      1  Select username,
      2    status,
      3    program
      4  from v$session
      5* order by 1
    SQL> /
    USERNAME     STATUS   PROGRAM
    SCOTT     INACTIVE MSACCESS.EXENow, nothing in the above really says I have an odbc connection. But I happen to know that that is probably the only way MSACCESS.EXE is going to get there. But what about less well-known programs?

  • How to identify current Liveview firmware version?

    Got one of these recently and started out fine but as I pile more plugins on, both phone and liveview are starting to struggle. Was wondering if the update would improve things, but obviously no point applying if I already have it. So how do I know what version my firmware is at?
    Ta in advance!

    Anything substainial you'd hear about at: http://blogs.sonyericsson.com/products otherwise, you might here about little updates/change here.
    As for announcements about future updates, we don't typically announce these things, but again, you'd hear it online first.

  • Trying to convert pdf to word. A msg box is open on the right side of the screen that says, "retrieving current session status..." It's frozen. What can I do? Thanks.

    Trying to convert pdf to word. A msg box is open on the right side of the screen that says, "retrieving current session status..." It's frozen. What can I do? Thanks.

    Hi Dewey,
    Are you trying to convert via Adobe Reader? If so, are you able to close and restart Reader (you may need to force quit, or use Task Manager to quit Reader if it's truly frozen)? After restarting, choose Help > Check for Updates to make sure that you have the most current version.
    And, if updating Reader doesn't help (or you already have the most current version), please try converting that same file using the ExportPDF web interface at https://cloud.acrobat.com.
    Please let us know how it goes.
    Thanks!
    Sara

  • Possible to get SID of current session when not logged on as SYS

    I would like to get teh SID of my current session, but access to V$MYSTAT is restricted:
    conn user/******@DB
    SQL> desc v$mystat
    ERROR:
    ORA-04043: object "SYS"."V_$MYSTAT" does not exist
    SQL> conn sys/******@DB  as sysdba
    Connected.
    SQL> desc v$mystat
    Name                                      Null?    Type
    SID                                                NUMBER
    STATISTIC#                                         NUMBER
    VALUE                                              NUMBERThanks

    Can you use [url http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/functions165.htm#i1038176]SYS_CONTEXT for getting DB_NAME, INSTANCE_NAME, SID etc?

  • How to get the user of current session in EBS

    Hi everyone,
    I create a new form in EBS 11. I want to get user ID (or userName) of user who log in the current session of application for inserting into CREATE_BY field of table in database.
    How have i to get it
    thanks you and best regards

    Hi,
    It seems like your application variables have not been initialized. Has your form been registered in a menu under a valid responsibility? Give us more details of the form and where it is has been registered.
    Make sure you look at P29-3 of the Application Developer's Guide for WHO column maitenance as you should be populating other columns besides the USER_ID. (http://download.oracle.com/docs/cd/B40089_10/current/acrobat/120devg.pdf)
    Cheers
    Dale

  • How can I get a list of active savepoints for the current session?

    Hi,
    In Oracle Applications, we are getting the following error while performing ROLLBACK to a Savepoint.
    "Unexpected Error: ORA-01086: savepoint 'PTNR_BULK_CALC_TAX_PVT' never establishe d ORA-06510: PL/SQL: unhandled user-defined exception"
    So how can I get a list of active savepoints for the current session?
    Could you please also let me know if there is any better way to debug this issue.
    Appreciate any quick response as the issue is very critical.
    Thanks,
    Soma

    user776523 wrote:
    Hi,
    In Oracle Applications, we are getting the following error while performing ROLLBACK to a Savepoint.
    "Unexpected Error: ORA-01086: savepoint 'PTNR_BULK_CALC_TAX_PVT' never establishe d ORA-06510: PL/SQL: unhandled user-defined exception"It sounds like there's an execution path in the code where the SAVEPOINT is never issued.
    There is no way to get a list of active savepoints. Is this your code or a "canned" procedure? If it is your code you can go through the code looking for answers, possibly tracing execution using DBMS_OUTPUT.PUT_LINE or writing messages to a log table. If its a "canned" procedure you may need to open an SR with Oracle

  • My software is STUCK on "Retrieving current session status" What is this and how do I fix it? i am not able to convert any files at all!! Please help!

    My software is STUCK on "Retrieving current session status" What is this and how do I fix it? i am not able to convert any files at all!! Please help!

    Hi JulietaQ,
    In order to help you better.
    Please let me know which application or Service of Adobe you are using. If this is subscription i would request you to log-out and log-in back and let me know if that helps.
    ~Ajlan Huda

  • How to exit the session at the end of the current page

    hi gurus,
    i want to exit the session at the end of the current page, so that when i am trying to open some other  page in the same browser it should ask for login id & pwd and should not pick the previous session-id.
    Regards,
    srikar

    Look at the below links, it might help you..
    [Link1|Re: Navigation with a new session]
    [Link2|how to end a session in bsp ?]
    Raja

Maybe you are looking for