Sunteți pe pagina 1din 59

Linux/UNIX Tools for The Oracle

DBA

Tim Gorman
Technical Consultant - Delphix

2015
2015 Delphix.
Delphix. All
All Rights
Rights Reserved
Reserved

Sunday 25-Oct 2015

UNIX/Linux variants discussed

Generic UNIX documentation on the web ://www.unixtools.com/

http

Proprietary UNIX
Oracle Solaris - http://docs.oracle.com/en/operating-systems/?tab=1
IBM AIX - http://www-03.ibm.com/systems/power/software/aix/
HP-UX - http://www8.hp.com/us/en/products/servers/hp-ux.html

Illumos Linux

http://wiki.illumos.org/display/illumos/illumos+Home

Red Hat (Fedora) - https://access.redhat.com/documentation/en-US/


CentOS - https://www.centos.org/docs/

Oracle - http://docs.oracle.com/en/operating-systems/?tab=2
SUSE - https://www.suse.com/documentation/

2015 Delphix. All Rights Reserved

UNIX/Linux diagnostics
CPU and Memory
sar, vmstat, uptime and w, ipcs, sysresv

Process
top, ps, pmap and svmon, fuser, lsof, jstat

I/O and storage


iostat, df, du

Network
netstat, ifconfig, ping, traceroute, wireshark, tcpdump

Traces
truss, strace, dtrace

Other useful UNIX diagnostic utilities


adb, dd, od, strings

2015 Delphix. All Rights Reserved

sar utility
CPU utilization: sar -u
%usr, %sys, %idle
%nice (Linux), %wio (Solaris)

CPU run queue report: sar -q


Runq-sz
plist-sz and load averages (Linux) also

Context switching activity: sar -w


cswch/s (Linux) or pswch/s (Solaris)

VM swapping: sar -W (Linux) or sar -w (Solaris)


swpin/s, swpot/s

VM paging: sar -B (Linux) or sar -p (Solaris)


pgpgin/s, pgpgot/s (Linux)
pgin/s, ppgin/s (Solaris)
2015 Delphix. All Rights Reserved

sar utility
$ sar -u 5 5
Linux 2.6.32-431.el6.x86_64 (xyz.acme.com) 02/25/2015 _x86_64_
11:51:52
11:51:57
11:52:02
11:52:07
11:52:12
11:52:17
Average:

PM
PM
PM
PM
PM
PM

CPU
all
all
all
all
all
all

2015 Delphix. All Rights Reserved

%user
3.99
31.22
33.94
26.63
8.88
21.02

%nice %system %iowait


0.00
4.62
0.42
0.00
52.32
6.54
0.00
58.99
7.07
0.00
66.26
7.11
0.00
18.60
1.24
0.00
40.40
4.50

%steal
0.00
0.00
0.00
0.00
0.00
0.00

%idle
90.97
9.92
0.00
0.00
71.28
34.08

sar utility
$ sar u 5 5
SunOS xyz.acme.com 5.11 dlpx-4.0.1.0
01:02:49
01:02:54
01:02:59
01:03:04
01:03:09
01:03:14
Average

i86pc 03/02/2015

%usr
1
17
16
13
1

%sys
2
17
24
16
3

%wio
0
0
0
0
0

%idle
97
66
60
72
96

12

78

2015 Delphix. All Rights Reserved

sar utility
$sarp55
SunOSdb.xyz.com5.8Generic_10852804sun4u04/12/15
13:17:52atch/spgin/sppgin/spflt/svflt/sslock/s
13:17:570.200.000.000.802.990.00
13:18:02427.254.415.611521.243432.470.00
13:18:07116.600.000.00513.801111.400.00
13:18:120.800.000.000.000.000.00
13:18:170.800.000.000.000.000.00
Average108.960.881.12406.56908.000.00

2015 Delphix. All Rights Reserved

sar utility
$sarq55
Linux2.4.710smp(linux.bvha.net)04/12/2015
01:13:55PMrunqszplistszldavg1ldavg5ldavg
15
01:14:00PM2620.550.44
0.15
01:14:05PM5641.880.49
0.13
01:14:10PM1620.330.49
0.11
01:14:15PM2620.430.48
0.11
01:14:20PM2620.450.47
0.09
Average:2620.720.47
0.19
2015 Delphix. All Rights Reserved

