$ sqlplus system/manager
SQL*Plus: Release 8.1.7.0.0 - Production on Tue Jul 30 13:04:09 2002
(c) Copyright 2000 Oracle Corporation.All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.0.0 – Production
With the Partitioning option
JServer Release 8.1.7.0.0 - Production
SQL> select spid,username,terminal from v$process;
SPID USERNAME TERMINAL
--------- --------------- ------------------------------
365 oracle UNKNOWN
…(details about background processes)
4141 oracle pts/2
10 rows selected.
# su - oracle
Sun Microsystems Inc. SunOS 5.8 Generic February 2000
$ cd /
$ ./memcheck S
Total Shadow(bytes) : 958464
-----
Grand Total (bytes) : 958464
$ ./memcheck B
Total Private (bytes) : 13332480
Total Shared(bytes) : 145223680
-----
Grand Total (bytes) : 158556160
$ ./memcheck SB
Total Shadow(bytes) : 958464
Total Private(bytes) : 13332480
Total Shared(bytes) : 145223680
-----
Grand Total (bytes) : 159514624
$ ./memcheck P 4141
Total Private(bytes) : 1028096
Total Shared(bytes) : 145223680
-----
Grand Total (bytes) : 146251776
#
# check usage
#
if [ $# = "0" ];then
usage;exit 1
fi
Parm1=$1
if [ $Parm1 = "h" ];then
echo "This script uses the Sun Solaris pmap command to determine memory usage"
echo "for Oracle server [B]ackground processes and/or [S]hadow processes."
echo "An individual [P]rocess can also be specified."
echo " "
echo "Although the Oracle server background processes memory usage should"
echo "remain fairly constant, the memory used by any given shadow process"
echo "can vary greatly.This script shows only a snapshot of the current"
echo "memory usage for the processes specified."
echo " "
echo "The 'B' option shows the sum of memory usage for all Oracle server"
echo "background processes, including shared memory like the SGA."
echo " "
echo "The 'S' option shows the sum of private memory usage by all"
echo "shadow processes.It does not include any shared memory like the"
echo "SGA since these are part of the Oracle server background processes."
echo " "
echo "The 'P' option shows memory usage for a specified process, broken"
echo "into two categories, private and shared.If the same executable"
echo "for this process was invoked again, only the private memory"
echo "would be allocated, the rest is shared with the currently running"
echo "process."
echo " "
usage;exit 1
fi
echo $Parm1|grep '[SBP]' > /dev/null
ParmFound=$?
if [ $ParmFound != "0" ];then
usage;exit 1
fi
echo $Parm1|grep P > /dev/null
ParmFound=$?
if [ $ParmFound = "0" ];then
if [ $Parm1 != "P" ];then
usage;exit 1
fi
if [ "X$2" = "X" ];then
usage;exit 1
fi
Parm2=$2
echo $Parm2|grep '[^0-9]' > /dev/null
ParmFound=$?
if [ $ParmFound = "0" ];then
usage;exit 1
fi
PidOwner=`ps -ef | grep -v grep | grep $Parm2 | grep -v $0 | awk '{print $1}'`
CurOwner=`/usr/xpg4/bin/id -un`
if [ "X$PidOwner" != "X$CurOwner" ];then
echo "Not owner of pid $Parm2, or pid $Parm2 does not exist"
echo " "
usage;exit 1
fi
else
if [ "X${ORACLE_SID}" = "X" ];then
echo "You must set ORACLE_SID first"
usage;exit1
fi
fi