Showing posts with label UNIX. Show all posts
Showing posts with label UNIX. Show all posts

Tuesday, February 7, 2012

Adding numbers in a file

If you have a small file filled with numbers and are tasked to add all of them, you can do it with bc and paste:

cronos@olimpo:~$ cat file.txt
1|11
2|22
3|33
4|44
5|55
|
6|66
7|77
8|88
9|99

cronos@olimpo:~$ cat file.txt | cut -d '|' -f 1 | grep -v '^$' | paste -sd '+' - | bc
45

With cut you select the field to sum, with grep you select out empty fields, with paste you add at the end of each line a + sign, and with bc you do the addition.

But if you have a very big file this won't work; you can instead use awk:

cronos@olimpo:~$ cat file.txt | awk 'BEGIN {FS="|";OFMT="%.2f"} {a+=$1;b+=$2} END {print "First field:",a,"Second field:",b}'

First field: 45 Second field: 495

With FS you set the field delimiter and with OFMT you set the number format, in this case two decimal places with no scientific notation. With awk a nice extra is to be able to add two or more columns at the same time.

More information:

Sum of numbers in file - UNIX alternatives

Tuesday, October 25, 2011

Getting partition's size

Getting the size of a partition in Linux is very simple if you're logged in as root:

olimpo:~# fdisk -l /dev/sda

Disk /dev/sda: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xabd592d5

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1567 12586896 7 HPFS/NTFS
/dev/sda2 1568 2546 7863817+ 17 Hidden HPFS/NTFS
/dev/sda3 2547 2796 2008125 82 Linux swap / Solaris
/dev/sda4 2797 19452 133789320 83 Linux

But it might be that you're just a DBA with access only to some partitions instead of the whole disk, and you got this server with no idea about partition sizes. If this is the case, then you can still know the size of your partitions with fdisk:

oracle@olimpo:/myASM$ /sbin/fdisk -l /dev/sda
Cannot open /dev/sda
oracle@olimpo:/myASM$ ls -la
total 8
drwxr-xr-x 2 oracle dba 4096 Oct 25 12:15 .
drwxr-xr-x 113 root root 4096 Oct 25 12:15 ..
brw-rw---- 1 oracle dba 8, 4 Oct 3 08:44 sda4
oracle@olimpo:/myASM$ /sbin/fdisk -s sda4
133789320

In Solaris is a bit different as the -s flag is not the same as in Linux:

oracle@myserver:/myASM$ ls -la
total 4
drwxr-xr-x 2 oracle dba 512 Oct 22 2008 .
drwxr-xr-x 38 root root 1024 Oct 18 16:57 ..
crw-r--r-- 1 oracle dba 32, 24 Oct 22 2008 disk1
crw-r--r-- 1 oracle dba 32, 25 Oct 25 09:31 disk2
crw-r--r-- 1 oracle dba 32, 26 Oct 22 2008 disk3

oracle@myserver:/myASM$ /sbin/fdisk -Rg disk2
* Label geometry for device disk2
* PCYL NCYL ACYL BCYL NHEAD NSECT SECSIZ
35135 35135 2 0 64 255 512

oracle@myserver:/myASM$ echo "(35135*64*255*512)/1024/1024"|bc
279982

With the last command you calculate the partition size in megabytes.

Tuesday, October 18, 2011

Playing with ssh, xauth and DISPLAY

If you need to connect by ssh to an UNIX server and later change user (by means of su or otherwise), but you want to keep X11 forwarding to your screen, then look at this example using xauth and DISPLAY. The key is getting cookie information with xauth list and identifying the screen opened by ssh (usually screen 10 of the server), and after changing user pasting the whole line after the xauth add command:

myuser@olimpo:~$ ssh -X -l myuser myserver1
Password:
Last login: Mon Oct 17 18:00:46 2011 from olimpo
$ xclock
$ xauth list
myserver1.mynet.net:10 MIT-MAGIC-COOKIE-1 eb3713bfc73799efede775bf1a04cb19
$ su - oracle
Password:
myserver1:/home/oracle> xclock
Error: Can't open display:
myserver1:/home/oracle> xauth add myserver1.mynet.net:10 MIT-MAGIC-COOKIE-1 eb3713bfc73799efede775bf1a04cb19
myserver1:/home/oracle> export DISPLAY=myserver1.mynet.net:10
myserver1:/home/oracle> xclock
myserver1:/home/oracle> uname -n
myserver1
myserver1:/home/oracle>

The uname -n command from above example was an extra for the following case: this time you try to login to other server but you get a xauth error message and are unable to forward any X11 window:

myuser@olimpo:~$ ssh -X -l oracle myserver2
Password:
/usr/openwin/bin/xauth: (stdin):1: bad display name "unix:10.0" in "add" command

:/home/oracle> xclock
X11 connection rejected because of wrong authentication.
X connection to localhost:10.0 broken (explicit kill or server shutdown).
:/home/oracle> echo $DISPLAY
localhost:10.0
:/home/oracle> uname -n

:/home/oracle>

As you might have noticed the DISPLAY variable seems correct, but there is a problem with the host name: there is no host name set; that's why xauth fails at login time. You have to set properly the host name according to your UNIX version in order to correct this problem.

More information:

Getting X11 forwarding through ssh working after running su

Thursday, October 13, 2011

Getting HP-UX system information

If you need to check information about your HP-UX server like hardware and filesystems, or even information about a high availability cluster (having root access), you can use the lanscan, ioscan, bdf and cmviewcl commands. Or if you're looking for information about memory usage you can check this post.