mpstat utility
Per-processor statistics
$mpstat55
CPUminfmjfxcalintrithrcswicswmigrsrwsysclusrsyswtidl
1225063340630115781005791051372
223004494443191618100581941076
CPUminfmjfxcalintrithrcswicswmigrsrwsysclusrsyswtidl
1105823382362834100615536724
2002077375981944100386522271
CPUminfmjfxcalintrithrcswicswmigrsrwsysclusrsyswtidl
1005983262242745100626736426
2002638827241912100337322570
CPUminfmjfxcalintrithrcswicswmigrsrwsysclusrsyswtidl
100537329228226290460324252
2003971015847275380570634843
CPUminfmjfxcalintrithrcswicswmigrsrwsysclusrsyswtidl
100535329227255260601516528
200210651528184280354322867
2015 Delphix. All Rights Reserved

vmstat utility
Virtual memory statistics
$vmstat55
procsmemorypagediskfaultscpu
rbwswapfreeremfpipofrdesrm1insycsussyid
200710403124851456170000075028731810486
10059416203925956844000009416125286589
1005941620392000000009471224726292
0115941620392000000009981365486391
0105941620392100000008379674495293

2015 Delphix. All Rights Reserved

uptime and w utilities


uptime displays current time and up-time
Also displays the average number of processes in run-queue
over the past 1 minute, 5 minutes, and 15 minutes (a.k.a.
load average)
$uptime
1:36pm,up396days,21:36,2users,loadavg:0.31,0.28,0.28

w displays same info plus info about logged-in UNIX


users
$w
1:04am,up294days,23:30,3users,loadavg:0.58,0.42,0.31
USERTTYFROMLOGIN@IDLEJCPUPCPUWHAT
timpts/0abc.acme.com12:16pm1:07m0.12s0.12sbash
paulpts/1def.acme.comTue8pm11:12m0.16s0.16sbash
2015 Delphix. All Rights Reserved

ipcs utility
Display (show) interprocess communication (IPC)
data structures or resources
Shared memory
Use for Oracles System Global Area (SGA)
Semaphores
Used by Oracles foreground (i.e. user connections) and
background (i.e. SMON, PMON, etc) server processes
Provide mutual-exclusion synchronization for concurrent multiuser processing
Message queues
Not used by Oracle
Typically used by transaction processing monitors (TPMs) such
as BEA Tuxedo, IBM CICS and Encina, NCR Top End, etc

UNIX ipcrm utility


Used to remove IPC structures displayed with ipcs
2015 Delphix. All Rights Reserved

ipcs utility
Parameters affecting IPC resource usage
Shared memory

SGA_TARGET, SGA_MAX_SIZE
MEMORY_TARGET, MEMORY_MAX_SIZE
DB_CACHE_SIZE, DB_*_CACHE_SIZE,
SHARED_POOL_SIZE, LARGE_POOL_SIZE, STREAMS_POOL_SIZE
LOG_BUFFER

Semaphores
PROCESSES

2015 Delphix. All Rights Reserved

ipcs utility
$ipcsmb
IPCstatusfrom/dev/kmemasofSatMar2314:02:262015
TIDKEYMODEOWNERGROUPSEGSZ
SharedMemory:
m00x411c025drwrwrwrootroot348
m10x4e0c0002rwrwrwrootroot61760
m20x41200e0arwrwrwrootroot8192
m30x301c6a7arwrwrwrootroot1048576
m1010080x7988ff50rwroracledba957280256
m190090x53494152rwrrrootsys512
m4320110x12045bf8rwroracledba206798848
m3480120x0d6891d0rwroracledba206798848
m90130x84006550rwroracledba99233792

2015 Delphix. All Rights Reserved

ipcs utility
$ipcssb
IPCstatusfrom/dev/kmemasofSatMar2314:04:252015
TIDKEYMODEOWNERGROUPNSEMS
Semaphores:
s00x411c025drarararootroot1
s10x4e0c0002rarararootroot2
s20x41200e0ararararootroot2
s160x6d200e5brarararootroot1
s250x52200e5brarararootroot1
s8240260xafb30378raroracledba104
s1050270x0317794craroracledba71
s32820280x5701f4fcraroracledba71
s69540300x00000001rarararootroot1
s78820310x5a6f7530raroracledba71

2015 Delphix. All Rights Reserved

Oracle sysresv utility


$ cd $ORACLE_HOME/bin
$ ./sysresv
IPC Resources for ORACLE_SID "ebsprd1" :
Shared Memory:
ID
KEY
788529249
0x00000000
788529250
0x00000000
788529251
0xecd88a74
Semaphores:
ID
33554441
33554442
33554443
Oracle Instance
2015 Delphix. All Rights Reserved

