Oracle audit www.oracle.com

Using truss with Oracle for debugging

What is truss?

From the Solaris man pages, "the truss utility executes the specified command and produces a trace of the system calls it performs, the signals it receives, and the machine faults it incurs. Each line of the trace output reports either the fault or signal name or the system call name with its arguments and return value(s)".
In this example, truss will be used to diagnose the error message generated by the agentctl

agentctl start


NMS-00010: Parsing parameter file failed.
nmiclbg_ensureAlive:: Initialize error for nmigenctx

Judging form the Oracle metalink, the cause of this error message can be buffling and it is therefore necessary to gather information about what agentctl is going.

We will use truss with two switches:
  • -o produces an output file
  • -f Follows all children created by fork() or vfork() and includes their signals, faults, and system calls in the trace output. Normally, only the first-level com- mand or process is traced. When -f is specified, the process-id is included with each line of trace output to indicate which process executed the system call or received the signal.

truss -o /tmp/agent.log -f agentctl start

In the truss output the code ENOENT is shown very frequently; its meaning can be found in the system include file errno.h

$ grep ENOENT /usr/include/sys/*

/usr/include/sys/errno.h:#define ENOENT 2 /* No such file or directory */

We therefore know that in the output of truss the ENOENT means "no such file or directory"

oracle: cat /tmp/agent.out.log
61: access("/opt/oracle/network/admin/snmp_ro.ora", 0) = 0 61: open("/opt/oracle/network/admin/snmp_ro.ora", O_RDONLY) = 3 61: fcntl(3, F_SETFD, 0x00000001) = 0 61: fstat(3, 0xFFFFFFFF7FFFDA10) = 0 61: brk(0x10037E500) = 0 61: brk(0x100382500) = 0 61: ioctl(3, TCGETA, 0xFFFFFFFF7FFFD94C) Err#25 ENOTTY 61: read(3, " s n m p . v i s i b l e".., 8192) = 62 61: read(3, 0x10037D824, 8192) = 0 61: open("/var/opt/oracle/snmp_rw.ora", O_RDONLY) Err#2 ENOENT This check returns an error: ENOENT means "no such file or directory" 61: lseek(3, 0, SEEK_CUR) = 62 61: close(3) = 0 61: open("/opt/oracle/9.2.0/ocommon/nls/admin/data/lx20001.nlb", O_RDONLY) = 3 61: read(3, " Z Z\0\00210\0\0\002\0\0".., 100) = 100 61: read(3, "\001\01F\0\t\0\0\0\0 ?\0".., 5668) = 5668 61: close(3) = 0 61: open("/opt/oracle/9.2.0/network/mesg/nmsus.msb", O_RDONLY) = 3 61: fcntl(3, F_SETFD, 0x00000001) = 0 61: lseek(3, 0, SEEK_SET) = 0 61: read(3, "1513 "011303\t\t\0\0\0\0".., 256) = 256 61: lseek(3, 512, SEEK_SET) = 512 61: read(3, "139F\0\0\0\0\0\0\0\0\0\0".., 512) = 512 61: lseek(3, 1024, SEEK_SET) = 1024 61: read(3, "\0\n\0CD01 .01 901 m0192".., 48) = 48 61: lseek(3, 1536, SEEK_SET) = 1536 61: read(3, "\0\n\001\0\0\0 D\002\0\0".., 512) = 512 61: lseek(3, 13824, SEEK_SET) = 13824 61: read(3, "FFFF\0\0\0\0\0\0\0\0\0\0".., 512) = 512 61: lseek(3, 14336, SEEK_SET) = 14336 61: read(3, "FFFF\0\0\0\0\0\0\0\0\0\0".., 512) = 512 61: lseek(3, 14848, SEEK_SET) = 14848 61: read(3, "\0\0\0\0\0\0\0\b\0\0\0\0".., 512) = 512 61: write(1, " N M S - 0 0 0 1 0 : P".., 42) = 42 61: write(2, "\n n m i c l b g _ e n s".., 54) = 54 61: lseek(0, 0, SEEK_CUR) = 3101 61: _exit(-1)
The problem was therefore that there was no snmp*.ora on /var/opt/oracle
Let's copy therefore the two snmp_*.ora onto /var/opt/oracle

oracle: cp snmp*.ora /var/opt/oracle
oracle:  agentctl start

DBSNMP for Solaris: Version 9.2.0.4.0 - Production on 31-MAR-2004 13:55:08

Copyright (c) 2003 Oracle Corporation.  All rights reserved.
Agent started
The point is therefore that analyzing the output of truss is often possible to find out what the reason of the error message was. truss quite often shows clearly which files the application is looking for and on which directories (the search list coming from the $PATH variable).

Another good example of using truss is in http://www.kevlo.com/~ebs/docs/truss.html

[Home] [Web Design] [HTML tutorials] [Javascript] [PSP] [About us] [Links] [Anonymous email] [Best hosting] [Daily Oracle Life] [IT jobs in Switzerland] [Web Submission] [Web traffic]
Rate this article ...
Very poor Poor Average Good Very good