DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: AIX - free memory

  1. #1
    Join Date
    Oct 2002
    Posts
    807

    AIX - free memory

    How do I determine how much of physical memory is NOT being used on an AIX machine? Yes, a "bootinfo -r" tells me how much is physically available. And an "ipcs -a" shows me how much of shared memory is being used by the databases on it. I suppose I can add up values from v$sesstat to determine PGA areas (for dedicated server) as well. All that is a given.

    But how do I tell how much is not being used at the moment? I know that a "vmstat 1" doesn't tell you that either. The FRE column is not indicative of free memory.

  2. #2
    Join Date
    Sep 2001
    Location
    Ohio
    Posts
    334
    Okay, this isn't EXACT, but I use it to give me a rough idea of what memory is being used. A former colleague wrote the original of this, and I have modified it for my own use. It's not terribly pretty - but it works.

    Code:
    #This mem_breakdown is for 9i!!
    export FN=$HOME/shell_scripts/performance/psvg.txt
    export ORACLE_SID=ES_TEST
    
    ps -eo '%z %p %a' |grep -vE 'TIME|defunct' >/$FN
    clear
    lsattr -El sys0|grep realmem|awk '{sum += ($2/1024)} END { printf "Real Memory          =%9.2f \n",sum}'
    ipcs -mb|grep m|awk '{sum += ($7/(1024*1024))} END { print sum}' > $HOME/temp_hold
    awk '{sum += $1/1024} END { print sum}' /$FN >> $HOME/temp_hold
    cat $HOME/temp_hold|awk '{sum += $1} END { printf "Accountable Memory   =%9.2f \n",sum}'
    
    ipcs -mb|grep m|grep -vE 'IPC|dba'|awk '{sum += ($7/(1024*1024))} END { printf "Shared Memory        =%9.2f \n",sum}'
    ipcs -mb|grep dba|awk '{sum += ($7/(1024*1024))} END { printf "SGA Memory           =%9.2f \n",sum}'
    awk '{sum += ($1/1024)} END { printf "TOTAL Process Memory =%9.2f \n",sum}' /$FN
    grep ora_d0 $FN|awk '{sum += ($1/1024)} END { printf "  Dispatchers        =%9.2f \n",sum}'
    grep ora_s0 $FN|awk '{sum += ($1/1024)} END { printf "  Shared Servers     =%9.2f \n",sum}'
    grep ora_p0 $FN|awk '{sum += ($1/1024)} END { printf "  PQ Processes       =%9.2f \n",sum}'
    grep oracle$ORACLE_SID $FN|awk '{sum += ($1/1024)} END { printf "  Dedicated Process  =%9.2f \n",sum}'
    grep -E 'ora_db|ora_i' $FN|awk '{sum += ($1/1024)} END { printf "  DB Writers         =%9.2f \n",sum}'
    grep -E 'ora_sn|ora_cjq' $FN|awk '{sum += ($1/1024)} END { printf "  Oracle Jobs        =%9.2f \n",sum}'
    grep -vE 'ora_d0|ora_s0|ora_p0|oracleES_TEST|ora_db|ora_i|ora_sn|ora_cjq' $FN|grep ora|sort -n +0|awk '{sum += ($1/1024)} END { printf "  Other Oracle       =%9.2f \n",sum}' 
    grep -v ora $FN|awk '{sum += ($1/1024)}  END { printf "  Non Oracle         =%9.2f \n", sum}'
    #rm $HOME/temp_hold
    echo " "
    grep $ORACLE_SID $FN|awk '{sum += (($1)/1024)} END { printf "ES_TEST=%9.2f \n",sum}'
    
    echo "NUMBER OF USERS: "
    grep oracle$ORACLE_SID $FN|wc -l
    You'll have to replace ES_TEST with your oracle SID. It's in there multiple times. I tried to use ORACLE_SID variable everywhere, but it appears grep -E doesn't like env variables.

    If you have any suggestions to make it better, let me know!

    Good Luck!
    Jodie

  3. #3
    Join Date
    Oct 2002
    Posts
    807
    Thank you Jodie. That's a pretty useful script - it does the math for you. I'll let you know if I make changes to it.

    Wish there was just one simple command to tell me how much free memory existed. I mean even windows tells you that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width