$ /usr/sbin/lanscan
Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI
Path Address In# State NamePPA ID Type Support Mjr#
0/1/2/0 0x001635700001 0 UP lan0 snap0 1 ETHER Yes 119
0/3/1/0/6/0 0x001635300002 1 UP lan1 snap1 2 ETHER Yes 119
0/4/1/0/6/0 0x001635300003 2 UP lan2 snap2 3 ETHER Yes 119
$ /usr/sbin/ioscan -fnk
Class I H/W Path Driver S/W State H/W Type Description
=============================================================================
root 0 root CLAIMED BUS_NEXUS
ioa 0 0 sba CLAIMED BUS_NEXUS System Bus Adapter (880)
ba 0 0/0 lba CLAIMED BUS_NEXUS Local PCI-X Bus Adapter (783)
usb 0 0/0/1/0 hcd CLAIMED INTERFACE NEC USB Interface
usbhub 0 0/0/1/0.1 hub CLAIMED DEVICE USB Root Hub
usb 1 0/0/1/1 hcd CLAIMED INTERFACE NEC USB Interface
usbhub 1 0/0/1/1.1 hub CLAIMED DEVICE USB Root Hub
/dev/hub
usb 2 0/0/1/2 ehci CLAIMED INTERFACE NEC USB Interface
sideba 0 0/0/2/0 side_ba CLAIMED INTERFACE CMD IDE controller
ext_bus 0 0/0/2/0.0 side CLAIMED INTERFACE IDE Primary Channel
target 0 0/0/2/0.0.0 tgt CLAIMED DEVICE
disk 0 0/0/2/0.0.0.0 sdisk CLAIMED DEVICE TEAC DV-28E-N
/dev/dsk/c0t0d0 /dev/rdsk/c0t0d0
target 1 0/0/2/0.0.7 tgt CLAIMED DEVICE
ctl 0 0/0/2/0.0.7.0 sctl CLAIMED DEVICE Initiator
/dev/rscsi/c0t7d0
ext_bus 1 0/0/2/0.1 side CLAIMED INTERFACE IDE Secondary Channel
target 2 0/0/2/0.1.7 tgt CLAIMED DEVICE
ctl 1 0/0/2/0.1.7.0 sctl CLAIMED DEVICE Initiator
/dev/rscsi/c1t7d0
ba 1 0/1 lba CLAIMED BUS_NEXUS Local PCI-X Bus Adapter (783)
ext_bus 2 0/1/1/0 c8xx CLAIMED INTERFACE SCSI C1010 Ultra160 Wide LVD
target 3 0/1/1/0.0 tgt CLAIMED DEVICE
disk 2 0/1/1/0.0.0 sdisk CLAIMED DEVICE HP 73.4GMAX3073NC
/dev/dsk/c2t0d0 /dev/rdsk/c2t0d0
target 4 0/1/1/0.1 tgt CLAIMED DEVICE
disk 1 0/1/1/0.1.0 sdisk CLAIMED DEVICE HP 73.4GMAX3073NC
/dev/dsk/c2t1d0 /dev/rdsk/c2t1d0
target 5 0/1/1/0.7 tgt CLAIMED DEVICE
ctl 2 0/1/1/0.7.0 sctl CLAIMED DEVICE Initiator
/dev/rscsi/c2t7d0
ext_bus 3 0/1/1/1 c8xx CLAIMED INTERFACE SCSI C1010 Ultra160 Wide LVD
target 6 0/1/1/1.7 tgt CLAIMED DEVICE
ctl 3 0/1/1/1.7.0 sctl CLAIMED DEVICE Initiator
/dev/rscsi/c3t7d0
lan 0 0/1/2/0 igelan CLAIMED INTERFACE HP PCI 1000Base-T Core
ba 2 0/2 lba CLAIMED BUS_NEXUS Local PCI-X Bus Adapter (783)
ba 3 0/3 lba CLAIMED BUS_NEXUS Local PCI-X Bus Adapter (783)
ba 4 0/3/1/0 PCItoPCI CLAIMED BUS_NEXUS PCItoPCI Bridge
fc 0 0/3/1/0/4/0 fcd CLAIMED INTERFACE HP 2Gb PCI/PCI-X Fibre Channel FC/GigE Dual Port Combo Adapter
/dev/fcd0
fcp 0 0/3/1/0/4/0.8 fcd_fcp CLAIMED INTERFACE FCP Protocol Adapter
ext_bus 7 0/3/1/0/4/0.8.0.2.0 fcd_vbus CLAIMED INTERFACE FCP Array Interface
target 7 0/3/1/0/4/0.8.0.2.0.0 tgt CLAIMED DEVICE
disk 89 0/3/1/0/4/0.8.0.2.0.0.0 sdisk CLAIMED DEVICE COMPAQ MSA1000 VOLUME
/dev/dsk/c7t0d0 /dev/rdsk/c7t0d0
disk 8 0/3/1/0/4/0.8.0.2.0.0.1 sdisk CLAIMED DEVICE COMPAQ MSA1000 VOLUME
/dev/dsk/c7t0d1 /dev/rdsk/c7t0d1
disk 23 0/3/1/0/4/0.8.0.2.0.0.2 sdisk CLAIMED DEVICE COMPAQ MSA1000 VOLUME
/dev/dsk/c7t0d2 /dev/rdsk/c7t0d2
disk 24 0/3/1/0/4/0.8.0.2.0.0.3 sdisk CLAIMED DEVICE COMPAQ MSA1000 VOLUME
/dev/dsk/c7t0d3 /dev/rdsk/c7t0d3
ext_bus 4 0/3/1/0/4/0.8.0.255.0 fcd_vbus CLAIMED INTERFACE FCP Device Interface
target 8 0/3/1/0/4/0.8.0.255.0.2 tgt CLAIMED DEVICE
ctl 23 0/3/1/0/4/0.8.0.255.0.2.0 sctl CLAIMED DEVICE COMPAQ MSA1000
/dev/rscsi/c4t2d0
lan 1 0/3/1/0/6/0 igelan CLAIMED INTERFACE HP A9784-60002 PCI/PCI-X 1000Base-T FC/GigE Combo Adapter
ba 5 0/4 lba CLAIMED BUS_NEXUS Local PCI-X Bus Adapter (783)
ba 6 0/4/1/0 PCItoPCI CLAIMED BUS_NEXUS PCItoPCI Bridge
fc 1 0/4/1/0/4/0 fcd CLAIMED INTERFACE HP 2Gb PCI/PCI-X Fibre Channel FC/GigE Dual Port Combo Adapter
/dev/fcd1
fcp 1 0/4/1/0/4/0.8 fcd_fcp CLAIMED INTERFACE FCP Protocol Adapter
ext_bus 6 0/4/1/0/4/0.8.0.1.0 fcd_vbus CLAIMED INTERFACE FCP Array Interface
target 9 0/4/1/0/4/0.8.0.1.0.0 tgt CLAIMED DEVICE
disk 19 0/4/1/0/4/0.8.0.1.0.0.0 sdisk CLAIMED DEVICE COMPAQ MSA1000 VOLUME
/dev/dsk/c6t0d0 /dev/rdsk/c6t0d0
disk 20 0/4/1/0/4/0.8.0.1.0.0.1 sdisk CLAIMED DEVICE COMPAQ MSA1000 VOLUME
/dev/dsk/c6t0d1 /dev/rdsk/c6t0d1
disk 21 0/4/1/0/4/0.8.0.1.0.0.2 sdisk CLAIMED DEVICE COMPAQ MSA1000 VOLUME
/dev/dsk/c6t0d2 /dev/rdsk/c6t0d2
disk 22 0/4/1/0/4/0.8.0.1.0.0.3 sdisk CLAIMED DEVICE COMPAQ MSA1000 VOLUME
/dev/dsk/c6t0d3 /dev/rdsk/c6t0d3
ext_bus 5 0/4/1/0/4/0.8.0.255.0 fcd_vbus CLAIMED INTERFACE FCP Device Interface
target 10 0/4/1/0/4/0.8.0.255.0.1 tgt CLAIMED DEVICE
ctl 6 0/4/1/0/4/0.8.0.255.0.1.0 sctl CLAIMED DEVICE COMPAQ MSA1000
/dev/rscsi/c5t1d0
lan 2 0/4/1/0/6/0 igelan CLAIMED INTERFACE HP A9784-60002 PCI/PCI-X 1000Base-T FC/GigE Combo Adapter
ba 7 0/6 lba CLAIMED BUS_NEXUS Local PCI-X Bus Adapter (783)
ba 8 0/7 lba CLAIMED BUS_NEXUS Local PCI-X Bus Adapter (783)
tty 0 0/7/1/0 asio0 CLAIMED INTERFACE PCI SimpleComm (103c1290)
/dev/diag/mux0 /dev/mux0 /dev/tty0p0
tty 1 0/7/1/1 asio0 CLAIMED INTERFACE PCI Serial (103c1048)
/dev/GSPdiag1 /dev/diag/mux1 /dev/mux1 /dev/tty1p0 /dev/tty1p2 /dev/tty1p4
unknown -1 0/7/2/0 UNCLAIMED UNKNOWN PCI Display (10025159)
memory 0 8 memory CLAIMED MEMORY Memory
ipmi 0 16 ipmi CLAIMED INTERFACE IPMI Controller
/dev/ipmi
processor 0 128 processor CLAIMED PROCESSOR Processor
processor 1 129 processor CLAIMED PROCESSOR Processor
$ bdf -i
Filesystem kbytes used avail %used iused ifree %iuse Mounted on
/dev/vg00/lvol3 1048576 799824 246928 76% 2888 7768 27% /
/dev/vg00/lvol1 511672 54328 406176 12% 65 50111 0% /stand
/dev/vg00/lvol8 8388608 1890448 6447536 23% 23785 203063 10% /var
/dev/vg00/lvol7 2097152 1575968 517184 75% 31502 16274 66% /usr
/dev/vg00/lvol4 1048576 768632 278256 73% 357 8731 4% /tmp
/dev/vg00/lvol6 4194304 2195952 1982784 53% 32112 62448 34% /opt
/dev/vg00/lvol5 2097152 669912 1416104 32% 1512 44600 3% /home
# cmviewcl -v

CLUSTER STATUS
my-cluster up

NODE STATUS STATE
node-01 up running

Network_Parameters:
INTERFACE STATUS PATH NAME
PRIMARY up 0/1/2/0 lan0
PRIMARY up 0/3/1/0/6/0 lan1
STANDBY up 0/4/1/0/6/0 lan2

PACKAGE STATUS STATE AUTO_RUN NODE
mypkg up running enabled node-01

Policy_Parameters:
POLICY_NAME CONFIGURED_VALUE
Failover configured_node
Failback manual

Script_Parameters:
ITEM STATUS MAX_RESTARTS RESTARTS NAME
Service up 3 0 MYMONITOR
Subnet up 10.0.1.0

Node_Switching_Parameters:
NODE_TYPE STATUS SWITCHING NAME
Primary up enabled node-01 (current)
Alternate up enabled node-02

NODE STATUS STATE
node-02 up running

Network_Parameters:
INTERFACE STATUS PATH NAME
PRIMARY up 0/1/2/0 lan0
PRIMARY up 0/3/1/0/6/0 lan1
STANDBY up 0/4/1/0/6/0 lan2

Thursday, October 6, 2011

Connect from Linux to an X server

This trick is a very simple but useful one: if you want to open an X session in your Linux computer from other UNIX computer, like if you were in front of its console, then you can run as root a command like this:

X -query unixserver :1

This way you're telling X to connect to the greeter running in unixserver and display it in graphic console number one (you might be running an X session in :0 already). In order to work this the greeter in the UNIX computer must be running and listening for connections; for example, it would be xdm, kdm or gdm in Linux, dtlogin in HP-UX and so on.

Friday, July 22, 2011

Getting basic Solaris server information

If you need to know basic software, hardware and load information about a Solaris server then you can use the uname, prstat, psrinfo and prtdiag commands as shown below:

myserver% uname -a
SunOS myserver 5.10 Generic_127127-11 sun4v sparc SUNW,SPARC-Enterprise-T5220

myserver% prstat
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
710 root 5504K 2944K sleep 50 0 441:06:31 1.6% inetd/4
1 root 2360K 1168K sleep 59 0 12:17:41 0.7% init/1
26523 oracle 1721M 1700M sleep 59 0 1:37:00 0.4% oracle/1
155 root 6592K 4712K sleep 59 0 88:18:11 0.3% nscd/44
7721 oracle 573M 496M sleep 59 0 0:45:36 0.2% java/98
7110 oracle 1715M 1693M sleep 59 0 0:34:06 0.2% oracle/1
26289 oracle 491M 300M sleep 59 0 0:42:44 0.1% java/44
1500 myuser 1717M 1701M sleep 59 0 0:11:17 0.1% oracle/1
9 root 11M 7992K sleep 59 0 25:23:49 0.1% svc.configd/16
715 root 4424K 2152K sleep 59 0 22:31:24 0.1% syslogd/19
7140 oracle 1770M 1749M sleep 59 0 0:08:52 0.1% oracle/1
8654 myuser 48M 43M sleep 59 0 2:07:15 0.1% uv_scan/1
5707 myuser 1718M 1698M sleep 59 0 1:46:25 0.1% oracle/2
28243 oracle 1715M 1699M sleep 59 0 0:00:04 0.1% oracle/1
8672 myuser 19M 16M sleep 59 0 1:12:42 0.1% uvkd/1
7150 oracle 1714M 1694M sleep 59 0 0:12:46 0.1% oracle/1
8214 root 1416K 936K sleep 53 0 9:09:35 0.1% init.cssd/1
4483 oracle 161M 117M sleep 59 0 0:15:32 0.0% java/21
17881 root 5864K 3704K sleep 50 0 0:00:00 0.0% in.ftpd/1
17880 oracle 2088K 1936K cpu2 58 0 0:00:00 0.0% prstat/1
7092 oracle 1712M 1690M sleep 101 - 0:07:44 0.0% oracle/1
Total: 172 processes, 774 lwps, load averages: 3.92, 2.48, 2.17

myserver% psrinfo -pv
The physical processor has 64 virtual processors (0-63)
UltraSPARC-T2 (cpuid 0 clock 1165 MHz)

myserver% prtdiag
System Configuration: Sun Microsystems sun4v SPARC Enterprise T5220
Memory size: 65408 Megabytes

================================ Virtual CPUs ================================


