Sunday, June 24, 2012

Check memory On Linux

Sometime you as DBA you need to check your memory On Operating System Level, i will give you some command will useful to you :

1-free -m / free -g

m : megabytes
g : gigabytes

              total    used     free   shared  buffers   cached 
 Mem:           503     451       52        0       14      293 
 -/+ buffers/cache:     143      360 
 Swap:         1027       0     1027
 another example :

free -t -m

       total       used       free     shared    buffers     cached
Mem:           750        625        125          0         35        335
-/+ buffers/cache:        253        496
Swap:          956          0        956
Total:        1707        625       1082
2-vmstat

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
1  0      0 131620  35432 341496    0    0    42    82  737  1364 15  3 81  1
 
 
 
 
3-top 
 
 
 

4-gnome-system-monitor
 
 
 
The below Command for clear cache memory in linux 

sync; 
echo 3 > /proc/sys/vm/drop_caches
 you can make it as job in linux save in it crontab 

0 * * * * /root/clearcache.sh
 
Create a file in '/root' called 'clearcache.sh' with the following content:

#!/bin/sh  
 sync; echo 3 > /proc/sys/vm/drop_caches
 
  
Thank you 
osama mustafa 

No comments:

Post a Comment