Data Dictionary   «Prev  Next»
Lesson 2The Oracle performance views
ObjectiveList the critical V$ views

Oracle Performance Views (V$ and GV$): A Practical Guide for 23c

The dynamic performance views (V$ and cluster-wide GV$) expose what the Oracle instance is doing right now. They are not tables on disk; they surface in-memory state maintained by the kernel. Use them to observe wait events, SQL execution, memory, I/O, and session activity—and to validate changes with real data.

How to approach tuning (modern method)

  1. Start with waits: Identify top wait classes/events before tweaking memory or parameters.
  2. Find the workload: Which SQL, sessions, or files drive those waits?
  3. Change and measure: Apply a fix; then verify with the same views/metrics.

Legacy note: Avoid relying on buffer cache hit ratio or SORT_AREA_SIZE. For sorts and joins, use workarea_size_policy = AUTO with PGA_AGGREGATE_TARGET and an appropriate PGA_AGGREGATE_LIMIT. For multi-instance (RAC), use GV$ views to see all instances.

Core views by task

Quick-start queries (drop-in)

Top wait events since instance start

SELECT event,
       total_waits,
       time_waited/100 AS seconds_waited
FROM   v$system_event
WHERE  wait_class <> 'Idle'
ORDER  BY time_waited DESC
FETCH FIRST 10 ROWS ONLY;

Active sessions right now (what they wait on)

SELECT s.sid, s.serial#, s.username, s.module,
       s.state, s.wait_class, s.event, s.seconds_in_wait
FROM   v$session s
WHERE  s.type = 'USER'
ORDER  BY s.state DESC, s.seconds_in_wait DESC;

Top SQL by elapsed time

SELECT sql_id, plan_hash_value, executions,
       elapsed_time/1e6 AS seconds, rows_processed
FROM   v$sql
WHERE  executions > 0
ORDER  BY elapsed_time DESC
FETCH FIRST 10 ROWS ONLY;

Library cache health (hard parse pressure)

SELECT namespace,
       pins, pinhits, (pinhits/pins) AS pin_hit_ratio,
       reloads, invalidations
FROM   v$librarycache
ORDER  BY (reloads + invalidations) DESC;

SGA breakdown & free memory

SELECT pool, name, bytes
FROM   v$sgastat
ORDER  BY pool NULLS LAST, bytes DESC;

PGA efficiency (work areas)

SELECT name, value
FROM   v$pgastat
WHERE  name IN ('total PGA inuse', 'total PGA allocated',
                'bytes processed', 'extra bytes read/written');

Which files are hottest?

SELECT filetype_name,
       small_read_megabytes + large_read_megabytes AS read_mb,
       small_write_megabytes + large_write_megabytes AS write_mb,
       small_read_reqs + large_read_reqs AS read_reqs,
       small_write_reqs + large_write_reqs AS write_reqs
FROM   v$iostat_file
ORDER  BY (read_mb + write_mb) DESC;

Temp usage by session

SELECT s.sid, s.serial#, u.tablespace, u.blocks, u.segtype
FROM   v$session s
JOIN   v$tempseg_usage u ON s.saddr = u.session_addr
ORDER  BY u.blocks DESC;

Dealing with legacy guidance in this lesson

Workflow: investigate, fix, verify

  1. Identify dominant waits (system/session).
  2. Map to specific SQL, objects, or files.
  3. Apply focused changes (e.g., indexes, SQL rewrites, memory/parallelism, I/O layout).
  4. Re-measure using the same queries; capture before/after evidence.

Licensing tip: ASH and AWR views require the Diagnostics Pack. If not licensed, stick to V$ views and Statspack.

ASH (Active Session History) and AWR (Automatic Workload Repository)

Both ASH (Active Session History) and AWR (Automatic Workload Repository) are still actively used in Oracle 23c as core components of its performance monitoring and tuning architecture. However, the licensing requirement remains firmly in place: you must have a license for the Oracle Diagnostics Pack to use these features. This applies to all methods of accessing ASH and AWR data, including through Oracle Enterprise Manager, command-line scripts (`ashrpt.sql`, `awrrpt.sql`), or direct queries against the underlying `V$` and `DBA_HIST_` views.

Unlicensed Alternatives

If you are not licensed for the Diagnostics Pack, the long-standing recommendation to use V$ views and Statspack continues to be the correct and compliant approach in Oracle 23c.

  • V$ Views: These dynamic performance views provide real-time information about the database's current state. They are invaluable for immediate, on-the-spot investigations but do not store historical data for trend analysis.
  • Statspack: This is a free performance monitoring tool provided by Oracle that collects performance data over time, similar to AWR but with less detail. It remains a powerful utility for performance diagnosis and trend analysis when AWR is not an option.

Key Differences: AWR vs. Statspack

It is important to understand the distinctions between the licensed AWR and the free Statspack:

Feature Automatic Workload Repository (AWR) Statspack
Licensing Requires Oracle Diagnostics Pack Free with all editions
Data Collection Automatic and more comprehensive Manual setup and less detailed
Overhead Lower, integrated into the database kernel Can be more resource-intensive
Analysis Tools Integrated with ADDM, ASH, and other advisors Requires manual analysis of reports
Storage Stored in the SYSAUX tablespace Stored in a user-defined tablespace
Historical Data Retains a configurable history of performance data Manual purging of data is typically required

In summary, while ASH and AWR are fully present and functional in Oracle 23c, their use is strictly tied to the Diagnostics Pack license. For environments without this license, Statspack and direct queries on V$ views are the appropriate and supported tools for performance tuning.


SEMrush Software 2 SEMrush Banner 2