KEY
0xbf148024
0xbf148025
0xbf148026
alive for sid "ebsprd1"

Process diagnostics
top
Display top resource-consuming processes and totals

ps
Process status

pmap, svmon
Process memory mapping display

fuser, lsof
File and file-system usage displays

jstat
Java virtual machine (JVM) memory usage displays

2015 Delphix. All Rights Reserved

top utility
System:xyz.acme.comSatMar2312:03:242015
Loadaverages:2.64,2.63,2.47
284processes:248sleeping,36running
CPULOADUSERNICESYSIDLEBLOCKSWAITINTRSSYS
02.4084.2%0.0%6.9%8.9%0.0%0.0%0.0%0.0%
12.6375.2%0.0%6.9%17.8%0.0%0.0%0.0%0.0%
23.0381.2%0.0%5.0%13.9%0.0%0.0%0.0%0.0%
32.5178.2%0.0%5.9%15.8%0.0%0.0%0.0%0.0%

avg2.6480.2%0.0%5.9%13.9%0.0%0.0%0.0%0.0%
Mem:1459956K(1286788K)real,724328K(175844K)virtual,56900Kfree
CPUTTYPIDUSERNAMEPRINISIZERESSTATETIME%WCPU%CPUCOMM
0pts/tb22509tgorman240201788K880Krun3:3916.5516.52bcp
2pts/tb22515tgorman152206788K5652Krun2:5714.0113.99sqll
2pts/th22890tgorman23620716K316Krun0:5211.4411.42dump
3?22712oracle154209344K1904Ksleep1:3811.3411.32orac
2015 Delphix. All Rights Reserved

ps utility
SysV version (most variants)
$pseaf

BSD version (MacOSX)


%psaux

Posix XPG3/4 (X/Open Portability Guide v3/4)


#pseoopt[,opt]

Provides info about individual processes


Status, PID, PPID, user, command text and parameters
Cumulative and recent CPU usage
Memory (virtual, resident)

2015 Delphix. All Rights Reserved

