2026-03-12 20:23:15

This commit is contained in:
root
2026-03-12 21:23:47 +01:00
parent eab4b36eca
commit 93039b8489
3332 changed files with 699614 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/monitoring/locked_objects.sql
-- Author : Tim Hall
-- Description : Lists all locked objects for whole RAC.
-- Requirements : Access to the V$ views.
-- Call Syntax : @locked_objects
-- Last Modified: 15/07/2000
-- -----------------------------------------------------------------------------------
SET LINESIZE 500
SET PAGESIZE 1000
SET VERIFY OFF
COLUMN owner FORMAT A20
COLUMN username FORMAT A20
COLUMN object_owner FORMAT A20
COLUMN object_name FORMAT A30
COLUMN locked_mode FORMAT A15
SELECT b.inst_id,
b.session_id AS sid,
NVL(b.oracle_username, '(oracle)') AS username,
a.owner AS object_owner,
a.object_name,
Decode(b.locked_mode, 0, 'None',
1, 'Null (NULL)',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share (S)',
5, 'S/Row-X (SSX)',
6, 'Exclusive (X)',
b.locked_mode) locked_mode,
b.os_user_name
FROM dba_objects a,
gv$locked_object b
WHERE a.object_id = b.object_id
ORDER BY 1, 2, 3, 4;
SET PAGESIZE 14
SET VERIFY ON

View File

@@ -0,0 +1,30 @@
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/monitoring/longops_rac.sql
-- Author : Tim Hall
-- Description : Displays information on all long operations for whole RAC.
-- Requirements : Access to the V$ views.
-- Call Syntax : @longops_rac
-- Last Modified: 03/07/2003
-- -----------------------------------------------------------------------------------
SET LINESIZE 200
COLUMN sid FORMAT 9999
COLUMN serial# FORMAT 9999999
COLUMN machine FORMAT A30
COLUMN progress_pct FORMAT 99999999.00
COLUMN elapsed FORMAT A10
COLUMN remaining FORMAT A10
SELECT s.inst_id,
s.sid,
s.serial#,
s.username,
s.module,
ROUND(sl.elapsed_seconds/60) || ':' || MOD(sl.elapsed_seconds,60) elapsed,
ROUND(sl.time_remaining/60) || ':' || MOD(sl.time_remaining,60) remaining,
ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
FROM gv$session s,
gv$session_longops sl
WHERE s.sid = sl.sid
AND s.inst_id = sl.inst_id
AND s.serial# = sl.serial#;

View File

@@ -0,0 +1,28 @@
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/monitoring/monitor_memory_rac.sql
-- Author : Tim Hall
-- Description : Displays memory allocations for the current database sessions for the whole RAC.
-- Requirements : Access to the V$ views.
-- Call Syntax : @monitor_memory_rac
-- Last Modified: 15-JUL-2000
-- -----------------------------------------------------------------------------------
SET LINESIZE 200
COLUMN username FORMAT A20
COLUMN module FORMAT A20
SELECT a.inst_id,
NVL(a.username,'(oracle)') AS username,
a.module,
a.program,
Trunc(b.value/1024) AS memory_kb
FROM gv$session a,
gv$sesstat b,
gv$statname c
WHERE a.sid = b.sid
AND a.inst_id = b.inst_id
AND b.statistic# = c.statistic#
AND b.inst_id = c.inst_id
AND c.name = 'session pga memory'
AND a.program IS NOT NULL
ORDER BY b.value DESC;

View File

@@ -0,0 +1,31 @@
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/monitoring/session_undo_rac.sql
-- Author : Tim Hall
-- Description : Displays undo information on relevant database sessions.
-- Requirements : Access to the V$ views.
-- Call Syntax : @session_undo_rac
-- Last Modified: 20/12/2005
-- -----------------------------------------------------------------------------------
SET LINESIZE 200
COLUMN username FORMAT A15
SELECT s.inst_id,
s.username,
s.sid,
s.serial#,
t.used_ublk,
t.used_urec,
rs.segment_name,
r.rssize,
r.status
FROM gv$transaction t,
gv$session s,
gv$rollstat r,
dba_rollback_segs rs
WHERE s.saddr = t.ses_addr
AND s.inst_id = t.inst_id
AND t.xidusn = r.usn
AND t.inst_id = r.inst_id
AND rs.segment_id = t.xidusn
ORDER BY t.used_ublk DESC;

View File

@@ -0,0 +1,29 @@
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/10g/session_waits_rac.sql
-- Author : Tim Hall
-- Description : Displays information on all database session waits for the whole RAC.
-- Requirements : Access to the V$ views.
-- Call Syntax : @session_waits_rac
-- Last Modified: 02/07/2005
-- -----------------------------------------------------------------------------------
SET LINESIZE 200
SET PAGESIZE 1000
COLUMN username FORMAT A20
COLUMN event FORMAT A30
COLUMN wait_class FORMAT A15
SELECT s.inst_id,
NVL(s.username, '(oracle)') AS username,
s.sid,
s.serial#,
sw.event,
sw.wait_class,
sw.wait_time,
sw.seconds_in_wait,
sw.state
FROM gv$session_wait sw,
gv$session s
WHERE s.sid = sw.sid
AND s.inst_id = sw.inst_id
ORDER BY sw.seconds_in_wait DESC;

View File

@@ -0,0 +1,34 @@
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/monitoring/sessions_rac.sql
-- Author : Tim Hall
-- Description : Displays information on all database sessions for whole RAC.
-- Requirements : Access to the V$ views.
-- Call Syntax : @sessions_rac
-- Last Modified: 21/02/2005
-- -----------------------------------------------------------------------------------
SET LINESIZE 500
SET PAGESIZE 1000
COLUMN username FORMAT A15
COLUMN machine FORMAT A25
COLUMN logon_time FORMAT A20
SELECT NVL(s.username, '(oracle)') AS username,
s.inst_id,
s.osuser,
s.sid,
s.serial#,
p.spid,
s.lockwait,
s.status,
s.module,
s.machine,
s.program,
TO_CHAR(s.logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time
FROM gv$session s,
gv$process p
WHERE s.paddr = p.addr
AND s.inst_id = p.inst_id
ORDER BY s.username, s.osuser;
SET PAGESIZE 14