CPU ID Frequency Implementation Status
------ --------- ---------------------- -------
0 1165 MHz SUNW,UltraSPARC-T2 on-line
1 1165 MHz SUNW,UltraSPARC-T2 on-line
2 1165 MHz SUNW,UltraSPARC-T2 on-line
3 1165 MHz SUNW,UltraSPARC-T2 on-line
4 1165 MHz SUNW,UltraSPARC-T2 on-line
5 1165 MHz SUNW,UltraSPARC-T2 on-line
6 1165 MHz SUNW,UltraSPARC-T2 on-line
7 1165 MHz SUNW,UltraSPARC-T2 on-line
8 1165 MHz SUNW,UltraSPARC-T2 on-line
9 1165 MHz SUNW,UltraSPARC-T2 on-line
10 1165 MHz SUNW,UltraSPARC-T2 on-line
11 1165 MHz SUNW,UltraSPARC-T2 on-line
12 1165 MHz SUNW,UltraSPARC-T2 on-line
13 1165 MHz SUNW,UltraSPARC-T2 on-line
14 1165 MHz SUNW,UltraSPARC-T2 on-line
15 1165 MHz SUNW,UltraSPARC-T2 on-line
16 1165 MHz SUNW,UltraSPARC-T2 on-line
17 1165 MHz SUNW,UltraSPARC-T2 on-line
18 1165 MHz SUNW,UltraSPARC-T2 on-line
19 1165 MHz SUNW,UltraSPARC-T2 on-line
20 1165 MHz SUNW,UltraSPARC-T2 on-line
21 1165 MHz SUNW,UltraSPARC-T2 on-line
22 1165 MHz SUNW,UltraSPARC-T2 on-line
23 1165 MHz SUNW,UltraSPARC-T2 on-line
24 1165 MHz SUNW,UltraSPARC-T2 on-line
25 1165 MHz SUNW,UltraSPARC-T2 on-line
26 1165 MHz SUNW,UltraSPARC-T2 on-line
27 1165 MHz SUNW,UltraSPARC-T2 on-line
28 1165 MHz SUNW,UltraSPARC-T2 on-line
29 1165 MHz SUNW,UltraSPARC-T2 on-line
30 1165 MHz SUNW,UltraSPARC-T2 on-line
31 1165 MHz SUNW,UltraSPARC-T2 on-line
32 1165 MHz SUNW,UltraSPARC-T2 on-line
33 1165 MHz SUNW,UltraSPARC-T2 on-line
34 1165 MHz SUNW,UltraSPARC-T2 on-line
35 1165 MHz SUNW,UltraSPARC-T2 on-line
36 1165 MHz SUNW,UltraSPARC-T2 on-line
37 1165 MHz SUNW,UltraSPARC-T2 on-line
38 1165 MHz SUNW,UltraSPARC-T2 on-line
39 1165 MHz SUNW,UltraSPARC-T2 on-line
40 1165 MHz SUNW,UltraSPARC-T2 on-line
41 1165 MHz SUNW,UltraSPARC-T2 on-line
42 1165 MHz SUNW,UltraSPARC-T2 on-line
43 1165 MHz SUNW,UltraSPARC-T2 on-line
44 1165 MHz SUNW,UltraSPARC-T2 on-line
45 1165 MHz SUNW,UltraSPARC-T2 on-line
46 1165 MHz SUNW,UltraSPARC-T2 on-line
47 1165 MHz SUNW,UltraSPARC-T2 on-line
48 1165 MHz SUNW,UltraSPARC-T2 on-line
49 1165 MHz SUNW,UltraSPARC-T2 on-line
50 1165 MHz SUNW,UltraSPARC-T2 on-line
51 1165 MHz SUNW,UltraSPARC-T2 on-line
52 1165 MHz SUNW,UltraSPARC-T2 on-line
53 1165 MHz SUNW,UltraSPARC-T2 on-line
54 1165 MHz SUNW,UltraSPARC-T2 on-line
55 1165 MHz SUNW,UltraSPARC-T2 on-line
56 1165 MHz SUNW,UltraSPARC-T2 on-line
57 1165 MHz SUNW,UltraSPARC-T2 on-line
58 1165 MHz SUNW,UltraSPARC-T2 on-line
59 1165 MHz SUNW,UltraSPARC-T2 on-line
60 1165 MHz SUNW,UltraSPARC-T2 on-line
61 1165 MHz SUNW,UltraSPARC-T2 on-line
62 1165 MHz SUNW,UltraSPARC-T2 on-line
63 1165 MHz SUNW,UltraSPARC-T2 on-line

======================= Physical Memory Configuration ========================
Segment Table:
--------------------------------------------------------------
Base Segment Interleave Bank Contains
Address Size Factor Size Modules
--------------------------------------------------------------
0x0 64 GB 8 8 GB MB/CMP0/BR0/CH0/D0
MB/CMP0/BR0/CH1/D0
8 GB MB/CMP0/BR0/CH0/D1
MB/CMP0/BR0/CH1/D1
8 GB MB/CMP0/BR1/CH0/D0
MB/CMP0/BR1/CH1/D0
8 GB MB/CMP0/BR1/CH0/D1
MB/CMP0/BR1/CH1/D1
8 GB MB/CMP0/BR2/CH0/D0
MB/CMP0/BR2/CH1/D0
8 GB MB/CMP0/BR2/CH0/D1
MB/CMP0/BR2/CH1/D1
8 GB MB/CMP0/BR3/CH0/D0
MB/CMP0/BR3/CH1/D0
8 GB MB/CMP0/BR3/CH0/D1
MB/CMP0/BR3/CH1/D1


========================= IO Configuration =========================

IO
Location Type Slot Path Name Model
----------- ----- ---- --------------------------------------------- ------------------------- ---------
MB/PCIE PCIE MB /pci@0/pci@0/pci@1/pci@0/pci@1/pci@0 pci-pciexclass,060400
MB/NET0 PCIE MB /pci@0/pci@0/pci@1/pci@0/pci@2/network@0 network-pciex8086,105e
MB/NET1 PCIE MB /pci@0/pci@0/pci@1/pci@0/pci@2/network@0,1 network-pciex8086,105e
MB/NET2 PCIE MB /pci@0/pci@0/pci@1/pci@0/pci@3/network@0 network-pciex8086,105e
MB/NET3 PCIE MB /pci@0/pci@0/pci@1/pci@0/pci@3/network@0,1 network-pciex8086,105e
MB/PCIE PCIE MB /pci@0/pci@0/pci@2/scsi@0 scsi-pciex1000,58 LSI,1068E
MB/PCIE1 PCIE 1 /pci@0/pci@0/pci@8/pci@0/pci@1/SUNW,qlc@0 SUNW,qlc-pciex1077,2432 QLE2460
MB/PCIE4 PCIE 4 /pci@0/pci@0/pci@8/pci@0/pci@2/network@0 network-pciex108e,abcd SUNW,pcie+
MB/PCIE4 PCIE 4 /pci@0/pci@0/pci@8/pci@0/pci@2/network@0,1 network-pciex108e,abcd SUNW,pcie+
MB/PCIE4 PCIE 4 /pci@0/pci@0/pci@8/pci@0/pci@2/network@0,2 network-pciex108e,abcd SUNW,pcie+
MB/PCIE4 PCIE 4 /pci@0/pci@0/pci@8/pci@0/pci@2/network@0,3 network-pciex108e,abcd SUNW,pcie+
MB/PCIE5 PCIE 5 /pci@0/pci@0/pci@8/pci@0/pci@8/pci@0 pci-pciex10b5,8114
MB/PCIE2 PCIE 2 /pci@0/pci@0/pci@9/SUNW,qlc@0 SUNW,qlc-pciex1077,2432 QLE2460

========================= HW Revisions =======================================

System PROM revisions:
----------------------
OBP 4.30.6 2009/12/01 12:40

IO ASIC revisions:
------------------
Location Path Device Revision
-------------------- --------------------------------------------- ------------------------------ ---------
MB/PCI-SWITCH0 /pci@0/pci@0 pciex10b5,8533.aa 170
MB/PCI-SWITCH2 /pci@0/pci@0/pci@1/pci@0 pciex10b5,8517.ac 172
MB/PCI-SWITCH1 /pci@0/pci@0/pci@8/pci@0 pciex10b5,8533.aa 170
MB/GBE0 /pci@0/pci@0/pci@1/pci@0/pci@2/network@0 pciex8086,105e.108e.105e.6 6
MB/GBE0 /pci@0/pci@0/pci@1/pci@0/pci@2/network@0,1 pciex8086,105e.108e.105e.6 6
MB/GBE1 /pci@0/pci@0/pci@1/pci@0/pci@3/network@0 pciex8086,105e.108e.105e.6 6
MB/GBE1 /pci@0/pci@0/pci@1/pci@0/pci@3/network@0,1 pciex8086,105e.108e.105e.6 6
MB/SAS-SATA-HBA /pci@0/pci@0/pci@2/scsi@0 pciex1000,58.1000.1000.4 4

============================ Environmental Status ============================
Fan sensors:
------------------------------------------------------------
Location Sensor Status
------------------------------------------------------------
SYS/FANBD0/FM0/F0 TACH ok
SYS/FANBD0/FM0/F1 TACH ok
SYS/FANBD0/FM1/F0 TACH ok
SYS/FANBD0/FM1/F1 TACH ok
SYS/FANBD0/FM2/F0 TACH ok
SYS/FANBD0/FM2/F1 TACH ok

Fan indicators:
------------------------------------------------------------
Location Sensor Condition
------------------------------------------------------------
SYS/PS0 FAN_FAULT ok
SYS/PS1 FAN_FAULT ok

Temperature sensors:
------------------------------------------------------------
Location Sensor Status
------------------------------------------------------------
SYS/MB T_AMB ok
SYS/MB/CMP0/BR0/CH0/D0 T_AMB ok
SYS/MB/CMP0/BR0/CH0/D1 T_AMB ok
SYS/MB/CMP0/BR0/CH1/D0 T_AMB ok
SYS/MB/CMP0/BR0/CH1/D1 T_AMB ok
SYS/MB/CMP0/BR1/CH0/D0 T_AMB ok
SYS/MB/CMP0/BR1/CH0/D1 T_AMB ok
SYS/MB/CMP0/BR1/CH1/D0 T_AMB ok
SYS/MB/CMP0/BR1/CH1/D1 T_AMB ok
SYS/MB/CMP0/BR2/CH0/D0 T_AMB ok
SYS/MB/CMP0/BR2/CH0/D1 T_AMB ok
SYS/MB/CMP0/BR2/CH1/D0 T_AMB ok
SYS/MB/CMP0/BR2/CH1/D1 T_AMB ok
SYS/MB/CMP0/BR3/CH0/D0 T_AMB ok
SYS/MB/CMP0/BR3/CH0/D1 T_AMB ok
SYS/MB/CMP0/BR3/CH1/D0 T_AMB ok
SYS/MB/CMP0/BR3/CH1/D1 T_AMB ok
SYS/MB/CMP0 T_TCORE ok
SYS/MB/CMP0 T_BCORE ok

