Files
oracle/vg/oradebug_commands.sql
2026-03-12 21:23:47 +01:00

52 lines
1.5 KiB
SQL

CONN sys/password AS SYSDBA; -- User must have SYSDBA.
oradebug SETORAPNAME PR00 -- Debug process by name.
ORADEBUG SETMYPID; -- Debug current session.
ORADEBUG SETOSPID 1234; -- Debug session with the specified OS process.
ORADEBUG SETORAPID 123456; -- Debug session with the specified Oracle process ID.
ORADEBUG TRACEFILE_NAME; -- Display the current trace file.
oradebug UNLIMIT -- Set trace to unlimited size.
-- Start SQL Trace
ORADEBUG EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12;
-- Stop SQL Trace
ORADEBUG EVENT 10046 TRACE NAME CONTEXT OFF;
-- Start Optimizer Trace
ORADEBUG EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12;
exec dbms_monitor.session_trace_enable (session_id=>123,serial_num=>123, waits=> TRUE, binds=> true );
exec dbms_monitor.session_trace_disable (session_id=>123,serial_num=>123);
-- Trace user's own session
exec dbms_monitor.session_trace_enable (NULL,NULL,TRUE,TRUE) ;
exec dbms_monitor.session_trace_disable ;
-- List Online patches
ORADEBUG patch list
--*************************************
-- Dump HangAnalyze on all RAC nodes.
--*************************************
sqlplus "/as sysdba"
oradebug setmypid
oradebug unlimit
oradebug -g all dump hanganalyze 3
oradebug -g all dump systemstate 258
<<wait for 1 mins>>
oradebug -g all dump hanganalyze 3
oradebug -g all dump systemstate 258
oradebug tracefile_name
<<wait for 1 mins>>
oradebug -g all dump hanganalyze 3
oradebug -g all dump systemstate 258
oradebug tracefile_name