Latest Updates

Post Top Ad

03 January, 2013

ORADEBUG – Oracle Utility

Oradebug Utility s especially useful when  things go very bad for example Database hangs,Due to ORA-00600 error your database is crashing frequently, Database just not responding (stop). With oradebug you can see very close view database engine. Oracle Customer support use the utility mainly to debug these issues. You should have sysdba privilege to run this utility.
 Main usage of this utility’s are :


- Suspension of intensive processes
- To find out information of shared memory and semaphores
- Wake up processeses
- enable or disable the SQL traces for another user’s session
-  closing of trace file to allow new one can be genrated
- Interanal structure manipulation and dumping

 Oradebug Commands:

 1) oradebug help
oradebug help <command name>
without command name argument all commands will be displayed
2)  Debug current process
oradebug setmypid
 3) Set OS process id of process  to debug
oradebug setospid <ospid>
4)  Set Oracle pid of process to debug:
 oradebug setorapid <orapid> ['force']
Force :Force process
5) For Various Dumps
 oradebug dump
 6) Set trace event in process
oradebug event <text>
text => event name
7) Set trace event in session
 oradebug session_event <text>
text => event_name
8) Print/Dump a fixed PGA/SGA/UGA variable
oradebug dumpvar <pls|uga> <name> [level]
plsuga => PGA/SGA/UGA
name=> variable name
level=> Level
9) Modify a fixed PGA/SGA/UGA variable
 oradebug setvar <pls|uga> <name> <value>
 pls|uga => PGA/SGA/UGA
name=> variable name
value => Variable’s new value
 10) Memory address to a trace file  will be dump by this command which can be found in user dump destination.
oradebug peek <addr> <len> [level]
addr=>memory address
len=> length
level=>level
11) Modify memory
oradebug poke <addr> <len> <value>
addr=> memory address
len=> length
value=> value
12) Wake up Process
oradebug wakeup <orapid>
orapid=>oracle PID
13) oradebug command allows you to suspend a process. first you need to identify  the shadow process that you want to suspend. Then set your debugs session to point  to that process.
oradebug suspend
14) Resume Suspended process..
oradebug resume
15) Flush pending writes to trace file.
oradebug flush
16) Close the Trace file
oradebug close_trace
17) Get name of the Trace file
oradebug tracefile-name
18) The lkdebug and nsdbx are utilities within the oradebug utlity. They are intented for OPS/RAC.
SQL>oradebug lkdebug help
SQL>oradebug nsdbx help
19) Parallel oradebug command prefix
a) oradebug -G <inst-List|def |all>
Inst-List=> Instance List
def=> Default
all=> All instances
b) oradebug -R <inst-List | def|all>
Parameters discussed above are same in this command too.
20) Set Instance/instances
oradebug setinst
21) Dump SGA to file
oradebug  sgatofile <SGA dump dir>
SGA dump dir=>SGA Directory name in double quotes
22) Dump and map SGA as COW (Copy On Write)
oradebug dmpcowsga <SGA dump dir>
SGA dump dir=>SGA Directory name in double quotes
23) Dump and map SGA as COW (Copy On Write). Shared (cow) where cow stand for ‘Copy On Write’ is memory that will
write through  the cache into real memory.
oradebug mappcowsga <SGA dump dir>
SGA dump dir=>SGA Directory name in double quotes
24) Analyze System hang
oradebug hanganalyze <level>
25) Flash Freeze  the Instance
oradebug ffbegin
26) Flash Freeze deregister instance from cluster
oradebug ffderegister
27) Call exit and terminate instance
oradebug ffterminst
28) Resume the flash frozen instance
oradebug ffresumeinst
 29)  Flash Freeze  status of instance
oradebug ffstatus
30) Help translate PCs to names
oradebug skdsttpcs <ifname>  <ofname>
ifname=> File name
31) Watch a region of memory
oradebug watch <address> <len> <self|exist|all|target>
32) Delete a watchpoint
oradebug delete <local|global|target> watchpoint <id>
33) Show watchpoints
oradebug show <local| global|target> watchpoints
34) Dump core without crashing process
oradebug core
35)  List semaphores and shared memory segments in use. Set process id  before using it. Also this option shows which network is oracle using for RAC traffic.
oradebug ipc
36)Remove the file size limit. Useful when need  trace file larger  then size specified by max_dump_size parameter.
oradebug unlimit
37) Dump process statistics
oradebug procstat
38) Invoke function with arguments
 ordebug call <func> [arg1]…[argn]
func=> function name
[arg1]…[argn]=> Function Arugment[s]
39) Invoke named dump
oradebug dump <dump_name> <level> <addr>
40) Dump of all state objects  for all processes  on the system
oradebug dump systemstate
41) Dump of all state objects for process
 oradebug  dump processstate
42) Dump of the process call stack and other information
oradebug dump errorstack  <level>
43) The contents  of the current controlfile  can be dumped  in text  form to a process trace file  in the usre_dump_dest directory using the CONTROLF dump
oradebug dump controlf <level>
44) Dump datafile headers
oradebug dump file_hdrs  <level>
 45)  To dump one block
alter system dump datafile  <file_number> block <block_id>;
To dump one or more data blocks
alter system dump datafile<file_number>  block min<first block> block max <last block>;
46) Dump redo headers
oradebug dump redohdr <level>
47) Dump of buffer cache
oradebug dump buffers <level>
48) Dump library cache statistics
 oradebug dump  library_cache <level>
49)  Dump strucutre of memory heap
oradebug dump headdump_addr<level> <address>
address=> Descriptor address
50) Dump the strucutre of index tree. The dump file contains one line for each block in the tree, indented  to show its level,
together with a count of the number of index entries in the block.
oradebug dump treedump <object_id>
or
alter sesion set events ‘immediate  trace name treedump level n’;
This utlitiy is mainly use for resolving the database issues and give more information to a DBA.
Note: Please do not use these command without knowledge or consultationation with oracle support.

No comments:

Post Top Ad

Your Ad Spot