-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession.sql
More file actions
33 lines (29 loc) · 839 Bytes
/
session.sql
File metadata and controls
33 lines (29 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
----------------------------------------------------------------------------------------
--
-- File name: session.sql
--
-- Purpose: Displays SID based on SPID
--
-- Author: jpsaraiva
--
-- Version: 2017/05/16
--
-- Example: @session.sql < spid > < instance >
--
-- Notes: Developed and tested on 11.2.0.4.
--
---------------------------------------------------------------------------------------
--
set pagesize 100 lines 120 pages 1000 heading on feed off null '' ver off
undefine spid
undefine instance
column 1 new_value 1 noprint
select '' "1" from dual where rownum = 0;
define spid = &1 null
define instance = &2 null
select s.inst_id INST_ID, s.sid SID, p.spid SPID
from gv$session s, gv$process p
where p.spid = &spid and s.inst_id = &instance
and s.paddr = p.addr and s.inst_id = p.inst_id;
undefine spid
undefine instance