Useful Unix Commands For Dbas

  • Uploaded by: V
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Useful Unix Commands For Dbas as PDF for free.

More details

  • Words: 5,322
  • Pages: 21
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 –r 300 | grep –i mem Solaris prtconf | grep –i mem Linux free HP-UX swapinfo –tm AIX lsdev –C | grep mem lsattr –El $ 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 –a (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 4783 2750 15706 17172 21150 17764 2910 19334 13664 17520

1174

Command Inuse Pin Pgspace 15012 4781 X 4353 1178 5544 dtwm 3257 1174 4003 dtsession 2986 1174 3827 dtterm 2941 1174 3697 aixterm 2862 1174 3644 dtterm 2813 1174 3705 dtterm 2813 1174 3704 dtterm 2804 1174 3706 aixterm 2801 1174 3619

Pid: 15012 Command: maker4X.exe Segid Type Description

Inuse

1572 pers /dev/hd3:62 142 pers /dev/hd3:51

0 0

Pin Pgspace Address Range 0 0

0 0..-1 0 0..-1

maker4X.exe

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 –pmb (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 –pmb (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

ipcrm –m 1310724 (To release the memory) Go top

CPU Displaying the No. of CPU processors in UNIX AIX lsdev –C | grep Process | wc –l HP-UX ioscan –C processor | grep processor | wc –l Solaris psrinfo –v | grep “Status of Processor” | wc –l Linux cat /proc/cpuinfo | grep processor | wc –l

Display top CPU Consumers with ps $ ps –ef | sort +7 | tail Output on AIX devor11i 30420 1 0 02:36:10 devor11i 33088 1 0 02:36:10 devor11i 41300 1 0 02:36:06 devor11i 48032 1 2 13:46:19 crpor11i 18498 7812 2 14:12:49 crpap11i 31850 1 0 06:17:06 devap11i 32832 1 0 02:35:31 crpor11i 48448 7812 1 14:12:49 crpor11i 39190 7812 0 14:12:49 root 15182 9030 0 13:24:19

- 0:05 oracleDEV (LOCAL=NO) - 0:06 oracleDEV (LOCAL=NO) - 0:01 oracleDEV (LOCAL=NO) - 0:02 oracleDEV (LOCAL=NO) pts/0 0:00 ps -ef - 0:00 rwmts60 name=REP60_CRP - 0:00 rwmts60 name=REP60_DEV pts/0 0:00 sort +7 pts/0 0:00 tail - 0:00 telnetd -a

ps auxgw | sort +2 | tail The third column of this listing (%CPU) shows the percentage of CPU used. Output on AIX USER

PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND

crpor11i 42412 0.1 1.0 29420 16164 - A 06:15:58 0:30 ora_qmn0_CRP devor11i 48032 0.1 1.0 30252 16036 - A 13:46:19 0:03 oracleDEV (LOCAL =NO) crpor11i 27526 0.1 1.0 30372 17336 - A 12:53:46 0:10 oracleCRP (DESCR IPTION=(LOCAL=no)(ADDRESS=(PROTOCOL=BEQ))) root 2888 0.2 0.0 164 36 -A Jul 20 73:42 /usr/sbin/syncd 60 crpor11i 34816 0.3 1.0 31916 18888 - A 13:43:29 0:12 oracleCRP (DESCR IPTION=(LOCAL=no)(ADDRESS=(PROTOCOL=BEQ))) root 45198 0.3 7.0 175204 103064 -A Jul 24 67:10 dsmserv quiet crpor11i 43620 0.4 1.0 32264 19236 - A 13:58:23 0:08 oracleCRP (DESCR IPTION=(LOCAL=no)(ADDRESS=(PROTOCOL=BEQ))) root 774 47.1 0.0 12 7492 -A Jul 20 17411:25 kproc root 516 48.0 0.0 12 7492 -A Jul 20 17723:26 kproc

ps augxww | grep “RSS| “ | head Output on AIX USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND root 516 48.0 0.0 12 7492 -A Jul 20 17725:33 kproc root 774 47.1 0.0 12 7492 -A Jul 20 17413:32 kproc crpor11i 46568 1.9 1.0 29768 16728 - A 14:16:18 0:02 oracleCRP (DESCR IPTION=(LOCAL=no)(ADDRESS=(PROTOCOL=BEQ))) crpor11i 43620 0.4 1.0 32264 19236 - A 13:58:23 0:08 oracleCRP (DESCR IPTION=(LOCAL=no)(ADDRESS=(PROTOCOL=BEQ))) crpor11i 34816 0.3 1.0 31924 18896 - A 13:43:29 0:14 oracleCRP (DESCR IPTION=(LOCAL=no)(ADDRESS=(PROTOCOL=BEQ))) root 45198 0.3 7.0 175204 103012 -A Jul 24 67:10 dsmserv quiet root 2888 0.2 0.0 164 36 -A Jul 20 73:42 /usr/sbin/syncd 60 root 47586 0.1 0.0 1296 212 - A Jul 24 26:07 dtgreet crpor11i 27526 0.1 1.0 30372 17336 - A 12:53:46 0:10 oracleCRP (DESCR IPTION=(LOCAL=no)(ADDRESS=(PROTOCOL=BEQ))) Go top

To display processes consuming CPU% & elapsed time ps -aef -o ruser,pid,pcpu,args,etime,

Related Documents


More Documents from ""

Spring Framework
December 2019 60
Bleach - Alones
December 2019 64
Jspintro
December 2019 81
December 2019 156
Naive Bayes.pdf
May 2020 28