ORADEBUG – Oracle Utility

 oradebug iutility 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.

51)

About the Author Atul Kumar

Leave a Comment:

7 comments
juint says August 25, 2009

Copy paste of

Miladin Modrakovic

poor technical!!

Reply
Atul Kumar says August 25, 2009

@ Juint, We don’t allow copy+past others content or copyright material on this site. If You think this is copy + paste , I request you to post link of source and content on our site is of later date from your link then I’ll delete this post.

Atul Kumar
Administrator

Reply
ramnik says August 25, 2009

Miladin,

There is nothing poor or perfect. Yes of course these command syntax are from oracle documentation. These are standard command which any DBA use. I don’t know if you can change the syntax and write the article.

Atul I leave it on you to delete this post if you feel it is violating any copyright.

I didn’t written this article with intention to violate anything. My intention to write this post to help DBA community those didn’t know the various usage of oradebug utility and can utilize this article for their day to day work. .

If Mr. Miladin can change these syntax which is standard then I would really appreciate his efforts.

Please feel free to remove if Miladin can provide the source as I stated these syntax’s are from oracle documentation.

Thanks
Ramnik

Reply
Atul Kumar says August 26, 2009

Hi Ramnik,
I am confident that you didn’t copy it from any site,
I scanned content from above author and couldn’t find anything
which confirms anything mentioned by Junit.
I have seen guys malking such remarks for self
promotion or their blog promotion and I don’t care for them.

I hope you didn’t take my comments offensive and I apologize if
My comment above sounds too harsh.
I still admire your post and use them in day to day task.

Atul

Reply
Ramnik says August 26, 2009

Atul,

Thanks for your support. I do not want to copy anything but anyone in this world writing the blog need to study and implement practically from oracle documentation only.

I stop writing because people dont appreciate our effort who takes time to write the articles from their family time.

I am not only looking for appreciation. The advise should come to boost the moral of author.

But yes sometime negative feedback inspire you more so I am looking forward to write few more post on my practical experience with R12 and R12.1.1.

Thanks
Ramnik

Reply
Raj says August 30, 2010

Hi Atul,

I couldn’t stop my self to let you know that I am an individual getting benefited everyday by the efforts you guys putting to share the knowledge. I am also amazed by kindness of people like Ramnik. Atul and Ramnik please ignore those who bashing on / about good work you people are doing and KEEP UP THE SPIRIT. As a blog content user I can say people like myself are noticing and also understand that bashers have only intension and that is to bash!

With Kind Regards,
Raj

Reply
DBA says December 12, 2011

Is there anyway to change the tracefile location using oradebug? By default it creates trace file under user_dump_dest. I want let oradebug creates trace file under some different folder..Appreciate help.

Reply
Add Your Reply

Not found