Temperature indicators:
------------------------------------------------------------
Location Indicator Condition
------------------------------------------------------------
SYS/PS0 TEMP_FAULT ok
SYS/PS1 TEMP_FAULT ok

Current sensors:
------------------------------------------------------------
Location Sensor Status
------------------------------------------------------------
SYS/PS0 I_IN_MAIN ok
SYS/PS0 I_IN_LIMIT ok
SYS/PS0 I_OUT_MAIN ok
SYS/PS0 I_OUT_LIMIT ok
SYS/PS1 I_IN_MAIN ok
SYS/PS1 I_IN_LIMIT ok
SYS/PS1 I_OUT_MAIN ok
SYS/PS1 I_OUT_LIMIT ok

Current indicators:
------------------------------------------------------------
Location Indicator Condition
------------------------------------------------------------
SYS/MB I_USB0 ok
SYS/MB I_USB1 ok
SYS/PS0 CUR_FAULT ok
SYS/PS1 CUR_FAULT ok

Voltage sensors:
------------------------------------------------------------
Location Sensor Status
------------------------------------------------------------
SYS/MB V_VMEML ok
SYS/MB V_VMEMR ok
SYS/MB V_+3V3_STBY ok
SYS/MB V_VCORE ok
SYS/MB V_+3V3_MAIN ok
SYS/MB V_VDDIO ok
SYS/MB V_+12V0_MAIN ok
SYS/MB V_VBAT ok
SYS/PS0 V_IN_MAIN ok
SYS/PS0 V_OUT_MAIN ok
SYS/PS1 V_IN_MAIN ok
SYS/PS1 V_OUT_MAIN ok

Voltage indicators:
------------------------------------------------------------
Location Indicator Condition
------------------------------------------------------------
SYS/MB VCORE_POK ok
SYS/MB VMEML_POK ok
SYS/MB VMEMR_POK ok
SYS/PS0 AC_POK ok
SYS/PS0 DC_POK ok
SYS/PS0 VOLT_FAULT ok
SYS/PS1 AC_POK ok
SYS/PS1 DC_POK ok
SYS/PS1 VOLT_FAULT ok

LEDs:
------------------------------------------------------------
Location LED State
------------------------------------------------------------
SYS SERVICE off
SYS LOCATE off
SYS ACT steady
SYS PS_FAULT off
SYS TEMP_FAULT off
SYS FAN_FAULT off
SYS/MB/CMP0/BR0/CH0/D0 SERVICE off
SYS/MB/CMP0/BR0/CH0/D1 SERVICE off
SYS/MB/CMP0/BR0/CH1/D0 SERVICE off
SYS/MB/CMP0/BR0/CH1/D1 SERVICE off
SYS/MB/CMP0/BR1/CH0/D0 SERVICE off
SYS/MB/CMP0/BR1/CH0/D1 SERVICE off
SYS/MB/CMP0/BR1/CH1/D0 SERVICE off
SYS/MB/CMP0/BR1/CH1/D1 SERVICE off
SYS/MB/CMP0/BR2/CH0/D0 SERVICE off
SYS/MB/CMP0/BR2/CH0/D1 SERVICE off
SYS/MB/CMP0/BR2/CH1/D0 SERVICE off
SYS/MB/CMP0/BR2/CH1/D1 SERVICE off
SYS/MB/CMP0/BR3/CH0/D0 SERVICE off
SYS/MB/CMP0/BR3/CH0/D1 SERVICE off
SYS/MB/CMP0/BR3/CH1/D0 SERVICE off
SYS/MB/CMP0/BR3/CH1/D1 SERVICE off
SYS/HDD0 SERVICE off
SYS/HDD0 OK2RM off
SYS/HDD1 SERVICE off
SYS/HDD1 OK2RM off
SYS/HDD2 SERVICE off
SYS/HDD2 OK2RM off
SYS/HDD3 SERVICE off
SYS/HDD3 OK2RM off
SYS/HDD4 SERVICE off
SYS/HDD4 OK2RM off
SYS/HDD5 SERVICE off
SYS/HDD5 OK2RM off
SYS/HDD6 SERVICE off
SYS/HDD6 OK2RM off
SYS/HDD7 SERVICE off
SYS/HDD7 OK2RM off
SYS/FANBD0/FM0 SERVICE off
SYS/FANBD0/FM1 SERVICE off
SYS/FANBD0/FM2 SERVICE off

============================ FRU Status ============================
Location Name Status
------------------------------------------------------
SYS MB enabled
SYS/MB RISER0 enabled
SYS/MB RISER1 enabled
SYS/MB RISER2 enabled
SYS/MB SCC_NVRAM enabled
SYS/MB/CMP0/BR0/CH0 D0 enabled
SYS/MB/CMP0/BR0/CH0 D1 enabled
SYS/MB/CMP0/BR0/CH1 D0 enabled
SYS/MB/CMP0/BR0/CH1 D1 enabled
SYS/MB/CMP0/BR1/CH0 D0 enabled
SYS/MB/CMP0/BR1/CH0 D1 enabled
SYS/MB/CMP0/BR1/CH1 D0 enabled
SYS/MB/CMP0/BR1/CH1 D1 enabled
SYS/MB/CMP0/BR2/CH0 D0 enabled
SYS/MB/CMP0/BR2/CH0 D1 enabled
SYS/MB/CMP0/BR2/CH1 D0 enabled
SYS/MB/CMP0/BR2/CH1 D1 enabled
SYS/MB/CMP0/BR3/CH0 D0 enabled
SYS/MB/CMP0/BR3/CH0 D1 enabled
SYS/MB/CMP0/BR3/CH1 D0 enabled
SYS/MB/CMP0/BR3/CH1 D1 enabled
SYS HDD0 enabled
SYS HDD1 enabled
SYS HDD2 enabled
SYS HDD3 enabled
SYS HDD4 enabled
SYS HDD5 enabled
SYS HDD6 enabled
SYS HDD7 enabled
SYS PDB enabled
SYS SASBP enabled
SYS DVD enabled
SYS USBBD enabled
SYS FANBD0 enabled
SYS/FANBD0 FM0 enabled
SYS/FANBD0 FM1 enabled
SYS/FANBD0 FM2 enabled
SYS FANBD1 enabled
SYS PS0 enabled
SYS PS1 enabled

============================ FW Version ============================
Version
------------------------------------------------------------
Sun System Firmware 7.2.7.d 2010/02/02 17:25


====================== System PROM revisions =======================
Version
------------------------------------------------------------
OBP 4.30.6 2009/12/01 12:40

Chassis Serial Number
---------------------
ABC01234JN

Monday, June 20, 2011

Copying files between servers with compression

You may have to copy very big files or file systems between servers sometimes, and the more you optimize this copy the faster you will transfer the files with less computer resources usage.

You might think that scp alone would do a good job, but without compression you may be wasting bandwith and time (talking about copying file systems of hundreds of gigabytes between servers far away one of the other). But if you have a lot of disc space available, why not to compress the file system first and then transfer it? Well, because compressing big file systems takes a lot of time and your disc I/O is severely degraded (the server reads a file and tries to write it compressed at the same time); you might be render your server practically unusable while compressing big files, at least in AIX.

But you can make a backup, compress it and send it to the other server, uncompressing it and writing just the files you want to transfer (not writing compressed files on disk at any time), compressing it on the fly with pipes. To this end, you may write this little script and put it in an appropriate path in the source server:

tar -cf - $1 | compress -c

Then, if you named this script mycompressedtar for example, you can transfer files or directories to your target server this way:

otheruser@targetsrv> ssh -l myuser sourcesrv /path/mycompressedtar /some/dir | uncompress -c | tar -xf -

If you issue this command at your target server, you will copy /some/dir from source server to the path where you stand at execution time; of course you have to have access to /some/dir with the myuser account.

But some times you have few but very big files (like Oracle datafiles), and you cannot transfer them with tar without getting an error in AIX; in that case you can just transfer file by file with this little script:

cat $1 | compress -c

Then, if you named this script mycompress for example, you can copy one file to your target server this way:

otheruser@targetsrv> ssh -l myuser sourcesrv /path/mycompress /some/file | uncompress -c > somefile

If you issue this command at your target server, you will copy file from source server to the path where you stand at execution time and name it somefile; you can use the same name as the source file or a different one.

But we're talking about different servers, and the files are so valuable we cannot afford to change a single byte. How can we be sure the files are exactly the same? In AIX, you can use the cksum command:

myuser@sourcesrv> cksum myfile.txt
1656934735 2229 myfile.txt

===================================

otheruser@targetsrv> cksum myfile.txt
1656934735 2229 myfile.txt

This way you'll be sure both files are equal.

More information:

cksum Command

Monday, May 9, 2011

Oracle instances dying and read-only filesystems

You have a Linux server running one or more Oracle instances, and some day all the instances are down except their listeners. You check the alert log and found absolutely nothing, and if you're lucky enough you try to start up instances and get an error message about a read-only filesystem.

myserver> dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /oracle/product/10.2.0/bin/dbstart ORACLE_HOME
touch: cannot touch `/oracle/product/10.2.0/startup.log': Read-only file system
chmod: changing permissions of `/oracle/product/10.2.0/startup.log': Read-only file system
Processing Database instance "mydb01": log file /oracle/product/10.2.0/startup.log
/oracle/product/10.2.0/bin/dbstart: line 361: /oracle/product/10.2.0/startup.log: Read-only file system
touch: cannot touch `/oracle/product/10.2.0/startup.log': Read-only file system
chmod: changing permissions of `/oracle/product/10.2.0/startup.log': Read-only file system
Processing Database instance "mydb02": log file /oracle/product/10.2.0/startup.log
/oracle/product/10.2.0/bin/dbstart: line 361: /oracle/product/10.2.0/startup.log: Read-only file system

