5 Replies Latest reply: Sep 18, 2008 4:59 PM by 616017 RSS

    SQL Server 2000 to Oracle : Need help in SYSPROCESS Code Migration

    441615
      Hi,

      We are trying to Migrate this T-SQL code snippet :-
          SELECT master.dbo.sysdatabases.name
            FROM master.dbo.sysdatabases
      INNER JOIN master.dbo.sysprocesses
              on master.dbo.sysprocesses.dbid = master.dbo.sysdatabases.dbid
           WHERE master.dbo.sysprocesses.spid = @@SPID
      We have migrated @@SPID in Oracle in this Way :-
          SELECT SYS_CONTEXT ('USERENV' ,'SESSIONID') FROM   DUAL;
      However, we are facing a problem when we try to query the data in V$Session and V$Process Tables. We are nto sure if we need to get the SERVICE_NAME in V$Session based on a comparison with AUDSID or SID.

      We are also not sure about the meaning of SPID in V$Process.

      Can anyone shed some light on this ? We are desperately looking for an equivalent for this code. We are using Oracle 10G:-
      SQL> SELECT * FROM V$VERSION;

      BANNER
      ----------------------------------------------------------------
      Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
      PL/SQL Release 10.2.0.1.0 - Production
      CORE    10.2.0.1.0      Production
      TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
      NLSRTL Version 10.2.0.1.0 - Production
      Thanks,

      Sandeep