ps utility
An easy home-grown top command
$pseaf|sortn+3|tail
oracle15848122809:51:28?19:34ora_lgwr_acme01
tim211672116423211:15:59pts/td2:59bcpdss.dbo.modi
oracle20371123510:57:05?7:05acme01(LOCAL=
tim213952139223511:24:52pts/tf0:19ddif=/export/sc
tim201762016723910:51:52pts/ta7:16sqlldrparfile=t
tim214162140724011:24:58pts/tg0:24sqlldrparfile=t
tim214712146824011:25:07pts/th0:18ddif=/export/sc
tim214102140725211:24:58pts/tg0:27ddif=/export/sc

Ordering can be reversed using ps -eaf | sort -nr +3 |


head
2015 Delphix. All Rights Reserved

ps utility
Another home-grown top command
Also displays memory consumption in Kbytes
$pseouser,pid,pcpu,vsz,rss,comm|sortn+2|tail
root281030.132402560/usr/local/sbin/sshd
oracle203340.1495056447056oraclePROD
oracle208810.1711552634144oraclePROD
oracle186263.3463240428032ora_lgwr_PROD
oracle1862412.2465112429480ora_dbw0_PROD
root314.300fsflush
oracle1862615.3463240428032ora_lgwr_PROD
oracle2807730.8486824450200oraclePROD

2015 Delphix. All Rights Reserved

CPU/memory diagnostics
Use top and/or ps to identify process activity
in UNIX

By current CPU activity


By total CPU time consumed
By time started
By process name
By UNIX account
By process hierarchy
parent processes, child processes, etc.

2015 Delphix. All Rights Reserved

pmap/svmon utilities
Text memory sections
Executable file image (i.e. oracle)
Shared (dynamically-linked) libraries

Stack memory sections


Heap memory sections:
Session/user global area (UGA):
DB_FILES, OPEN_CURSORS, OPEN_LINKS,
SESSION_CACHED_CURSORS
JAVA_SOFT_SESSIONSPACE_LIMIT (Oracle9i)
JAVA_MAX_SESSIONSPACE_SIZE (Oracle9i)
Process global area (PGA):
SORT_AREA_SIZE
HASH_AREA_SIZE
BITMAP_MERGE_AREA_SIZE
CREATE_BITMAP_AREA_SIZE
Read buffers in SQL*Loader
2015 Delphix. All Rights Reserved

pmap/svmon utilities
$pmapx18373
18373:oraclePROD(DESCRIPTION=(LOCAL=no))
AddrKbytesResdentSharedPrivatePermissionsMappedFile
00010264881393613536400read/execorac
019FC27227221656read/write/exeorac
01A40480480480read/write/exe[heap]
80000996816996816996816read/write/shr[ismshmi
FEAE6888read/write/exepsrn
FEAF0161688read/execlibc
FEBF4888read/write/exelibm
FEC00465699296032read/exelibj
...
FF3E0888read/write/exeld.s
FFBE0646464read/write/exe[stack]

Total13168811535216480998872
2015 Delphix. All Rights Reserved

fuser/lsof utilities
Displays list of UNIX processes with file handles
$fuser/d01001/oradata/PROD/indx_01.dbf
/d01001/oradata/PROD/indx_01.dbf:450o446o444o
$pseaf|grep450
oracle4501017:32:55?0:01ora_smon_PR
$pseaf|grep446
oracle4461017:32:55?0:00ora_lgwr_PR
$pseaf|grep444
oracle4441017:32:55?0:01ora_dbw0_PR

2015 Delphix. All Rights Reserved

fuser/lsof utilities
Displays list of UNIX processes using file-system
$dfk
FilesystemkbytesusedavailcapMount
/dev/dsk/c0t0s02052750158645040471880%/
/proc0000%/proc
/dev/dsk/c0t1s397087106904589338703435%/d010
swap99856821049964641%/tmp
/dev/dsk/c0t0s356575893996745160426972%/opt
$fuser/dev/dsk/c0t1s3
/dev/dsk/c0t1s3:727ctm725ctm723ctm722tm720ctom
633tom623tom462o458o456o454o452o450o448o
446o444o

2015 Delphix. All Rights Reserved

fuser/lsof utilities
Displays list of UNIX processes using file-system
$dfk
FilesystemkbytesusedavailcapMount
/dev/dsk/c0t0s02052750158645040471880%/
/proc0000%/proc
/dev/dsk/c0t1s397087106904589338703435%/d010
swap99856821049964641%/tmp
/dev/dsk/c0t0s356575893996745160426972%/opt
$fuser/dev/dsk/c0t1s3
/dev/dsk/c0t1s3:727ctm725ctm723ctm722tm720ctom
633tom623tom462o458o456o454o452o450o448o
446o444o

2015 Delphix. All Rights Reserved

fuser/lsof utilities
Displays list of UNIX processes using file-system
#lsof/var
COMMANDPIDUSERFDTYPEDEVICESIZE/OFFNODENAME
syslogd350root5wVREG222,50440818/var/adm/messag
syslogd350root6wVREG222,53390986248/var/log/syslog
cron353rootcwdVDIR222,5512254550/varatjobs

2015 Delphix. All Rights Reserved

jstat utility
Displays memory usage within JVM
Understanding Java Garbage Collection

http://www.cubrid.org/blog/dev-platform/understanding-java-garbage-collection/

How to Monitor Java Garbage Collection


http://www.cubrid.org/blog/dev-platform/how-to-monitor-java-garbage-collection/

In a JVM, objects are allocated and managed implicitly


Destroying objects that no longer in use is called garbage
collection
Objects are classified as young (new) or old (persistent)
Some objects move from young to old, some do not
Young objects promote from Eden to Survivor
Old objects are either Old or Permanent

Cleaning up young objects is easy, cleaning up old


objects can be difficult due to dependencies and inheritance
chains
Cleaning up old objects can be known as Stop The World (STW)
events, which mean halting all activity within the JVM until the operation
is completed
2015 Delphix. All Rights Reserved

jstat utility
Displays memory usage within JVM
$ jstat gc 13513 1000

S0C
S1C
16128.0 16640.0
16128.0 16640.0
16128.0 16640.0

S0U
0.0
0.0
0.0

S1U
EC
EU
OC
9881.6 667136.0 470346.6 1398784.0
9881.6 667136.0 501826.7 1398784.0
9881.6 667136.0 510070.9 1398784.0

$ jstat gc 13513 1000


...
YGC
YGCT
FGC
... 183777 6048.454 109
... 183777 6048.454 109
... 183777 6048.454 109

2015 Delphix. All Rights Reserved

OU
1106875.4
1106875.4
1106875.4

PC
PU
YGC
YGCT
65536.0 65007.6 183777 6048.454
65536.0 65007.6 183777 6048.454
65536.0 65007.6 183777 6048.454

FGCT
GCT
64.755 6113.209
64.755 6113.209
64.755 6113.209

FGC
109
109
109

FGCT
GCT
64.755 6113.209
64.755 6113.209
64.755 6113.209

IO/network diagnostics
iostat
Display extended I/O statistics

ifconfig
Configure/display network interfaces

netstat
Display cumulative network statistics

ping
Send ICMP echo packets to network hosts

traceroute
Trace the route of ICMP echo packets to network hosts

tcpdump, wireshark

2015 Delphix. All Rights Reserved

iostat utility
Monitors average I/O loads and waits
by observing time that devices are active in relation to their
average transfer rates

Only has visibility to the block-special and characterspecial (a.k.a. raw) devices presented to UNIX
usually logical volumes, sometimes formatted slices

Typical I/O topology

Files, which reside within one and only one


File system, which reside within one and only one
Logical volume, which is comprised of one or more
Plex(es), which are each comprised of one or more
Sub-disk(s), which are partitioned from contiguous tracks on either
a physical volume or a RAID parity-group

2015 Delphix. All Rights Reserved

iostat utility
iostat can display info about LV beneath the FS
iostat cannot display info about components of LV

Example 1:

The logical volume is RAID-0 (striped) across four plexes


Each plex is RAID-1 (mirrored) across two sub-disks
Each sub-disk is a section of a physical volume
Each physical volume is a disk drive (HDD)

2015 Delphix. All Rights Reserved

iostat utility
iostat can display info about LV beneath the FS
iostat cannot display info about components of LV

Example 2:

The logical volume is RAID-1 (mirrored) on two plexes


Each plex is a single sub-disk
Each sub-disk is a section of a physical volume
Each physical volume is a disk drive (HDD)

2015 Delphix. All Rights Reserved

iostat utility
iostat can display info about LV beneath the FS
iostat cannot display info about components of LV

Example 3:

The logical volume is RAID-0 (striped) across four plexes


Each plex is a single sub-disk
Each sub-disk is a section of a physical volume
Each physical volume is a RAID-5 parity group of 7+1

2015 Delphix. All Rights Reserved

iostat utility
iostat can display info about LV beneath the FS
iostat cannot display info about components of LV

Example 4:

The logical volume is a single plex


Each plex is a single sub-disk
Each sub-disk is a section of a physical volume
Each physical volume is a RAID-5 parity group of 3+1

2015 Delphix. All Rights Reserved

iostat utility
$iostatx55
extendeddevicestatistics
devicer/sw/skr/skw/swaitactvsvc_t%w%b
md10.00.00.00.10.00.011.100
md40.00.20.01.00.00.025.100
md60.20.38.41.50.00.012.400
md70.30.93.720.60.00.024.811
md110.00.00.00.10.00.011.300
md140.00.20.01.00.00.014.100
md160.10.34.21.50.00.08.900
sd00.52.98.427.50.00.116.003
sd10.52.98.427.50.00.115.903
sd60.00.00.00.00.00.00.000
sd5012.76.3353.777.60.00.15.307
sd8012.76.3352.477.60.00.15.507
sd28715.24.5412.368.70.00.16.208
sd38515.04.5395.468.70.00.16.108
2015 Delphix. All Rights Reserved

ifconfig utility

Configures network interfaces


Configure new network interface: ifconfig create inet up
Display network interface status: ifconfig -a

$ifconfiga
lo0:flags=0849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4>mtu8232
inet127.0.0.1netmaskff000000
hme0:flags=0843<UP,BROADCAST,RUNNING,MULTICAST,IPv4>mtu1500
inet10.8.2.10netmaskffffffc0broadcast10.8.2.63
hme1:flags=0843<UP,BROADCAST,RUNNING,MULTICAST,IPv4>mtu1500
inet10.8.2.12netmaskffffffc0broadcast10.8.2.63
hme2:flags=0843<UP,BROADCAST,RUNNING,MULTICAST,IPv4>mtu1500
inet192.168.2.18netmaskfffffff0broadcast192.168.2.55

2015 Delphix. All Rights Reserved

netstat utility
Displays network connections, routing tables,
interface statistics

Network connections (a.k.a. sockets): netstat


Cumulative networking statistics: netstat -s
Routing tables: netstat -r
STREAMS statistics (Solaris and AIX): netstat -m

Verbose mode: add -v switch

2015 Delphix. All Rights Reserved

netstat utility
$netstat
LocalAddrRemoteAddrSwindSndQRwindRcvQState

xyz.32797abc.1521736200736200ESTABLISHED
xyz.1521abc.32797736200736200ESTABLISHED
xyz.1521def.56788248200642400ESTABLISHED
xyz.1521def.60942243200642400ESTABLISHED
xyz.22ghi.2038321200246160TIME_WAIT
xyz.1521def.45444736200736200TIME_WAIT
xyz.45451ghi.1984318560666080TIME_WAIT
xyz.1521abc.45452736200736200TIME_WAIT
...
ActiveUNIXdomainsockets
AddrTypeVnodeConnRemoteAddr
303b9a88streamord303bf8880000/var/tmp/.oracle/sEXTPROC

303b9c30streamord303bef500000/var/tmp/.oracle/s#1031.1
2015 Delphix. All Rights Reserved

netstat utility
Display network routing tables on the local host:
$netstatr
RoutingTable:IPv4
DestinationGatewayFlagsRefUsesInterface

abc.acme.comjkl.acme.comU122541hme0
def.acme.comdmz.acme.comU1347hme1
ghi.acme.comxyz.acme.comU245hme2
224.0.0.0dbifU10hme0
localhostlocalhostUH233384lo0

2015 Delphix. All Rights Reserved

ping utility
Simple diagnostic test for network connectivity
Be aware that many network administrator block ICMP
traffic for security reasons
$pingc4www.yahoo.com
PINGwww.yahoo.akadns.net(66.218.71.84)from216.183.97.53:
56(84)bytesofdata.
64bytesfromw5.scd.yahoo.com(66.218.71.84):icmp_seq=0
ttl=56time=30.864msec
64bytesfromw5.scd.yahoo.com(66.218.71.84):icmp_seq=1
ttl=56time=24.241msec
64bytesfromw5.scd.yahoo.com(66.218.71.84):icmp_seq=2
ttl=56time=24.238msec
64bytesfromw5.scd.yahoo.com(66.218.71.84):icmp_seq=3
ttl=56time=24.232msec
2015 Delphix. All Rights Reserved

traceroute utility
Display the route taken by ICMP packets to an IP host
$traceroutewww.yahoo.com
Warning:www.yahoo.comhasmultipleaddrs;using66.218.70.49
tracerouteto66.218.70.49,30hopsmax,38bytepackets
1216.183.97.51(216.183.97.51)1.83ms0.29ms0.28ms
2xr051.xxx.net(217.189.96.5)0.42ms0.32ms0.30ms
3POS23.ZZZ.NET(158.230.175.85)1.06ms1.01ms0.97ms
4at50.ZZZ.NET(152.63.91.126)1.57ms1.61ms1.27ms
5so70.ZZZ.NET(153.63.8.70)11.13ms11.31ms11.04ms
...
12ge90.Level3.net(64.159.2.9)27.72ms27.72ms27.74ms
13xz33.Level3.net(64.152.69.30)33.16ms33.12ms33.05ms
14w18ww.yahoo.com(66.218.70.49)32.99ms33.05ms32.98ms
2015 Delphix. All Rights Reserved

tcpdump utility
Dump/sniff traffic on a network
$tcpdump
tcpdump:listeningonhme0
17:01:12.147248mail.acme.com.22>02pool82
90.nas33.thornton1.co.us.da.qwest.net.49161:P
428278756:428278820(64)ack1413349383win24624
<nop,nop,timestamp1579425721881953418>(DF)[tos0x10]
17:01:12.34438502pool82
90.nas33.thornton1.co.us.da.qwest.net.49161>
mail.acme.com.22:.ack64win32832<nop,nop,timestamp
1881953418157942561>(DF)[tos0x10]
17:01:13.143542mail.acme.com.22>02pool82
90.nas33.thornton1.co.us.da.qwest.net.49161:P64:480(416)
ack1win24624<nop,nop,timestamp1579426721881953418>
(DF)[tos0x10]
2015 Delphix. All Rights Reserved

wireshark utility
Wireshark (http://wireshark.org) is a network protocol
analyzer

2015 Delphix. All Rights Reserved

Trace utilities
Different utilities on different platforms
truss
Solaris, AIX
tusc
HP-UX
strace
Linux

Attach to or run a process and then trace:

UNIX system calls executed


Signals received
Machine faults incurred
(optional) entry/exit trace of user level function calls

2015 Delphix. All Rights Reserved

truss utility
Output from truss on Solaris10
Oracle PMON process
semop(196608,0xFFBEE7F4,1)(sleeping...)
Receivedsignal#14,SIGALRM,insemop()[caught]
semop(196608,0xFFBEE7F4,1)Err#91ERESTART
sigprocmask(SIG_BLOCK,0xFFBEE320,0x00000000)=0
sigprocmask(SIG_UNBLOCK,0xFFBEE320,0x00000000)=0
getcontext(0xFFBEE0E0)
setcontext(0xFFBEE0E0)
sigprocmask(SIG_BLOCK,0xFFBEE5FC,0x00000000)=0
setitimer(ITIMER_REAL,0xFFBEE584,0x00000000)=0
sigprocmask(SIG_UNBLOCK,0xFFBEE5FC,0x00000000)=0
getcontext(0xFFBEE4E8)
sigprocmask(SIG_BLOCK,0xFFBEE5FC,0x00000000)=0
2015 Delphix. All Rights Reserved

strace utility
Output from strace on Red Hat Enterprise Linux
(RHEL)
Oracle server process using SQL Trace
15:26:02.348478gettimeofday({1003530362,348525},NULL)=0
15:26:02.348564gettimeofday({1003530362,348588},NULL)=0
15:26:02.348659pread(409,
"\6\2\0\0\240\27\200\0\325\227\7\0\0\0\2\0\0\0\0\0\1\0\7\0_\f\
0\0\210I\7\0\0\0\24P\2\6\3\0\30/\200\0\0\0\0\0\0\0\0\0\0\0\0
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
\0\0\0\0\0\0\0\0\1\236\0\0\0N\1\354\3R\6R\6\0\0\236\0\1\0\2\
0\3\0\4\0\5\0"...,
8192,12386304)=8192
15:26:02.348995gettimeofday({1003530362,349035},NULL)=0
15:26:02.349174gettimeofday({1003530362,349209},NULL)=0
15:26:02.349260write(6,"WAIT#1:nam=\'dbfilesequential
2015
Delphix. All Rights Reserved
read\'ela=0p1=2p2=6048p3=1",63)

DTrace utility

Performance analysis and troubleshooting tool (http://dtrace.org )


Not just user-level software (i.e. applications, databases and
webservers)

also OS kernel and device drivers


provides a language, (i.e. D) for writing DTrace scripts and one-liners

Terrific case-study of I/O performance analysis using DTrace

https://blogs.oracle.com/BestPerf/entry/i_o_analysis_using_dtrace

# dtrace -n 'proc:::exec-success{printf("%d %s,timestamp,curpsinfo->pr_psargs);}


dtrace: description 'proc:::exec-success ' matched 1 probe
CPU
ID
FUNCTION:NAME
1
797
exec_common:exec-success 21935388676181394 man ls
0
797
exec_common:exec-success 21935388840101743 sh -c cd /usr/share/man; tbl /usr/sha
1
797
exec_common:exec-success 21935388858652639 col x
0
797
exec_common:exec-success 21935388863714971 neqn /usr/share/lib/pub/eqnchar
0
797
exec_common:exec-success 21935388867119787 tbl /usr/share/man/man1/ls.1
1
797
exec_common:exec-success 21935388881310626 nroff -u0 -Tlp -man
0
797
exec_common:exec-success 21935388922364648 sh -c trap 1 15; /usr/bin/mv -f /tm
1
797
exec_common:exec-success 21935388930987671 /usr/bin/mv -f /tmp/mpDKaiGn /usr/sha
1
797
exec_common:exec-success 21935388948485045 sh -c less -siM /tmp/mpDKaiGn
0
797
exec_common:exec-success 21935388971039204 less -siM /tmp/mpDKaiGn
2015 Delphix. All Rights Reserved

Other useful utilities


adb
General-purpose debugger
Useful for obtaining stack traces from core dump files

strings
Display text strings within a binary file

file
Display the type of file

dd
Copy (and optionally convert) data

od
Octal dump (also dumps hex, decimal, and char)

2015 Delphix. All Rights Reserved

adb utility
MetaLink note #17613.1 (entitled ORA-03113 on
UNIX - What Information to Collect) describes the
mechanism of a core dump in UNIX
adb is a general-purpose debugger
One of the oldest and least user-friendly utilities in UNIX
Useful for gathering errorstack dumps
$cd$ORACLE_BASE/admin/$ORACLE_SID/cdump
$cdcore_11876
$adb$ORACLE_HOME/bin/oraclecore
$c
ksedmp()+1602
ssexhd()+3684
sigacthandler()+4088
kpodscn()+56
kqlprfd()+112
<controld>
2015 Delphix. All Rights Reserved

strings utility
$stringsoracle|more
ksmpgf_
word
ksmmpd_
skgm_cx
ksmskgmctx_
skgmrhandle*
ksmrealm_
kgsmp*
ksmgpp_
ksmpy
ksmpgh_
structksmug*

2015 Delphix. All Rights Reserved

file utility
$file$ORACLE_HOME/bin/oracle
oracle:ELF32bitMSBexecutableSPARCVersion1,
dynamicallylinked,notstripped
$fileoramem.sh
oramem.sh:executable/bin/kshscript

2015 Delphix. All Rights Reserved

dd utility
The dd utility is useful for moving data:
Between files
From an offset within a file to an offset within a file
From files to devices and vice-versa
Devices could be tape, disk, network, etc
Converting data
ASCII => EBCDIC and vice-versa
Big-endian => little-endian (a.k.a. swab operation) and
vice-versa

2015 Delphix. All Rights Reserved

od utility
$ddif=system01.dbfbs=8kskip=100count=12>/dev/null|\
>odx
000000006020000004000641c7d0e8900000106
0000020bdbc000002000000000000271c7d0e85
00000400000fd78000202000000000000000000
000006000000000000000000000000000000000
00001000000000000030055000063b2010011c1
000012014990100200100001c7d0e8900008002
000014000000000000c003c1e9d1e7d00000000
00001600000000000000000060000001f600000
00002001f531f451f371f291f1b1f0d1eff1ef1
00002201ec71ee31ed51e9d0000000000000000
000024000000000000000000000000000000000

2015 Delphix. All Rights Reserved

Support-recommended
diagnostic tools

Documented recommendations
http://docs.oracle.com/cd/E37670_01/E37355/html/ol_diag.html

sosreport
http://docs.oracle.com/cd/E37670_01/E37355/html/ol_sosreport_diag.html
Collects configuration and diagnostic information for Linux systems

kdump
http://docs.oracle.com/cd/E37670_01/E37355/html/ol_kdump_diag.html
Linux kernel crash-dump diagnostic tool

OSWatcher Black Box (OSW or OSWbb)


http://docs.oracle.com/cd/E37670_01/E37355/html/
ol_oswatcher_diag.html
Collects and archives OS and network metrics that you can use to
diagnose performance issues
Records output from iostat, mpstat, netstat, vmstat, ps, and top
Captures /proc/meminfo and /proc/slabinfo
2015 Delphix. All Rights Reserved

56

ORACLE-L list
Global email forum
Almost 20 years old now and still going strong
Anyone can subscribe and listen
Must ask moderator for rights to post

Subscribe via
http://www.freelists.org/list/oracle-l
Archives at
http://www.freelists.org/archive/oracle-l/
Past 11 years (back to Jan 2004) are archived

2015 Delphix. All Rights Reserved

57

SIG Meetings at Oracle OpenWorld


All meetings will be held in User Group
Pavilion, Meeting Room, Moscone South
Monday, October 26
IOUG Cloud Computing SIG Meet-Up: 10:00 a.m.11:00 a.m.
IOUG Oracle Enterprise Manager SIG: 5:00 p.m.6:00 p.m.
*Location: OTN Lounge, Moscone South*

Tuesday, October 27
IOUG IoT SIG: 10:30 a.m.11:30 a.m.
IOUG BIWA SIG: 11:30 a.m.12:30 p.m.
Wednesday, October 28
IOUG Exadata SIG: 10:30 a.m.11:30 a.m.
IOUG RAC SIG: 1:00 p.m.2:00 p.m.
IOUG Oracle 12c SIG: 2:00 p.m.3:00 p.m.
2015 Delphix. All Rights Reserved

Download a free trial


Email:
of Delphix
Go to http://delphix.com/
and click the

Questions?

tim.gorman@delphix.com
Blog: http://EvDBT.com/
Mobile: +1 (303) 885-4526

button

UGF-9957: Linux/UNIX Tools For The


Oracle DBA

2015 Delphix. All Rights Reserved

59

S-ar putea să vă placă și