myserver> touch /oracle/product/10.2.0/test.txt
touch: cannot touch `/oracle/product/10.2.0/test.txt': Read-only file system

You try to create an archive with touch in the Oracle's filesystem and you can't, so you check server up time, load and mounted filesystems:

myserver> uptime
11:34:30 up 138 days, 18:02, 1 user, load average: 0.00, 0.00, 0.00

myserver> mount
/dev/mapper/VolGroup01-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/cciss/c0d0p1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/mapper/appsvg-lv001 on /oracle type ext3 (rw,_netdev)

Everything seems fine but you notice the option _netdev in the Oracle filesystem. When you're configuring filesystems in /etc/fstab and some of them are network-dependent you put this option so the operating system won't try to mount them before having network connectivity.

Therefore, you have a filesystem that is accessed by network so it might be with iSCSI:

myserver> /sbin/lsmod|grep iscsi
iscsi_tcp 19785 3
libiscsi_tcp 21957 2 iscsi_tcp,cxgb3i
libiscsi2 42181 5 ib_iser,iscsi_tcp,bnx2i,cxgb3i,libiscsi_tcp
scsi_transport_iscsi2 37709 7 ib_iser,iscsi_tcp,bnx2i,cxgb3i,libiscsi2
scsi_transport_iscsi 6085 1 scsi_transport_iscsi2
scsi_mod 141717 23 mptctl,ib_iser,iscsi_tcp,bnx2i,cxgb3i,libiscsi2,scsi_transport_iscsi2,scsi_dh,sg,qla2xxx,scsi_transport_fc,mptspi,scsi_transport_spi,mptsas,mptscsih,scsi_transport_sas,usb_storage,cciss,hpahcisr,sd_mod

myserver> /sbin/iscsiadm -m session -P 2
iscsiadm: Maybe you are not root?
iscsiadm: Could not lock discovery DB: /var/lock/iscsi/lock.write: Permission denied
Target: iqn.2000-03.com.someprovider:mycompany:87:mycmp1
Current Portal: 10.0.57.23:3260,1
Persistent Portal: 10.0.57.34:3260,1
**********
Interface:
**********
Iface Name: default
Iface Transport: tcp
Iface Initiatorname: iqn.1994-05.com.redhat:1234abc56d78
Iface IPaddress: 10.0.57.85
Iface HWaddress:
Iface Netdev:
SID: 1
iSCSI Connection State: Unknown
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: Unknown
************************
Negotiated iSCSI params:
************************
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 262144
FirstBurstLength: 262144
MaxBurstLength: 1048576
ImmediateData: Yes
InitialR2T: No
MaxOutstandingR2T: 1

That's the problem! Oracle instances die because cannot write database files, and if the logs are placed in the same filesystems Oracle cannot write error messages either. This connectivity problem would be by heavy load, network glitches, problems with the disk appliance or something else, but if the problem is not so bad your sysadmin might change some iSCSI parameters to help a bit:

node.conn[0].timeo.noop_out_interval = 0
node.conn[0].timeo.noop_out_timeout = 0
node.session.timeo.replacement_timeout = 86400

More information:

Filesystems becoming read-only on iSCSI
Linux* Open-iSCSI

Tuesday, May 3, 2011

Getting AIX basic system info

Sometimes you might need to know basic information about your AIX server like time up (uptime), operating system version (oslevel), firmware version (lsmcode), operating system parameters (lsattr), hardware (lscfg) or even storage errors (errpt), therefore I put this transcript as a reference. Some parameters are easy to understand and others are just for experienced sysadmins, but this information might be helpful even for an Oracle DBA working with an AIX server.

myserver> uptime
04:34PM up 79 days, 5:52, 1 user, load average: 1.20, 1.13, 1.11

myserver> oslevel -r
5300-11

myserver> lsmcode -c
The current permanent system firmware image is SF240_320
The current temporary system firmware image is SF240_332
The system is currently booted from the temporary firmware image.

myserver> lsattr -E -l sys0
SW_dist_intr false Enable SW distribution of interrupts True
autorestart true Automatically REBOOT system after a crash True
boottype disk N/A False
capacity_inc 1.00 Processor capacity increment False
capped true Partition is capped False
conslogin enable System Console Login False
cpuguard enable CPU Guard True
dedicated true Partition is dedicated False
ent_capacity 2.00 Entitled processor capacity False
frequency 1056000000 System Bus Frequency False
fullcore false Enable full CORE dump True
fwversion IBM,SF240_320 Firmware version and revision levels False
id_to_partition 0X80000819C3F00009 Partition ID False
id_to_system 0X80000819C3F00000 System ID False
iostat false Continuously maintain DISK I/O history True
keylock normal State of system keylock at boot time False
log_pg_dealloc true Log predictive memory page deallocation events True
max_capacity 3.00 Maximum potential processor capacity False
max_logname 9 Maximum login name length at boot time True
maxbuf 20 Maximum number of pages in block I/O BUFFER CACHE True
maxmbuf 0 Maximum Kbytes of real memory allowed for MBUFS True
maxpout 0 HIGH water mark for pending write I/Os per file True
maxuproc 1024 Maximum number of PROCESSES allowed per user True
min_capacity 2.00 Minimum potential processor capacity False
minpout 0 LOW water mark for pending write I/Os per file True
modelname IBM,9119-590 Machine name False
ncargs 512 ARG/ENV list size in 4K byte blocks True
nfs4_acl_compat secure NFS4 ACL Compatibility Mode True
pre430core false Use pre-430 style CORE dump True
pre520tune disable Pre-520 tuning compatibility mode True
realmem 18874368 Amount of usable physical memory in Kbytes False
rtasversion 1 Open Firmware RTAS version False
sed_config select Stack Execution Disable (SED) Mode True
systemid IBM,02025224F Hardware system identifier False
variable_weight 0 Variable processor capacity weight False

myserver> lscfg
INSTALLED RESOURCE LIST

The following resources are installed on the machine.
+/- = Added or deleted from Resource List.
* = Diagnostic support not available.

Model Architecture: chrp
Model Implementation: Multiple Processor, PCI bus

+ sys0 System Object
+ sysplanar0 System Planar
* pci45 U5791.001.9920F70-P1 PCI Bus
* pci46 U5791.001.9920F70-P1 PCI Bus
+ fcs2 U5791.001.9920F70-P1-C08-T1 FC Adapter
* fcnet2 U5791.001.9920F70-P1-C08-T1 Fibre Channel Network Protocol Device
+ fscsi2 U5791.001.9920F70-P1-C08-T1 FC SCSI I/O Controller Protocol Device
* hdisk5 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LF0000000000000 EMC Symmetrix FCP Raid1
* hdiskpower0 U5791.001.9920F70-P1-C08-T1-L40 PowerPath Device
* hdiskpower1 U5791.001.9920F70-P1-C08-T1-L41 PowerPath Device
* hdiskpower2 U5791.001.9920F70-P1-C08-T1-L42 PowerPath Device
* hdiskpower3 U5791.001.9920F70-P1-C08-T1-L43 PowerPath Device
* hdiskpower4 U5791.001.9920F70-P1-C08-T1-L44 PowerPath Device
* hdiskpower5 U5791.001.9920F70-P1-C08-T1-L45 PowerPath Device
* hdiskpower6 U5791.001.9920F70-P1-C08-T1-L46 PowerPath Device
* hdiskpower7 U5791.001.9920F70-P1-C08-T1-L47 PowerPath Device
* hdiskpower8 U5791.001.9920F70-P1-C08-T1-L48 PowerPath Device
* hdiskpower9 U5791.001.9920F70-P1-C08-T1-L49 PowerPath Device
* hdiskpower10 U5791.001.9920F70-P1-C08-T1-L50 PowerPath Device
* hdiskpower11 U5791.001.9920F70-P1-C08-T1-L51 PowerPath Device
* hdiskpower12 U5791.001.9920F70-P1-C08-T1-L52 PowerPath Device
* hdiskpower13 U5791.001.9920F70-P1-C08-T1-L53 PowerPath Device
* hdiskpower14 U5791.001.9920F70-P1-C08-T1-L54 PowerPath Device
* hdiskpower15 U5791.001.9920F70-P1-C08-T1-L55 PowerPath Device
* hdiskpower16 U5791.001.9920F70-P1-C08-T1-L56 PowerPath Device
* hdiskpower17 U5791.001.9920F70-P1-C08-T1-L57 PowerPath Device
* hdiskpower18 U5791.001.9920F70-P1-C08-T1-L58 PowerPath Device
* hdiskpower19 U5791.001.9920F70-P1-C08-T1-L60 PowerPath Device
* hdiskpower20 U5791.001.9920F70-P1-C08-T1-L61 PowerPath Device
* hdiskpower21 U5791.001.9920F70-P1-C08-T1-L62 PowerPath Device
* hdiskpower22 U5791.001.9920F70-P1-C08-T1-L63 PowerPath Device
* hdiskpower23 U5791.001.9920F70-P1-C08-T1-L64 PowerPath Device
* hdiskpower24 U5791.001.9920F70-P1-C08-T1-L65 PowerPath Device
* hdiskpower25 U5791.001.9920F70-P1-C08-T1-L66 PowerPath Device
* hdiskpower26 U5791.001.9920F70-P1-C08-T1-L59 PowerPath Device
* hdisk67 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L11000000000000 EMC Symmetrix FCP Raid5
* hdisk68 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L12000000000000 EMC Symmetrix FCP Raid5
* hdisk69 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L13000000000000 EMC Symmetrix FCP Raid5
* hdisk70 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L14000000000000 EMC Symmetrix FCP Raid5
* hdisk71 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L15000000000000 EMC Symmetrix FCP Raid5
* hdisk72 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L16000000000000 EMC Symmetrix FCP Raid5
* hdisk73 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L17000000000000 EMC Symmetrix FCP Raid5
* hdisk74 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L18000000000000 EMC Symmetrix FCP Raid5
* hdisk75 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L10A000000000000 EMC Symmetrix FCP Raid5
* hdisk78 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LF5000000000000 EMC Symmetrix FCP Raid5
* hdisk79 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LF6000000000000 EMC Symmetrix FCP Raid5
* hdisk107 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L2000000000000 EMC Symmetrix FCP Raid5
* hdisk108 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L3000000000000 EMC Symmetrix FCP Raid5
* hdisk109 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L4000000000000 EMC Symmetrix FCP Raid5
* hdisk110 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L5000000000000 EMC Symmetrix FCP Raid5
* hdisk111 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L6000000000000 EMC Symmetrix FCP Raid5
* hdisk112 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L7000000000000 EMC Symmetrix FCP Raid5
* hdisk113 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L8000000000000 EMC Symmetrix FCP Raid5
* hdisk114 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L9000000000000 EMC Symmetrix FCP Raid5
* hdisk115 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LA000000000000 EMC Symmetrix FCP Raid5
* hdisk116 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LB000000000000 EMC Symmetrix FCP Raid5
* hdisk117 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LC000000000000 EMC Symmetrix FCP Raid5
* hdisk118 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LD000000000000 EMC Symmetrix FCP Raid5
* hdisk119 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LE000000000000 EMC Symmetrix FCP Raid5
* hdisk120 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-LF000000000000 EMC Symmetrix FCP Raid5
* hdisk121 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L10000000000000 EMC Symmetrix FCP Raid5
* hdisk122 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L100000000000000 EMC Symmetrix FCP Raid5
* hdisk123 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L101000000000000 EMC Symmetrix FCP Raid5
* hdisk124 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L102000000000000 EMC Symmetrix FCP Raid5
* hdisk125 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L103000000000000 EMC Symmetrix FCP Raid5
* hdisk126 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L104000000000000 EMC Symmetrix FCP Raid5
* hdisk127 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L105000000000000 EMC Symmetrix FCP Raid5
* hdisk128 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L106000000000000 EMC Symmetrix FCP Raid5
* hdisk129 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L107000000000000 EMC Symmetrix FCP Raid5
* hdisk130 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L109000000000000 EMC Symmetrix FCP Raid5
* hdisk131 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L110000000000000 EMC Symmetrix FCP Raid5
* hdisk132 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L111000000000000 EMC Symmetrix FCP Raid5
* hdisk133 U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L112000000000000 EMC Symmetrix FCP Raid5
* hdiskpower27 U5791.001.9920F70-P1-C08-T1-L29 PowerPath Device
* hdiskpower28 U5791.001.9920F70-P1-C08-T1-L30 PowerPath Device
* hdiskpower29 U5791.001.9920F70-P1-C08-T1-L31 PowerPath Device
* hdiskpower30 U5791.001.9920F70-P1-C08-T1-L32 PowerPath Device
* hdiskpower31 U5791.001.9920F70-P1-C08-T1-L33 PowerPath Device
* hdiskpower32 U5791.001.9920F70-P1-C08-T1-L34 PowerPath Device
* hdiskpower33 U5791.001.9920F70-P1-C08-T1-L35 PowerPath Device
* hdiskpower34 U5791.001.9920F70-P1-C08-T1-L36 PowerPath Device
* hdiskpower35 U5791.001.9920F70-P1-C08-T1-L37 PowerPath Device
* hdiskpower36 U5791.001.9920F70-P1-C08-T1-L38 PowerPath Device
* hdiskpower37 U5791.001.9920F70-P1-C08-T1-L39 PowerPath Device
* pci15 U5791.001.9920F6T-P2 PCI Bus
* pci25 U5791.001.9920F6T-P2 PCI Bus
+ scsi12 U5791.001.9920F6T-P2-T6 Wide/Ultra-3 SCSI I/O Controller
+ hdisk18 U5791.001.9920F6T-P2-T6-L8-L0 16 Bit LVD SCSI Disk Drive (73400 MB)
+ hdisk19 U5791.001.9920F6T-P2-T6-L9-L0 16 Bit LVD SCSI Disk Drive (73400 MB)
+ ses10 U5791.001.9920F6T-P2-T6-L15-L0 SCSI Enclosure Services Device
* pci4 U5791.001.9920F6H-P1 PCI Bus
* pci5 U5791.001.9920F6H-P1 PCI Bus
+ ent0 U5791.001.9920F6H-P1-C09-T1 2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902)
+ ent1 U5791.001.9920F6H-P1-C09-T2 2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902)
* vio0 Virtual I/O Bus
* ent3 U9119.590.025224F-V9-C2-T1 Virtual I/O Ethernet Adapter (l-lan)
* vsa0 U9119.590.025224F-V9-C0 LPAR Virtual Serial Adapter
* vty0 U9119.590.025224F-V9-C0-L0 Asynchronous Terminal
* pci0 U5791.001.9920F6W-P1 PCI Bus
* pci44 U5791.001.9920F6W-P1 PCI Bus
+ fcs0 U5791.001.9920F6W-P1-C09-T1 FC Adapter
* fcnet0 U5791.001.9920F6W-P1-C09-T1 Fibre Channel Network Protocol Device
+ fscsi0 U5791.001.9920F6W-P1-C09-T1 FC SCSI I/O Controller Protocol Device
* hdisk2 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LF0000000000000 EMC Symmetrix FCP Raid1
* hdisk58 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L11000000000000 EMC Symmetrix FCP Raid5
* hdisk59 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L12000000000000 EMC Symmetrix FCP Raid5
* hdisk60 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L13000000000000 EMC Symmetrix FCP Raid5
* hdisk61 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L14000000000000 EMC Symmetrix FCP Raid5
* hdisk62 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L15000000000000 EMC Symmetrix FCP Raid5
* hdisk63 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L16000000000000 EMC Symmetrix FCP Raid5
* hdisk64 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L17000000000000 EMC Symmetrix FCP Raid5
* hdisk65 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L18000000000000 EMC Symmetrix FCP Raid5
* hdisk66 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L10A000000000000 EMC Symmetrix FCP Raid5
* hdisk76 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LF5000000000000 EMC Symmetrix FCP Raid5
* hdisk77 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LF6000000000000 EMC Symmetrix FCP Raid5
* hdisk80 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L2000000000000 EMC Symmetrix FCP Raid5
* hdisk81 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L3000000000000 EMC Symmetrix FCP Raid5
* hdisk82 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L4000000000000 EMC Symmetrix FCP Raid5
* hdisk83 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L5000000000000 EMC Symmetrix FCP Raid5
* hdisk84 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L6000000000000 EMC Symmetrix FCP Raid5
* hdisk85 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L7000000000000 EMC Symmetrix FCP Raid5
* hdisk86 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L8000000000000 EMC Symmetrix FCP Raid5
* hdisk87 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L9000000000000 EMC Symmetrix FCP Raid5
* hdisk88 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LA000000000000 EMC Symmetrix FCP Raid5
* hdisk89 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LB000000000000 EMC Symmetrix FCP Raid5
* hdisk90 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LC000000000000 EMC Symmetrix FCP Raid5
* hdisk91 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LD000000000000 EMC Symmetrix FCP Raid5
* hdisk92 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LE000000000000 EMC Symmetrix FCP Raid5
* hdisk93 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-LF000000000000 EMC Symmetrix FCP Raid5
* hdisk94 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L10000000000000 EMC Symmetrix FCP Raid5
* hdisk95 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L100000000000000 EMC Symmetrix FCP Raid5
* hdisk96 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L101000000000000 EMC Symmetrix FCP Raid5
* hdisk97 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L102000000000000 EMC Symmetrix FCP Raid5
* hdisk98 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L103000000000000 EMC Symmetrix FCP Raid5
* hdisk99 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L105000000000000 EMC Symmetrix FCP Raid5
* hdisk100 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L106000000000000 EMC Symmetrix FCP Raid5
* hdisk101 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L107000000000000 EMC Symmetrix FCP Raid5
* hdisk102 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L109000000000000 EMC Symmetrix FCP Raid5
* hdisk103 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L110000000000000 EMC Symmetrix FCP Raid5
* hdisk104 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L111000000000000 EMC Symmetrix FCP Raid5
* hdisk105 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L112000000000000 EMC Symmetrix FCP Raid5
* hdisk106 U5791.001.9920F6W-P1-C09-T1-W5006048ACC36E4EC-L113000000000000 EMC Symmetrix FCP Raid5
+ fcs1 U5791.001.9920F6W-P1-C09-T2 FC Adapter
* fcnet1 U5791.001.9920F6W-P1-C09-T2 Fibre Channel Network Protocol Device
+ fscsi1 U5791.001.9920F6W-P1-C09-T2 FC SCSI I/O Controller Protocol Device
* rmt1 U5791.001.9920F6W-P1-C09-T2-W100000E00223B4FE-L1000000000000 Other FC SCSI Tape Drive
* rmt2 U5791.001.9920F6W-P1-C09-T2-W100000E00223B4FE-L2000000000000 Other FC SCSI Tape Drive
* rmt3 U5791.001.9920F6W-P1-C09-T2-W100000E00223D755-L0 Other FC SCSI Tape Drive
* rmt4 U5791.001.9920F6W-P1-C09-T2-W100000E00223D755-L1000000000000 Other FC SCSI Tape Drive
* rmt5 U5791.001.9920F6W-P1-C09-T2-W100000E00223FF7A-L0 Other FC SCSI Tape Drive
* rmt6 U5791.001.9920F6W-P1-C09-T2-W100000E002240263-L0 Other FC SCSI Tape Drive
* rmt0 U5791.001.9920F6W-P1-C09-T2-W100000E00223FF7A-L1000000000000 Other FC SCSI Tape Drive
* rmt7 U5791.001.9920F6W-P1-C09-T2-W100000E002240263-L1000000000000 Other FC SCSI Tape Drive
+ L2cache0 L2 Cache
+ mem0 Memory
+ proc0 Processor
+ proc2 Processor

myserver> errpt -a|more
---------------------------------------------------------------------------
LABEL: SC_DISK_ERR2
IDENTIFIER: B6267342

Date/Time: Mon Dec 13 06:53:34 CST 2010
Sequence Number: 000007
Machine Id: 001122334400
Node Id: myserver
Class: H
Type: PERM
Resource Name: hdisk111
Resource Class: disk
Resource Type: SYMM_RAID5
Location: U5791.001.9920F70-P1-C08-T1-W5006048ACC36E4E3-L6000000000000
VPD:
Manufacturer................EMC
Machine Type and Model......SYMMETRIX
ROS Level and ID............5671
Serial Number...............12345678
Part Number.................000000000000510023010187
EC Level....................751315
LIC Node VPD................0AA3
Device Specific.(Z0)........04
Device Specific.(Z1)........51
Device Specific.(Z2)........567100750000000000092508
Device Specific.(Z3)........12000000
Device Specific.(Z4)........54130008
Device Specific.(Z5)........BF80
Device Specific.(Z6)........4D

Description
DISK OPERATION ERROR

Probable Causes
DASD DEVICE

Failure Causes
DISK DRIVE
DISK DRIVE ELECTRONICS

Recommended Actions
PERFORM PROBLEM DETERMINATION PROCEDURES

Detail Data
PATH ID
0
SENSE DATA
0600 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0118 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0083 0000
0000 003D 0019
---------------------------------------------------------------------------
LABEL: SC_DISK_ERR2
IDENTIFIER: B6267342

Date/Time: Mon Dec 13 06:53:34 CST 2010
Sequence Number: 000006
Machine Id: 001122334400

Tuesday, April 26, 2011

Checking processes memory usage

Sometimes your server would have a heavy load because there is one or many processes consuming a lot of memory, and when there is no more physical memory (RAM) available the system begins using virtual memory (swap), and as long as RAM is thousands times faster than normal hard disks you'll notice for sure when your system begins to swap memory. Therefore, if you're a sysadmin or an Oracle DBA running instances in your own AIX server that doesn't run anything else, it would be good to pinpoint the top processes consuming the system's memory in an easy and quick way like this:

myserver> ps auwx|sort -k 5b,5nr|more
USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
oracle 5669038 0.1 2.0 1536176 743136 - A Jan 21 18:43 oraclemyoradb (LOCAL=NO)
oracle 4755538 0.0 2.0 1472752 719680 - A Jan 15 16:44 oraclemyoradb (LOCAL=NO)
oracle 5922916 0.0 1.0 1463404 518768 - A Jan 21 9:05 oraclemyoradb (LOCAL=NO)
oracle 4575476 0.0 2.0 1419100 692160 - A 16:05:55 2:25 oraclemyoradb (LOCAL=NO)
oracle 2752638 0.0 2.0 1405344 692960 - A Jan 20 11:35 oraclemyoradb (LOCAL=NO)
oracle 6070354 0.1 2.0 1338124 736024 - A 16:03:06 5:23 oraclemyoradb (LOCAL=NO)
oracle 3518588 0.0 2.0 1273420 704220 - A Jan 20 10:56 oraclemyoradb (LOCAL=NO)
oracle 5390404 0.1 2.0 1272972 814148 - A Jan 22 13:47 oraclemyoradb (LOCAL=NO)
oracle 2371620 0.0 2.0 1259332 685920 - A Jan 20 7:40 oraclemyoradb (LOCAL=NO)
oracle 4784328 0.0 2.0 1259024 774984 - A Jan 20 11:02 oraclemyoradb (LOCAL=NO)
oracle 5877918 0.1 2.0 1200360 730492 - A Jan 24 5:12 oraclemyoradb (LOCAL=NO)
oracle 4374602 0.0 2.0 1193800 771632 - A Jan 21 9:35 oraclemyoradb (LOCAL=NO)
oracle 5804038 0.0 2.0 1178616 681944 - A Jan 20 19:32 oraclemyoradb (LOCAL=NO)
oracle 4931756 0.3 2.0 1156880 786928 - A 10:58:49 1:45 oraclemyoradb (LOCAL=NO)
oracle 3100862 0.0 2.0 1146228 664368 - A Jan 18 6:54 oraclemyoradb (LOCAL=NO)
oracle 1880168 0.0 2.0 1043492 709820 - A Jan 20 16:53 oraclemyoradb (LOCAL=NO)
oracle 3858452 0.0 2.0 1035528 723960 - A Jan 20 12:24 oraclemyoradb (LOCAL=NO)
oracle 4050954 0.0 2.0 1027828 678236 - A Jan 22 10:00 oraclemyoradb (LOCAL=NO)
oracle 3510290 0.0 2.0 1010724 610948 - A Jan 14 11:22 oraclemyoradb (LOCAL=NO)


As you can see, there is a lot of oracle processes related to myoradb database that are consuming too much memory and chocking the system.

Wednesday, April 20, 2011

Checking AIX cache

The cache area is a memory area where the operating system places blocks of files used often, therefore reducing costly I/O to slower devices like hard disks. It is a good concept and very useful for boosting performance of file servers (NFS, samba), but is not so good for database software like Oracle because an instance manages its own cache area.

Therefore, if you are an Oracle administrator of databases in AIX servers it's a good practice to be aware of memory configuration and usage, and maybe help a bit your fellow sysadmin just in case. The important parameters to check are the minimum and maximum percentage of RAM for file caching purposes (minperm% and maxperm%):

root:myserver> vmstat -v
2621440 memory pages
2525761 lruable pages
180000 free pages
4 memory pools
647419 pinned pages
80.0 maxpin percentage
20.0 minperm percentage
80.0 maxperm percentage
24.8 numperm percentage
627654 file pages
0.0 compressed percentage
0 compressed pages
24.8 numclient percentage
25.0 maxclient percentage
627654 client pages
0 remote pageouts scheduled
58246 pending disk I/Os blocked with no pbuf
10544297 paging space I/Os blocked with no psbuf
2228 filesystem I/Os blocked with no fsbuf
805 client filesystem I/Os blocked with no fsbuf
2215609 external pager filesystem I/Os blocked with no fsbuf
0 Virtualized Partition Memory Page Faults
0.00 Time resolving virtualized partition memory page faults

As you can see in this example, there is a lot of minimum memory allotted for file caching (20%) and wasted because Oracle caching is better for Oracle databases than operating system caching, but you can't assign that 20% RAM space to Oracle unless you change the virtual memory AIX parameters.

Moreover, the maximum memory reserved for file caching is limited by the maxclient percentage (25%) so in this system you can use up to 25% of RAM for file caching of non-JFS filesystem files and the other 55% for caching files of JFS filesystems. You can check JFS memory pages usage with this command:

root:myserver> svmon -G
size inuse free pin virtual
memory 2621440 2442500 178940 647452 2186997
pg space 5373952 925157

work pers clnt other
pin 562525 0 0 84927
in use 1734676 0 707824

PageSize PoolSize inuse pgsp pin virtual
s 4 KB - 2326020 925157 571068 2070517
m 64 KB - 7280 0 4774 7280

You might notice that there are 0 pages used for JFS file caching (pers), and that might be because there are no JFS file systems in this server:

root:myserver> mount
node mounted mounted over vfs date options
-------- --------------- --------------- ------ ------------ ---------------
/dev/hd1 / jfs2 Jun 05 19:09 rw,log=/dev/hd8
/dev/hd2 /usr jfs2 Jun 05 19:09 rw,log=/dev/hd8
/dev/hd5 /var jfs2 Jun 05 19:10 rw,log=/dev/hd8
/dev/hd3 /tmp jfs2 Jun 05 19:10 rw,log=/dev/hd8
/dev/hd4 /home jfs2 Jun 05 19:11 rw,log=/dev/hd8
/proc /proc procfs Jun 05 19:11 rw
/dev/hd6 /opt jfs2 Jun 05 19:11 rw,log=/dev/hd8
/dev/fslv00 /myfs jfs2 Jun 05 19:11 rw,log=/dev/loglv00

IBM recommends setting the parameters as follows:

maxperm = 90%
maxclient = 90%
minperm = 3%

More information:

Tuning the AIX file caches
Overview of AIX page replacement

Wednesday, April 13, 2011

Memory overhead

Talking about computers the more the better is usual, but this is not true all the time. By example, look at the amount of memory and load in bigservr; this server has 64 gigabytes of memory but is used just 3 gigabytes, and even if there are no running processes and the CPU usage is almost zero the load average is somewhat high. In comparison, smallsrv is busier and even having used swap memory the load average is lower than in bigservr.

The management of hardware by the Linux kernel requires resources, and in order to manage a lot of memory the kernel requires ... a lot of memory structures. Therefore, if you aren't going to use a lot of memory it would be better (and cheaper) to install just the memory you need.

myuser@bigservr> top

top - 08:50:32 up 6 days, 13:00, 4 users, load average: 0.71, 0.74, 0.66
Tasks: 272 total, 1 running, 271 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.8%us, 0.1%sy, 0.0%ni, 99.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 65791000k total, 3227812k used, 62563188k free, 309716k buffers
Swap: 5406712k total, 0k used, 5406712k free, 2649252k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
10768 root 15 0 16420 2456 2124 S 0.3 0.0 0:39.00 cmaeventd
22241 myuser 15 0 2336 1136 800 R 0.3 0.0 0:01.14 top
1 root 15 0 2072 616 532 S 0.0 0.0 0:08.29 init
2 root RT -5 0 0 0 S 0.0 0.0 0:01.17 migration/0
3 root 39 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:01.44 migration/1
6 root 34 19 0 0 0 S 0.0 0.0 0:00.07 ksoftirqd/1
7 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
8 root RT -5 0 0 0 S 0.0 0.0 0:01.01 migration/2
9 root 34 19 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/2
10 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
11 root RT -5 0 0 0 S 0.0 0.0 0:01.72 migration/3

root@smallsrv:~# top

top - 08:51:20 up 29 min, 6 users, load average: 0.16, 0.21, 0.46
Tasks: 184 total, 2 running, 182 sleeping, 0 stopped, 0 zombie
Cpu(s): 7.0%us, 12.3%sy, 0.0%ni, 79.3%id, 1.3%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1016864k total, 987644k used, 29220k free, 44384k buffers
Swap: 2980016k total, 204780k used, 2775236k free, 604592k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2599 myuser 10 -10 271m 186m 177m S 9.6 18.8 2:55.94 vmware-vmx
2377 myuser 20 0 388m 103m 19m S 4.3 10.4 0:50.69 firefox-bin
1030 root 20 0 105m 20m 9428 S 3.0 2.1 1:00.57 Xorg
2435 myuser 20 0 73624 13m 9.9m S 1.3 1.4 0:15.40 plugin-containe
3479 root 20 0 2472 1196 880 R 0.7 0.1 0:00.06 top
16 root 15 -5 0 0 0 S 0.3 0.0 0:00.39 ata/0
2028 myuser 20 0 110m 10m 5832 S 0.3 1.1 0:12.17 compiz.real
2206 myuser 20 0 113m 11m 8324 S 0.3 1.2 0:04.71 gnome-terminal
2938 root 0 -20 0 0 0 R 0.3 0.0 0:08.41 vmware-rtc
1 root 20 0 2532 1420 1096 S 0.0 0.1 0:00.98 init
2 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/0
4 root 15 -5 0 0 0 S 0.0 0.0 0:00.09 ksoftirqd/0
5 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
6 root 15 -5 0 0 0 S 0.0 0.0 0:00.02 events/0
7 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 cpuset
8 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 khelper

Friday, April 8, 2011

Checking memory usage in HP-UX

If you feel that your server is slower than usual, you could check memory usage and swapping with ps, top, vmstat and glance. In this example, as you can see in Mem Util and Swap Util in glance this server used a lot of memory and swap space at some time, but at the time of this sample there were no paging or memory shortage as seen in memory "active" (in parentheses) in the top report, as seen in low values in Page In and Page Out in glance, and also low values in pi and po in vmstat report.

$ ps -elx|sort -k 10b,10rn|more
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME COMD
1401 S 113 6938 1 0 154 20 e000000163528680 9728 e000000149c7d080 ? 465:09 ora_s000_mydb
1401 S 113 6083 1 0 154 20 e0000001bcc40400 9620 e0000001674f6ee8 ? 0:00 oraclemydb (LOCAL=NO)
1401 S 113 6940 1 0 154 20 e0000001635c5100 9147 e000000149c7d080 ? 3:13 ora_d000_mydb
1401 S 113 6932 1 0 156 20 e0000001636fc700 9103 e000000167e27128 ? 2:40 ora_smon_mydb
1401 S 113 6926 1 0 156 20 e000000163664980 9012 e000000167e270f8 ? 25:24 ora_dbw0_mydb
1401 S 113 6934 1 0 156 20 e00000016362a700 8992 e000000167e27138 ? 0:02 ora_reco_mydb
1401 S 113 6924 1 0 154 20 e00000016340b700 8979 e000000149c7d080 ? 9:48 ora_pmon_mydb
1401 S 113 6936 1 0 156 20 e00000016348ba00 8967 e000000167e27148 ? 12:17 ora_cjq0_mydb
1401 S 113 6930 1 0 156 20 e000000163370980 8938 e000000167e27118 ? 12:59 ora_ckpt_mydb
1401 S 113 6928 1 0 156 20 e0000001634d6980 8924 e000000167e27108 ? 9:48 ora_lgwr_mydb
2541 R 0 6003 1 0 -16 10 e0000001a7370d00 4271 - ? 0:22 /opt/perf/bin/midaemon
2401 S 113 5999 5798 0 154 10 e0000001bb0fba00 1016 e00000018409c800 pts/0 0:19 glance
541 R 0 1 0 0 152 20 e00000010853e380 574 - ? 0:10 init
1401 S 113 6961 1 0 154 20 e000000163945a00 552 e000000149c7d080 ? 1:02 /oracle92/product/9.2.0/bin/tnslsnr LISTENER -inherit
1401 S 0 6088 1564 0 154 20 e0000001b1098980 491 e00000030f73fe68 ? 0:00 sshd: oracle [priv]
3401 S 113 6090 6088 0 154 20 e0000001b2c90100 491 e000000149c7d080 ? 0:00 sshd: oracle@pts/1
3401 S 127 6333 6331 0 154 20 e0000001c2b09d00 487 e000000149c7d080 ? 0:00 sshd: myuser@pts/2
1401 S 0 6331 1564 0 154 20 e0000001c8a15d00 471 e00000014eeffee8 ? 0:00 sshd: myuser [priv]
1401 S 0 6605 1564 0 154 20 e0000001ac0fc980 471 e000000164a63568 ? 0:00 sshd: otherusr [priv]
3401 S 12 6617 6605 0 154 20 e0000001b550c680 471 e000000149c7d080 ? 0:00 sshd: otherusr@pts/3
3401 S 113 5794 5791 0 154 20 e0000001b8695380 466 e000000149c7d080 ? 0:00 sshd: oracle@pts/0
$ top

System: myserver Fri Apr 8 10:37:43 2011
Load averages: 0.02, 0.12, 0.34
182 processes: 141 sleeping, 41 running
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 0.02 0.2% 0.0% 0.2% 99.6% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 0.02 0.2% 0.0% 0.2% 99.6% 0.0% 0.0% 0.0% 0.0%

System Page Size: 4Kbytes
Memory: 1151700K (788492K) real, 3840196K (2936972K) virtual, 26556K free Page# 1/14

CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
0 ? 27479 root 152 20 264M 20128K run 95:34 0.34 0.34 agctrlcell
0 ? 6938 oracle 154 20 1973M 4444K sleep 465:16 0.32 0.31 ora_s000_mydb
0 ? 2731 root 152 20 155M 7928K run 4:22 0.31 0.31 vxpal
0 ? 75 root 152 20 17208K 15296K run 44:50 0.29 0.29 vxfsd
0 ? 2666 root 152 20 112M 4332K run 1:30 0.29 0.29 vxsvc
0 ? 27475 root 152 20 694M 15332K run 84:10 0.29 0.29 evtcell
0 ? 3532 root 168 20 11700K 592K sleep 307:47 0.29 0.29 utild
0 ? 2357 root 152 20 26072K 1880K run 0:29 0.14 0.14 rpcd
0 ? 3021 root 152 20 92272K 2296K run 0:09 0.14 0.14 vxpal
0 ? 3078 root 152 20 99636K 1568K run 0:08 0.14 0.14 vxpal
0 ? 3197 root 152 20 25832K 1612K run 0:54 0.14 0.14 swagentd
$ glance

C - cum/interval toggle Page 1 of 2
ProcList CPU Rpt Mem Rpt Disk Rpt NextKeys SlctProc Help Exit
Glance C.04.70.001 10:31:24 myserver ia64 Current Avg High
------------------------------------------------------------------------------------------------------------------------------------------------------
CPU Util SSU U | 5% 32% 86%
Disk Util F | 1% 30% 77%
Mem Util S SU U | 99% 100% 100%
Swap Util U UR R | 26% 26% 26%
------------------------------------------------------------------------------------------------------------------------------------------------------
MEMORY REPORT Users= 4
Event Current Cumulative Current Rate Cum Rate High Rate
--------------------------------------------------------------------------------
Page Faults 0 7593 0.0 12.5 548.6
Page In 0 5149 0.0 8.4 350.8
Page Out 0 56 0.0 0.0 1.3
KB Paged In 0kb 20.1mb 0.0 33.9 7455.2
KB Paged Out 0kb 224kb 0.0 0.3 5.4
Reactivations 0 0 0.0 0.0 0.0
Deactivations 0 0 0.0 0.0 0.0
KB Deactivated 0kb 0kb 0.0 0.0 0.0
VM Reads 0 435 0.0 0.7 33.1
VM Writes 0 0 0.0 0.0 0.0
Total VM : 3.6gb Sys Mem : 2.6gb User Mem: 924mb Phys Mem : 3.7gb
Active VM: 2.3gb Buf Cache: 1mb Free Mem: 25mb FileCache: 215mb
MemFS Blk Cnt: 0 MemFS Swp Cnt: 0

ProcList CPU Rpt Mem Rpt Disk Rpt NextKeys SlctProc Help Exit
$ vmstat 10
procs memory page faults cpu
r b w avm free re at pi po fr de sr in sy cs us sy id
3 1 0 667747 14981 1 0 7 10 1 0 34 297 2178 238 3 1 96
1 1 0 562145 14956 4 0 12 0 0 0 0 221 644 139 1 1 98
1 1 0 762287 14964 0 0 0 0 0 0 0 133 545 97 1 0 98
1 1 0 761304 14980 0 0 0 0 0 0 0 118 451 87 0 0 100
1 1 0 550784 14964 0 0 0 0 0 0 0 118 387 88 0 0 100

Also, if you have root access you can check memory usage with swapinfo, sam and in /dev/mem like this (example from a different server):

# swapinfo -tm
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 8192 490 3606 6% 0 - 1 /dev/vg00/lvol2
reserve - 2986 -2986
memory 3016 2780 236 92%
total 11208 6256 856 56% - 0 -
# echo phys_mem_pages/D | adb -k /stand/vmunix /dev/mem
phys_mem_pages:
phys_mem_pages: 1048064
# sam

┌ System Properties (MYSERVR) ┐
│┌────────────────────────────────────────┐│
││ ^│
││ [ Refresh ] │
││ │
││ ┌─────┐┌────┐┌─────────┐┌─────┐┌────┐ │
││ │ Processor ││ Memory ││ Operating System ││ Network ││ Dynamic │ │
││ ┌───────/ \──────────────────────────┐ │
││ │┌────────────────────────────────────┐│ │
││ ││Physical Memory: 4097.7 MB ││ │
││ ││Real Memory: ││ │
││ ││ Active: 954731.6 KB ││ │
││ ││ Total: 1318838.6 KB ││ │
││ ││Virtual Memory: ││ │
││ ││ Active: 1850220.6 KB ││ │
││ ││ Total: 2375723.8 KB ││ │
││ ││Free Memory Pages: 21640 at 4 KB/page ││ │
││ ││Swap Space: ││ │
││ ││ Avail: 8192 MB ││ │
││ ││ Used: 3461 MB ││v│
│└────────────────────────────────────────┘│
│──────────────────────────────────────────│
│ [ OK ] [ Help ] │
└──────────────────────────────────────────┘

More Information:

Memory Usage (What is using all of the memory?)