AskDba.org Weblog » Unix Reference
Unix Reference
We intend to keep this page as easy reference for Unix commands/links which are useful to DBA in day – day work. If you too have some command’s which can be useful , then you can use the comment’s section to add it and we will include in main page after cross-checking it. In case there are any corrections, then also let us know.
These commands will be categorised into Generic, AIX, Solaris, Linux and HP-UX.
AIX
Number of Cpu’s
$/usr/sbin/lsdev -C -c processor -S Available| wc -l
Memory Details
$/usr/sbin/lsattr -E -l sys0 -a realmem
Swap Configured
$/usr/sbin/lsps -a
To find maximum processes allowed and change it to 10000
$lsattr -El sys0 -a maxuproc #chdev -l sys0 -a maxuproc='10000'
Find memory utilization by process on AIX
ps axwv | awk '{t=t+$7 - $10 ;print $7 - $10,$1,$11,$12,$13}END{print t}' | sort -rn | pg
Script for Monitoring memory just like vmstat
===============================================
copy the contents in file like mem_mon.sh
### Usage mem_mon.sh (interval) (occurences) e.g sh mem_mon.sh 2 10 ###
### This will give top 10 memory consuming processes #####
wt_time=$1
lmt=$2
let a=0
while [[ $a -lt $lmt ]] ; do
ps axwv |sort -nrk 7,7|grep -v "COMMAND" \
|awk 'BEGIN {printf ("MemoryinKb \t ProcessId \t PerCPU \t PerMem \t Command \n")}{t=t+$7 - $10 ;printf("%13d \t %10d \t %6.2f \t %6.2f \t %s \n",$7 - $10,$1,$11,$12,$13)}END{print t}'|head -10
let a+=1
sleep $wt_time
done
HP-UX
Number of Cpu’s
$/usr/sbin/ioscan -kfnC processor | grep processor | wc -l
Memory Details
$grep -i Physical: /var/adm/syslog/syslog.log
Swap Configured
$/usr/sbin/swapinfo -a -m
Nic configuration
lanscan -v
Linux
Check number of CPU’s
$cat /proc/cpuinfo
Check memory information
cat /proc/meminfo
Check swap
$swapon -s
Kernel parameter
#/sbin/sysctl -a cat /etc/sysctl.conf
System error log
/var/log/messages
Nic configuration
ifconfig -a
Useful Links-
Linux file and related commands - http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part1.html
Top,find and snice commands – http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part2.html
free,vmstat,iostat and sar – http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part3.html
ifconfig,netstat (network commands) - http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part4.html
cpio,tar and Oracle VM – http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part5.html
Solaris
Check number of CPU’s
/usr/sbin/psrinfo -v
Check kernel version
isainfo -kv
Display Swap size
swap -l
List kernel parameters
sysdef -i
List Installed packages
#pkginfo
Nic configuration
ifconfig -a
Generic
Awk Tutorial – http://www.vectorsite.net/tsawk.html
Sed & Awk (Oreilly ebook) – http://docstore.mik.ua/orelly/unix/sedawk/index.htm

Recent Comments