Haibin's blog

Archive for the ‘Scripts’ Category

script to calculate the shared memory used by oracle

leave a comment »

Got the following error when starting a new database on solaris 10.


SQL> startup nomount;
ORA-27102: out of memory
SVR4 Error: 22: Invalid argument

There are more than 20 databases running on this server.  The shared memory reached the shrehold defined in /etc/project.
The following script was used to calcuate the total allocated shared memory to Oracle  on the server.


PROJECT="oracle"
SharedMem=`ipcs -Jbm | grep $PROJECT | awk '{print $7}' `

total=0
num=0

for shm in ${SharedMem[@]}
do
total=`expr $total + $shm`
num=`expr $num + 1`
done

echo "shared memory segment used by $PROJECT:  number of segments: $num       total size: $total Bytes"

Written by Haibin Sun

February 15, 2012 at 1:58 PM