Wait Event Names and Parameters (veventn.sql)
Wait Event Names and Parameters
Section titled “Wait Event Names and Parameters”This script provides a comprehensive reference of all Oracle wait events and their parameters, essential for understanding and analyzing database performance issues.
Script: veventn.sql
Section titled “Script: veventn.sql”rem veventn.sqlremttitle 'Event Names'remcol event# format 990 heading 'ID'col name format a35 heading 'NAME'col parameters format a39 heading 'PARAMETERS'remselect event#, name,/* parameter1, parameter2, parameter3,*/ parameter1 || decode( parameter2, null, null, ', ' || parameter2 ) || decode( parameter3, null, null, ', ' || parameter3 ) parameters from v$event_name order by name;
What This Script Does
Section titled “What This Script Does”This script creates a complete reference listing of Oracle wait events including:
- Event Numbers: Unique identifiers for each wait event
- Event Names: Descriptive names of wait events
- Parameters: Up to three parameters that provide context for each event
- Alphabetical Listing: Events sorted by name for easy lookup
-- List all wait events@veventn.sql
-- Find specific event patternsSELECT event#, name, parametersFROM v$event_nameWHERE UPPER(name) LIKE '%LOCK%'ORDER BY name;
Required Privileges
Section titled “Required Privileges”- SELECT privilege on
V$EVENT_NAME
- Typically requires DBA role or SELECT_CATALOG_ROLE
Sample Output
Section titled “Sample Output” Event Names
ID NAME PARAMETERS--- ----------------------------------- ---------------------------------------141 ASM Cached Disk DnL kfdBlockNumber, kfdMsgNumber, flags156 ASM Fixed Package DnL level, kfdMsgNumber, flags 98 CSS group membership wait time 55 Data file init write file#, blocks, requests 78 Disk file operations I/O FileOperation, fileno, filetype 12 SQL*Net break/reset to client 45 SQL*Net message from client 46 SQL*Net message to client bytes157 asynch descriptor resize count, bytes, operation 5 buffer busy waits file#, block#, class# 8 buffer deadlock file#, block#, tries 23 control file parallel write files, block#, requests 24 control file sequential read file#, block#, blocks 25 control file single write file#, block#, blocks 64 db file parallel read files, blocks, requests 65 db file parallel write files, blocks, requests 66 db file scattered read file#, block#, blocks 67 db file sequential read file#, block#, blocks 68 db file single write file#, block#, blocks
Key Output Columns
Section titled “Key Output Columns”Column | Description |
---|---|
ID | Event number - unique identifier for the wait event |
NAME | Descriptive name of the wait event |
PARAMETERS | Up to 3 parameters that provide additional context |
Understanding Wait Event Parameters
Section titled “Understanding Wait Event Parameters”Common Parameter Types
Section titled “Common Parameter Types”File Operations:
file#
- Database file numberblock#
- Block number within fileblocks
- Number of blocks involved
I/O Operations:
requests
- Number of I/O requestsbytes
- Size of I/O operationfiles
- Number of files involved
Locking:
id1
,id2
- Lock identifiersmode
- Lock mode requestedclass#
- Lock class
Network:
bytes
- Data transmittedmessages
- Message count
Common Use Cases
Section titled “Common Use Cases”1. Research Specific Wait Events
Section titled “1. Research Specific Wait Events”-- Find all locking-related eventsSELECT event#, name, parametersFROM v$event_nameWHERE UPPER(name) LIKE '%LOCK%' OR UPPER(name) LIKE '%LATCH%' OR UPPER(name) LIKE '%ENQUEUE%'ORDER BY name;
2. I/O Wait Events Reference
Section titled “2. I/O Wait Events Reference”-- Find all I/O related eventsSELECT event#, name, parametersFROM v$event_nameWHERE UPPER(name) LIKE '%READ%' OR UPPER(name) LIKE '%WRITE%' OR UPPER(name) LIKE '%I/O%'ORDER BY name;
3. Network Wait Events
Section titled “3. Network Wait Events”-- Find network-related eventsSELECT event#, name, parametersFROM v$event_nameWHERE UPPER(name) LIKE '%NET%' OR UPPER(name) LIKE '%CLIENT%' OR UPPER(name) LIKE '%NETWORK%'ORDER BY name;
4. Buffer-Related Events
Section titled “4. Buffer-Related Events”-- Find buffer management eventsSELECT event#, name, parametersFROM v$event_nameWHERE UPPER(name) LIKE '%BUFFER%' OR UPPER(name) LIKE '%CACHE%'ORDER BY name;
5. Create Custom Wait Event Reference
Section titled “5. Create Custom Wait Event Reference”-- Generate formatted wait event documentationSET PAGESIZE 1000SET LINESIZE 100COLUMN event_info FORMAT A80
SELECT event# || ': ' || name || DECODE(parameters, NULL, '', ' (' || parameters || ')') as event_infoFROM v$event_nameORDER BY event#;
Performance Analysis Integration
Section titled “Performance Analysis Integration”Correlate with Active Session History
Section titled “Correlate with Active Session History”-- Find which events are actually occurring in your systemSELECT en.name, en.parameters, COUNT(*) as occurrence_count, ROUND(AVG(ash.time_waited)/1000, 2) as avg_wait_msFROM v$active_session_history ash, v$event_name enWHERE ash.event# = en.event# AND ash.sample_time >= SYSDATE - 1/24 -- Last hourGROUP BY en.name, en.parametersORDER BY occurrence_count DESC;
Top Wait Events by Category
Section titled “Top Wait Events by Category”-- Categorize and count wait events from recent activitySELECT CASE WHEN UPPER(en.name) LIKE '%READ%' OR UPPER(en.name) LIKE '%WRITE%' THEN 'I/O' WHEN UPPER(en.name) LIKE '%LOCK%' OR UPPER(en.name) LIKE '%ENQUEUE%' THEN 'Locking' WHEN UPPER(en.name) LIKE '%NET%' OR UPPER(en.name) LIKE '%CLIENT%' THEN 'Network' WHEN UPPER(en.name) LIKE '%BUFFER%' OR UPPER(en.name) LIKE '%CACHE%' THEN 'Buffer' WHEN UPPER(en.name) LIKE '%CPU%' THEN 'CPU' ELSE 'Other' END as event_category, COUNT(*) as event_countFROM v$session_wait sw, v$event_name enWHERE sw.event# = en.event# AND sw.state = 'WAITING'GROUP BY CASE WHEN UPPER(en.name) LIKE '%READ%' OR UPPER(en.name) LIKE '%WRITE%' THEN 'I/O' WHEN UPPER(en.name) LIKE '%LOCK%' OR UPPER(en.name) LIKE '%ENQUEUE%' THEN 'Locking' WHEN UPPER(en.name) LIKE '%NET%' OR UPPER(en.name) LIKE '%CLIENT%' THEN 'Network' WHEN UPPER(en.name) LIKE '%BUFFER%' OR UPPER(en.name) LIKE '%CACHE%' THEN 'Buffer' WHEN UPPER(en.name) LIKE '%CPU%' THEN 'CPU' ELSE 'Other' ENDORDER BY event_count DESC;
Event Parameter Interpretation
Section titled “Event Parameter Interpretation”File-Based Events
Section titled “File-Based Events”For events with file#, block#, blocks
parameters:
-- Interpret file-based wait events from current sessionsSELECT s.sid, s.username, en.name, df.file_name, sw.p1 as file_number, sw.p2 as block_number, sw.p3 as block_countFROM v$session_wait sw, v$event_name en, v$session s, dba_data_files dfWHERE sw.event# = en.event# AND sw.sid = s.sid AND sw.p1 = df.file_id (+) AND en.parameter1 = 'file#' AND sw.state = 'WAITING';
Lock-Based Events
Section titled “Lock-Based Events”For events with lock identifiers:
-- Interpret lock wait eventsSELECT s.sid, s.username, en.name, sw.p1 as lock_id1, sw.p2 as lock_id2, sw.p3 as lock_mode_or_classFROM v$session_wait sw, v$event_name en, v$session sWHERE sw.event# = en.event# AND sw.sid = s.sid AND (UPPER(en.name) LIKE '%LOCK%' OR UPPER(en.name) LIKE '%ENQUEUE%') AND sw.state = 'WAITING';
Oracle Version Considerations
Section titled “Oracle Version Considerations”New Events by Version
Section titled “New Events by Version”Different Oracle versions introduce new wait events:
Oracle 12c+:
- PDB-related wait events
- In-Memory column store events
- Enhanced backup/recovery events
Oracle 19c+:
- Autonomous database events
- Machine learning wait events
- Enhanced parallel execution events
Oracle 21c+:
- Blockchain table events
- JSON processing events
- Graph database events
Integration with Other Scripts
Section titled “Integration with Other Scripts”This script works well with:
- Active Session History (gvsessactive.sql) - For current wait analysis
- Session Wait Analysis (gvsessw.sql) - For session wait patterns
- Wait Statistics (vwait.sql) - For system-wide wait analysis
- Latch Analysis (vlatch.sql) - For latch-specific waits
Create Reference Documentation
Section titled “Create Reference Documentation”Generate Wait Event Handbook
Section titled “Generate Wait Event Handbook”-- Create comprehensive wait event referenceSET PAGESIZE 0SET LINESIZE 200SPOOL wait_events_reference.txt
SELECT 'Event #' || event# || ': ' || name || chr(10) || 'Parameters: ' || NVL(parameters, 'None') || chr(10) || '----------------------------------------' || chr(10)FROM v$event_nameORDER BY event#;
SPOOL OFF
Create Category-Based Reference
Section titled “Create Category-Based Reference”-- Organize events by categorySELECT CASE WHEN UPPER(name) LIKE '%READ%' OR UPPER(name) LIKE '%WRITE%' THEN 'I/O EVENTS' WHEN UPPER(name) LIKE '%LOCK%' OR UPPER(name) LIKE '%ENQUEUE%' THEN 'LOCKING EVENTS' WHEN UPPER(name) LIKE '%NET%' OR UPPER(name) LIKE '%CLIENT%' THEN 'NETWORK EVENTS' WHEN UPPER(name) LIKE '%BUFFER%' OR UPPER(name) LIKE '%CACHE%' THEN 'BUFFER EVENTS' ELSE 'OTHER EVENTS' END as category, event#, name, parametersFROM v$event_nameORDER BY 1, 2;
Best Practices
Section titled “Best Practices”- Reference Tool: Use this as a quick reference when analyzing wait events
- Combine with Monitoring: Use alongside active wait monitoring scripts
- Parameter Understanding: Learn common parameter patterns for faster diagnosis
- Version Awareness: Note that event lists vary by Oracle version
- Documentation: Keep customized wait event references for your environment
This script serves as an essential reference tool for Oracle performance tuning and wait event analysis, providing the foundation for understanding what Oracle is waiting for during database operations.