free命令将回答所有这些问题。而且,一个非常有用的选项-m可以显示可用内存(以MB为单位)
[root@Think ~]# free -m
total used free shared buffers cached
Mem: 1011 991 19 0 59 661
-/+ buffers/cache: 270 740
Swap: 0 0 0[root@Think ~]# free -b
total used free shared buffers cached
Mem: 1060110336 1039556608 20553728 0 62877696 692731904
-/+ buffers/cache: 283947008 776163328
Swap: 0 0 0[root@Think ~]# free -m -t
total used free shared buffers cached
Mem: 1011 991 19 0 60 660
-/+ buffers/cache: 270 740
Swap: 0 0 0
Total: 1011 991 19[root@Think ~]# free -m | grep Mem | awk \'{print ($3 / $2)*100}\'
97.9228[root@Think ~]# free -m | grep -i Swap | awk \'{print ($3 / $2)*100}\'[root@Think ~]# ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x7402f3d8 4620288 root 600 4 0 0x00000000 4980737 root 644 52 2 0x7402f3d7 4587522 root 600 4 0 0x00000000 5013507 root 644 16384 2 0x00000000 5046276 root 644 268 2 0x00000000 5111813 root 600 393216 2 dest 0x00000000 5144582 root 600 393216 2 dest 0x00000000 5177351 root 600 393216 2 dest 0x00000000 5439503 root 600 393216 2 dest 0x00000000 5472272 root 600 393216 2 dest 0xbe3bb918 5505041 oracle 640 419438592 20
[root@Think ~]# ipcs -mu ------ Shared Memory Status -------- segments allocated 18 pages allocated 103562 pages resident 36482 pages swapped 0 Swap performance: 0 attempts 0 successes
[root@Think ~]# ipcs -ml ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 524288 max total shared memory (kbytes) = 8388608 min seg size (bytes) = 1
[root@Think ~]# ipcs -m -i 5505041 Shared memory Segment shmid=5505041 uid=501 gid=502 cuid=501 cgid=502 mode=0640 access_perms=0640 bytes=419438592 lpid=10881 cpid=5300 nattch=20 att_time=Sun Feb 3 20:58:28 2013 det_time=Sun Feb 3 20:58:28 2013 change_time=Sun Feb 3 09:08:06 2013
[root@Think ~]# ipcs -s ------ Semaphore Arrays -------- key semid owner perms nsems 0x000000a7 0 root 600 1 0xf5d4b884 131073 oracle 640 154他显示一些有价值的数据,显示ID为0的信号组具有1个信号,另一个信号组有154个信号
sys@ORCL> oradebug setmypid Statement processed. sys@ORCL> oradebug ipc Information written to trace file. sys@ORCL> oradebug TRACEFILE_NAME /u01/app/oracle/admin/orcl/udump/orcl_ora_7525.trc
Area #0 `Fixed Size\' containing Subareas 0-0
Total size 0000000000129cb0 Minimum Subarea size 00000000
Area Subarea Shmid Stable Addr Actual Addr
0 0 5505041 0x00000020000000 0x00000020000000
Subarea size Segment size
000000000012a000 0000000019002000
Area #1 `Variable Size\' containing Subareas 2-2
Total size 0000000018c00000 Minimum Subarea size 00400000
Area Subarea Shmid Stable Addr Actual Addr
1 2 5505041 0x00000020400000 0x00000020400000
Subarea size Segment size
0000000018c00000 0000000019002000
Area #2 `Redo Buffers\' containing Subareas 1-1
Total size 00000000002d6000 Minimum Subarea size 00000000
Area Subarea Shmid Stable Addr Actual Addr
2 1 5505041 0x0000002012a000 0x0000002012a000
Subarea size Segment size
00000000002d6000 0000000019002000[oracle@Think ~]$ sqlplus / as sysdba sys@ORCL> select spid from v$process where addr = (select paddr from v$session where sid = (select sid from v$mystat where rownum<2)); SPID ------------ 11439
[root@Think ~]# ipcs -m -i 5505041 Shared memory Segment shmid=5505041 uid=501 gid=502 cuid=501 cgid=502 mode=0640 access_perms=0640 bytes=419438592 lpid=11476 cpid=5300 nattch=20 att_time=Sun Feb 3 21:25:31 2013 det_time=Sun Feb 3 21:25:31 2013 change_time=Sun Feb 3 09:08:06 2013
[root@Think ~]# ipcrm -m 3735562 ipcrm: already removed id (3735562)
[root@Think ~]# vmstat 5 10 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 38576 76284 639688 0 0 25 24 98 186 1 1 97 1 0 0 0 0 38532 76292 639716 0 0 0 22 102 194 0 0 99 0 0 0 0 0 38516 76292 639720 0 0 0 13 99 187 0 0 99 0 0 0 0 0 38524 76300 639720 0 0 0 68 121 232 1 0 99 0 0 0 0 0 38524 76304 639720 0 0 0 16 165 298 1 1 99 0 0 0 0 0 38540 76308 639720 0 0 0 16 84 176 0 0 99 0 0 0 0 0 38524 76316 639840 0 0 0 81 94 187 0 0 99 0 0 1 0 0 38404 76324 639848 0 0 0 17 89 181 0 0 100 0 0 0 0 0 38404 76324 639848 0 0 0 13 93 180 0 0 99 0 0 2 0 0 38420 76328 639848 0 0 0 11 220 364 1 1 99 0 0






来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26515977/viewspace-1207986/ ,如需转载,请注明出处,否则将追究法律责任。