Oracle utility: oradebug

Source: Internet
Author: User


Oracle utility: oradebug 1 oradebug introduction oradebug is mainly used by oracle support staff. Although it was very early, it is rarely recorded on the oracle official website. It is an SQL * plus command line tool. You can log on with sysdba permissions without special settings. It can be used to: 1) trace the process, or your, or external 2) determine the trc file to which the process is written 3) dump: Data File Header, internal oracle structure, etc. 4) suspension process, temporary www.2cto.com 5) determine which shared memory blocks and semaphores are used by the instance 6) Find out which IP addresses and protocols are used by the RAC instance 7) modify the data structure in SGA 2 oradebug use step 1) start SQL * plus and log in as sysdba 2) connect to a process 3) set an event or perform a diagnostic dump 4) search trc file name 5) disconnect from the connected process 3 oradebug command Introduction [SQL] sys @ ORCL> oradebug help HELP [command] Describe one or all commands SETMYPID Debug current process SETOSPID <ospid> Set OS pid of process to debug SETORAPID <orapid> ['force'] Set Oracle pid of process to debug SHORT_STACK Dump abridged OS stack DUMP <dump_name> <lvl> [addr] Invoke named dump DUMPSGA [bytes] dump fixed SGA www.2cto.com 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> <name> [level] Print/dump a fixed PGA/SGA/UGA variable DUMPTYPE <address> <type> <count> Print/dump an address with type info 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 rollback Close trace file failed 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] [syslevel] 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> <ofname> Helps translate PCs to names WATCH <address> <len> <self | exist | all | target> Watch a region of memory DELETE <local | global | target> watchpoint <id> Delete a watchpoint SHOW <local | global | target> watchpoints Show 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]... [argn] Invoke function with arguments 4 connects to a process
Before executing the oradebug command, you must add a target process. The target process has the following three conditions: the command objective is www.2cto.com oradebug setmypid to connect to the process oradebug setorapid pid that provides services for your SQL * plus to connect to an external service process, and pid = v $ process. pidoradebug setospid spid connects to an external service process and spid = v $ process. pid 1) setmypid [SQL] sys @ ORCL> oradebug setmypid Statement processed. sys @ ORCL> oradebug unlimit Statement processed. sys @ ORCL> oradebug event 10046 trace name context forever, level 8 Statement processed. sys @ ORCL> select * from Hr. required ments where department_id = 10; includepartment_name MANAGER_ID LOCATION_ID specified parameter --------------- 10 Administration 200 1700 sys @ ORCL> oradebug tracefile_name/u01/app/oracle/admin/orcl/udump/login sys @ ORCL> oradebug event 10046 trace name context off Statement processed. 2) setospid (spid operation) [SQL] sys @ ORCL> host top www.2cto. c Om top-15:14:20 up 47 min, 2 users, load average: 0.22, 0.20, 0.26 Tasks: 171 total, 2 running, 168 sleeping, 0 stopped, 1 zombie Cpu (s ): 1.3% us, 1.3% sy, 0.0% ni, 97.4% id, 0.0% wa, 0.0% hi, 0.0% si, 0.0% st Mem: 678912 k total, 671192 k used, 7720 k free, 16672 k buffers Swap: 0 k total, 0 k used, 0 k free, 401584 k cached pid user pr ni virt res shr s % CPU % mem time + COMMAND 5874 oracle 15 0 2444 1084 828 R 1.6 0.2. 47 top 4781 root 15 0 53900 11 m 6076 S 0.7. 13 Xorg 5168 oracle 16 0 491 m 17 m 15 m S 0.3 0: 02. 41 oracle sys @ ORCL> oradebug setospid 5168 Oracle pid: 7, Unix process pid: 5168, image: oracle@localhost.localdomain (CKPT) 3) setorapid (pid Operation) [SQL] sys @ ORCL> select sid from v $ mystat where rownum = 1; SID ---------- 159 sys @ ORCL> select pid, spid from v $ process p, v $ session s where s. Sid = 159 and s. paddr = p. addr; pid spid ---------- ------------ 15 5234 sys @ ORCL> oradebug setorapid 15 Statement processed. www.2cto.com sys @ ORCL> oradebug tracefile_name/u01/app/oracle/admin/orcl/udump/orcl_ora_5234.trc sys @ ORCL> oradebug event 10046 trace name context off Statement processed. note that the above effects can also be achieved in the top session of the oem, namely: the command used to determine which database sessions consume more resources 5 oradebug IPC to view the memory for sharing information is ipcs [-m |-s |-q]. Shared Memory, semaphores, and queue information are listed by default.-m lists shared memory, and-s lists shared semaphores, -q: list the shared queue [SQL] sys @ ORCL> host ipcs-m | grep ora 0xbe3bb918 5439503 oracle 640 419438592 20 sys @ ORCL> oradebug setmypid Statement processed. sys @ ORCL> oradebug ipc Information written to trace file. sys @ ORCL> oradebug tracefile_name/u01/app/oracle/admin/orcl/udump/orcl_ora_5234.trc sys @ ORCL> oradebug event 10046 trace name context off Statement processed. when a computer When the resources of the instance are limited, the usage of shared memory and semaphores by the failed instance will lead to resource shortage, so that the new oracle instance cannot be started. The command for clearing is ipcrm [-m |-s |-q] id. -M deletes the shared memory,-s deletes the shared semaphore, and-q deletes the shared queue, for example, ipcrm-m 5439503 6 oradebug SHORT_STACK. If a program is suspended, then, the call stack of the program can display the step in the call path that it suspends [SQL] sys @ ORCL> oradebug setospid 5180 Oracle pid: 13, Unix process pid: 5180, image: oracle@localhost.localdomain (D000) sys @ ORCL> oradebug short_stack www.2cto.com ksdxfstk () + 19 <-ksdxcb () + 1321 <-sspuser () + 81 <-_ kernel_vsyscall () + 2 <-ntevpque () + 112 <-ntevque () + 606 <-nsevwait () + 821 <-ksnwait () + 111 <- Ksliwat () + 770 <-kslwaitns () + 29 <-kskthbwt () + 370 <-kslwait () + 57 <-kmdmai () + 1797 <-kmmrdp () + 432 <-opirip () + 1191 <-opidrv () + 864 <-sou2o () + 113 <-opimai_real () + 353 <-main () + 111 <-_ libc_start_main () + 220 sys @ ORCL> oradebug event 10046 trace name context off Statement processed. the current call step is at the top of the output. The diagnostic dump can be dump of the following types: [SQL] sys @ ORCL> oradebug dumplist EVENTS TRACE_BUFFER_ON TRACE_BUFFER_OFF HANGANALYZE LATCHES PROCESSSTATE S Ystemstate instantiationstate ......... for example: 1) controlf [SQL] sys @ ORCL> oradebug setmypid Statement processed. sys @ ORCL> oradebug dump controlf 10 Statement processed. sys @ ORCL> oradebug tracefile_name/u01/app/oracle/admin/orcl/udump/orcl_ora_5234.trc 2) events is not a real dump. events only writes active events to the trc file. If you cannot determine which event is active in a session, process, or instance, there is a good way to query it: [SQL] sys @ ORCL> alter session set events '10046 trace name context forever, level 8'; Session altered. sys @ ORCL> alter session set events '4031 trace name heapdump level 3'; Session altered. sys @ ORCL> oradebug setmypid Statement processed. sys @ ORCL> oradebug dump events 1 Statement processed. sys @ ORCL> oradebug tracefile_name/u01/app/oracle/admin/orcl/udump /Orcl_ora_5234.trc sys @ ORCL> oradebug event 10046 trace name context off Statement processed. the command 1 session alter session2 process oradebug event4 instance alter system 8 Summary oradebug is an essential tool for solving problems and diagnosing performance for the scope of events at www.2cto.com oradebug dump events. This article only describes some of the most common commands and more functions, such as calling the oradebug lkdebug command of the global queue service Debugger in the RAC environment. Author: linwaterbin

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.