Monday, January 11, 2010

16.3 ORADEBUG utility











 < Day Day Up > 











16.3 ORADEBUG utility



ORADEBUG is a powerful utility and provides a wealth of information. However, this utility has very little documentation available. This utility comes in handy to step deep into the internal structures of Oracle and understand the actual problem. The wonderful benefit of using this utility is that the information gathered using this is useful when calling Oracle Support. The information puts the problem closer to resolution. For example, in Chapter 15 (Performance Tuning: Cluster) there was a discussion about getting details regarding the IPC configuration, and this utility was used.


The ORADEBUG utility is invoked from an SQL*Plus session by simply connecting to it and executing the specific ORADEBUG command. For example to get help on the various commands available through ORADEBUG:




SQL> oradebug help
HELP [command] Describe one or all commands
SETMYPID Debug current process
SETOSPID <ospid> Set OS pid of process to debug
SETORAPID <orapid> Set Oracle pid of process to
[’force’] debug
DUMP <dump_name> <lvl> Invoke named dump
[addr]
DUMPSGA [bytes] Dump fixed SGA
DUMPLIST Print a list of available
dumps
EVENT <text> Set trace event in process
SESSION_EVENT <text> Set trace event in session
DUMPVAR <p|s|uga> Print/dump a fixed PGA/SGA/
<name> [level] UGA variable
SETVAR <p|s|uga> <name> <value> Modify a fixed PGA/SGA/UGA
variable
PEEK <addr> <len> [level] Print/Dump memory
POKE <addr> <len> <value> Modify memory
WAKEUP <orapid> Wake up Oracle process
SUSPEND Suspend execution
RESUME Resume execution
FLUSH Flush pending writes to trace
file
CLOSE_TRACE Close trace file
TRACEFILE_NAME Get name of trace file
LKDEBUG Invoke global enqueue service
debugger
NSDBX Invoke CGS name-service
debugger
-G <Inst-List | def | all> Parallel oradebug command prefix
-R <Inst-List | def | all> Parallel oradebug prefix (return
output
SETINST <instance# .. | all> Set instance list in double quotes
SGATOFILE <SGA dump dir> Dump SGA to file; dirname in
double quotes
DMPCOWSGA <SGA dump dir> Dump & map SGA as COW; dirname in
double quotes
MAPCOWSGA <SGA dump dir> Map SGA as COW; dirname in double
quotes
HANGANALYZE [level] Analyze system hang
FFBEGIN Flash Freeze the Instance
FFDEREGISTER FF deregister instance from
cluster
FFTERMINST Call exit and terminate instance
FFRESUMEINST Resume the flash frozen instance
FFSTATUS Flash freeze status of instance
SKDSTTPCS <ifname> Helps translate PCs to names
<ofname>
WATCH <address> <len> Watch a region of memory
<self|exist|all|
target>
DELETE <local|global|target> Delete a watchpoint
watchpoint <id>
SHOW <local|global|target> Show watchpoints
watchpoints
CORE Dump core without crashing
process
IPC Dump ipc information
UNLIMIT Unlimit the size of the trace file
PROCSTAT Dump process statistics
CALL <func> [arg1] ... Invoke function with arguments
[argn]


A more detailed list of all the debuggable commands is listed in Appendix 1.


In Version 9i, Oracle has introduced a new feature where the database or instance can be placed in a freeze state. This feature is enabled from the ORADEBUG utility and is discussed in the next section.




16.3.1 Flash Freeze


A common dilemma faced by database administrators is whether to identify the cause of a failure or to ensure that normal service is restored as quickly as possible. By invoking Flash Freeze for example, the database administrator can place a freeze on the instance, take a diagnostic snapshot (as illustrated in the output below) of the entire system at the time of failure, quickly restart the database, and then make a diagnostic analysis offline.


The output below enables the flash freeze option using ffbegin,at which point the instance is placed in a freeze state. Once the instance is placed in a freeze state, the ALTER SESSION... command below will generate a dump file in the user dump destination directory. Subsequent to the generation of the dump file the instance is resumed using the ffresumeinst command.


SQL> oradebug ffbegin
Statement processed.
SQL> alter session set events 'immediate trace name
systemstate level 10';

Session altered.
SQL> oradebug ffresumeinst
Statement processed.

All activities performed through the ORADEBUG utility are recorded in the alert log file. In the case of the flash freeze command, the alert log records a considerable amount of activities where the various background and foreground processes are frozen. Subsequently the activation information is also listed when they are activated.


Other flash freeze related commands supported by the ORADEBUG utility are:


FFBEGIN              Flash Freeze the Instance
FFDEREGISTER FF deregister instance from cluster
FFTERMINST Call exit and terminate instance
FFRESUMEINST Resume the flash frozen instance
FFSTATUS Flash freeze status of instance


The output below is an extract from the alert.log file, illustrating the flash freeze activity:


...
Wed Sep 25 01:57:45 2002
Issuing ORADEBUG FFBEGIN to: Unix process pid: 3429,
image: oracle@ora-db1.summerskyus.com (PMON)
Issuing ORADEBUG FFBEGIN to: Unix process pid: 3431,
image: oracle@ora-db1.summerskyus.com (DIAG)
Wed Sep 25 01:57:45 2002
Issuing ORADEBUG FFBEGIN to: Unix process pid: 3433,
image: oracle@ora-db1.summerskyus.com (LMON)
Wed Sep 25 01:57:45 2002
Unix process pid: 3429, image: oracle@ora-db1.
summerskyus.com (PMON) flash frozen
ORADEBUG FFSTATUS: Flash Freeze is in effect
All processes in instance are frozen
Issuing ORADEBUG FFDEREGISTER to: Unix process pid: 3429,
image: oracle@ora-db1.summerskyus.com (PMON)
Issuing ORADEBUG FFDEREGISTER to: Unix process pid: 3431,
image: oracle@ora-db1.summerskyus.com (DIAG)
Wed Sep 25 01:58:06 2002
Unix process pid: 3472, image: oracle@ora-db1.
summerskyus.com (P004) deregistered
Wed Sep 25 01:58:06 2002
Unix process pid: 3470, image: oracle@ora-db1.
summerskyus.com (P003) deregistered
Wed Sep 25 01:58:06 2002
ORADEBUG FFSTATUS: Flash Freeze is in effect
ORADEBUG FFSTATUS: Instance has been deregistered
All processes in instance are frozen
Wed Sep 25 01:58:28 2002
Issuing ORADEBUG FFRESUMEINST to: Unix process pid: 3429,
image: oracle@ora-db1.summerskyus.com (PMON)
Issuing ORADEBUG FFRESUMEINST to: Unix process pid: 3431,
image: oracle@ora-db1.summerskyus.com (DIAG)




















 < Day Day Up > 



No comments: