sql statement to query the Oracle user executing and implementing the statement

Oracle sql statement to query being executed and execute the statement users
the SELECT B.SID ORACLEID,
B.USERNAME ORACLE user login name,
B.SERIAL #,
SPID operating system ID,
PADDR,
SQL SQL_TEXT being executed,
B.MACHINE computer name
the PROCESS A V $ the FROM, the SESSION $ V B, V C $ SQLAREA
the WHERE A.ADDR = B.PADDR
the AND B.SQL_HASH_VALUE = C.HASH_VALUE;

- View executing sql originator of the procedure for issuing
SELECT OSUSER computer login credentials,
the PROGRAM program initiated the request,
the username USERNAME sign-on system,
SCHEMANAME,
B.CPU_TIME spend CPU time,
the STATUS,
B.SQL_TEXT execution of SQL
the FROM the SESSION A $ V
the LEFT the SQL the JOIN V $ B
the ON A.SQL_ADDRESS = B.ADDRESS
the AND A.SQL_HASH_VALUE = B.HASH_VALUE
the ORDER BY B.CPU_TIME DESC;

--锁表查询SQL
SELECT OBJECT_NAME, MACHINE, S.SID, S.SERIAL#
FROM GV$LOCKED_OBJECT L, DBA_OBJECTS O, GV$SESSION S
WHERE L.OBJECT_ID  = O.OBJECT_ID
AND L.SESSION_ID = S.SID;

--释放SESSION SQL:
--alter system kill session 'sid, serial#';
ALTER SYSTEM KILL SESSION '23, 1647';

- table size check a user under
the SELECT SEGMENT_NAME, TABLESPACE_NAME, the SUM (BYTES / 1024/1024) || 'M'
the FROM USER_EXTENTS
the WHERE segment_type = 'TABLE'
the GROUP BY SEGMENT_NAME, TABLESPACE_NAME
the ORDER BY DESC. 3;

--查所有的表大小
SELECT SEGMENT_NAME, TABLESPACE_NAME, SUM(BYTES / 1024 / 1024) || 'M'
FROM DBA_EXTENTS
WHERE SEGMENT_TYPE = 'TABLE'
GROUP BY SEGMENT_NAME, TABLESPACE_NAME
ORDER BY 3 DESC;

--oracle query history to execute a statement
the SELECT *
the FROM V $ SQLAREA
the WHERE / * PARSING_SCHEMA_NAME = 'the ORDERS'
the AND * / SQL_TEXT the LIKE '%% the Delete'
the ORDER BY LAST_ACTIVE_TIME

Guess you like

Origin www.cnblogs.com/ritchy/p/12094441.html