Read without ads and support Scribd by becoming a Scribd Premium Reader.
Useful Unix commands for DBAs

Here are some useful Unix/Linux commands which you will find handy in your day-to-day life as an Oracle DBA. Most of these commands are just query commands and will not change / alter anything on the operating system. Commands whch can change / alter anything at operating system level are

denoted with
sign. However please use due diligence in using these commands. Please also
note that the output may differ depending on the version and flavor of Unix that you are using.
Do give your feedback, suggestions and contribution to improve this page.
Memory
Display total RAM (Memory) on the server

Tru64 Unix uerf \u2013r 300 | grep \u2013i mem
Solaris prtconf | grep \u2013i mem
Linux

free
HP-UX
swapinfo \u2013tm
AIX
lsdev \u2013C | grep mem
lsattr \u2013El <name from previous command>
$ lsdev -C | grep mem
Output on AIX
mem0
Available 00-00

Memory
$ lsattr -El mem0
size 1536 Total amount of physical memory in Mbytes False

goodsize 1536 Amount of usable physical memory in Mbytes False
Go top
Display paging utilization
lsps \u2013a (provides a snapshot of the current utilization of each of the paging spaces on a system)
Output on AIX
Page Space Physical Volume Volume Group Size %Used Active Auto Type
paging01 hdisk4
dbvg2
2560MB
9 yes yes lv
hd6
hdisk0
rootvg
512MB
42 yes yes lv
lsps -s (provides a summary of the total active paging space and its current utilization)
Output on AIX
Total Paging Space Percent Used
4096MB
1%
Go top
Display memory utilization on Linux
To read memory usage in Linux, please use "free" command. As you said, you may noticed that most

the memory had been used, here is the example,
# free
Output on Linux

total
used
free shared buffers cached
Mem:
26871344 15263128 11608216
0 374036 13635804
-/+ buffers/cache: 1253288 25618056
Swap: 54524600
0 54524600

"cached" memory basically are free to be used. The Linux philosophy is keeping resource idle/wasted as little as it can. Keeping the cache means that if something needs the same data again. You will notice the cached is very little during the system just rebooted, but it keeps growing if you leave it running for days.

If you want to know the memory used, please read the second line. The -/+ buffers/cache line shows how much memory is used and free from the perspective of the applications. So, for this example, we still have 25GB memory free to be used.

The bottom line is as far as swap is not being used (third line from the example), memory usage isn't
impacting
system
performance.
Refer
to
URL
for
more
information.
http://www.redhat.com/advice/tips/meminfo.html
Go top
Which process is using memory at O/S (AIX)
The following command displays the memory usage statistics for the top ten processes. If you do not
specify a number, it will display all the processes currently running in this system.
# svmon -Pau 10
Output on AIX
Pid
Command
Inuse
Pin
Pgspace 15012
maker4X.exe
4783
1174
4781
2750
X
4353
1178
5544
15706
dtwm
3257
1174
4003
17172
dtsession
2986
1174
3827
21150
dtterm
2941
1174
3697
17764
aixterm
2862
1174
3644
2910
dtterm
2813
1174
3705
19334
dtterm
2813
1174
3704
13664
dtterm
2804
1174
3706
17520
aixterm
2801
1174
3619
Pid: 15012
Command: maker4X.exe
Segid Type Description
Inuse Pin Pgspace Address Range
1572 pers /dev/hd3:62
0
0
0 0..-1
142 pers /dev/hd3:51
0
0
0 0..-1
1bde pers /dev/hd3:50
0
0
0 0..-1
2c1 pers /dev/hd3:49
1
0
0 0..7
9ab pers /dev/hd2:53289
1
0
0 0..0
404 work kernel extension
27 27
0 0..24580
1d9b work lib data
39
0
23 0..607
909 work shared library text 864
0
7 0..65535
5a3 work sreg[4]
9
0
12 0..32768
1096 work sreg[3]
32
0
32 0..32783
1b9d work private
1057
1 1219 0..1306 : 65307..65535
1af8 clnt
961
0
0 0..1716
0 work kernel
1792 1146 3488 0..32767 : 32768..65535

Pid 15012 is the process ID that has the highest memory usage. The Command indicates the command name, in this case maker4X.exe. The Inuse column (total number of pages in real memory from segments that are used by the process) shows 4783 pages (each page is 4 KB). The Pin column (total number of pages pinned from segments that are used by the process) shows 1174 pages. The Pgspace column (total number of paging-space pages that are used by the process) shows 4781 pages.

Go top
Displaying Allocated RAM Memory Segments in Unix
ipcs \u2013pmb (Inter process control system)
$ ipcs -pmb
Output on AIX
IPC status from /dev/mem as of Fri Aug 2 15:20:20 WAUST 2002
T
ID KEY
MODE
OWNER GROUP SEGSZ CPID LPID

Shared Memory:
m 131072 0x58000932 --rw-rw-rw- root system 134217728 6990 47580
m

1 0x0d003187 --rw-rw-rw- root system

1440 11872 27654
m 131074 0xffffffff --rw------- root system 104857600 45198 45198
m 2621443 0x05c17710 --rw-r----- crpor11i oradba 368291840 25196 29384
m 1310724 0x50942e5c --rw-r----- devor11i oradba 405147648 25450 46580

Go top
Identify all held RAM memory segments & release the RAM memory from Unix
ipcs \u2013pmb (To check for held memory)
Output on AIX
IPC status from /dev/mem as of Fri Aug 2 14:27:14 WAUST 2002
T
ID KEY
MODE
OWNER GROUP SEGSZ CPID LPID

Shared Memory:
m 131072 0x58000932 --rw-rw-rw- root system 134217728 6990 47580
m

1 0x0d003187 --rw-rw-rw- root system
1440 11872 7812

m 131074 0xffffffff --rw------- root system 104857600 45198 45198
m 2621443 0x05c17710 --rw-r----- crpor11i oradba 368291840 25196 39296
m 1310724 0x50942e5c --rw-r----- devor11i oradba 405147648 25450 39290

Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more