Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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

441615Jul 12 2006 — edited Sep 18 2008

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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2008
Added on Jul 12 2006
5 comments
4,452 views