0% found this document useful (0 votes)
15 views2 pages

Consult As

This document contains SQL queries that retrieve information from Oracle database views like V$SESSION, V$PROCESS, V$SQL, V$LOCKED_OBJECT, and V$SQLAREA. The queries return data on active sessions, SQL statements currently in memory, objects currently being locked, and historical statistics on SQL statements executed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Consult As

This document contains SQL queries that retrieve information from Oracle database views like V$SESSION, V$PROCESS, V$SQL, V$LOCKED_OBJECT, and V$SQLAREA. The queries return data on active sessions, SQL statements currently in memory, objects currently being locked, and historical statistics on SQL statements executed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

SELECT

*
FROM
tc_uld_vuel;
***************************************************************************
SELECT
to_char(s.logon_time, 'dd-mon-rrrr hh24:mi:ss') ini_sess,
s.username,
s.osuser,
p.spid,
s.machine,
s.process,
s.sid,
s.serial#,
s.terminal,
s.status,
( s.last_call_et / 60 ) mins,
s.sql_hash_value,
-- s.sql_id,
s.module,
s.action,
s.program
-- s.client_info
FROM
v$session s,
v$process p
WHERE
s.status = 'ACTIVE'
AND s.type = 'USER'
AND s.paddr = p.addr
ORDER BY
s.status,
mins DESC,
username;
***************************************************************************
SELECT
*
FROM
v$sql
WHERE
hash_value IN (
SELECT
sql_hash_value
FROM
v$session
WHERE
sid IN (
SELECT
session_id
FROM
v$locked_object
)
);
***************************************************************************
SELECT
session_id "SID",
serial# "Serial",
substr(object_name, 1, 25) "Object",
substr(os_user_name, 1, 10) "Terminal",
substr(oracle_username, 1, 10) "Locker",
nvl(lockwait, 'ACTIVE') "Wait",
decode(locked_mode, 2, 'Row Share', 3, 'ROW EXCLUSIVE',
4, 'SHARE', 5, 'SHARE ROW EXCLUSIVE', 6,
'EXCLUSIVE',
'UNKNOWN') "LockMode",
object_type "Type"
FROM
gv$locked_object a,
sys.all_objects b,
gv$session c
WHERE
a.object_id = b.object_id
AND c.sid = a.session_id
ORDER BY
3;
***************************************************************************
SELECT DISTINCT
vs.sql_text,
vs.sharable_mem,
vs.persistent_mem,
vs.runtime_mem,
vs.sorts,
vs.executions,
vs.parse_calls,
vs.module,
vs.buffer_gets,
vs.disk_reads,
vs.version_count,
vs.users_opening,
vs.loads,
to_char(to_date(vs.first_load_time, 'YYYY-MM-DD/HH24:MI:SS'), 'MM/DD
HH24:MI:SS') first_load_time,
rawtohex(vs.address)
address,
vs.hash_value
hash_value,
rows_processed,
vs.command_type,
vs.parsing_user_id,
optimizer_mode,
au.username
parseuser
FROM
v$sqlarea vs,
all_users au
WHERE
( parsing_user_id != 0 )
AND ( au.user_id (+) = vs.parsing_user_id )
AND ( executions >= 1 )
ORDER BY
buffer_gets / executions DESC;

You might also like