1834051 Members
2277 Online
110063 Solutions
New Discussion

releasing shared memory

 
SOLVED
Go to solution
Jdamian
Respected Contributor

releasing shared memory

Hi

After aborting an Oracle database its shared memory is not release. 'ipcs -ma' command showed

T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:

m 458755 0x00000000 --rw-r----- oracle dba oracle dba 0 673382400 10888 23003 15:50:04 14:40:01

16:40:32
m 2052 0x4ff2cc5c --rw-r----- oracle dba oracle dba 0 441552896 10888 23003 15:50:04 15:50:04

16:40:32

The "NATTACH" is zero.
The shared memory is aprox. 1 GB. Then if oracle tries to start again it reports error messages due to cannot create shared memory segments.

The only way I know is reboot.

Can I release that shared memory in other way ?

Thanx a lot
11 REPLIES 11
Sridhar Bhaskarla
Honored Contributor
Solution

Re: releasing shared memory

Hi,

If you are absolutely sure that oracle is down and if you don't any any db processes with ps -ef|grep ora, then you can use ipcrm to delete the memory segment.

ipcrm -m KEY

Where Key is the second field associated with the corresponding shared memory segment.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
A. Clay Stephenson
Acclaimed Contributor

Re: releasing shared memory

Yoiu can use the ipcrm -m shmid (which you obtained from the ipcs command) to remove the shm segment BUT be warned you have to understand what you are doing. While nattach = 0 is a necessary condition, it may not be a sufficient condition. In your case with Oracle, it's ok but some software expects a shm segment to be already setup but NATTACH = 0 simply means no process is using it now. When the application starts up and looks for the deleted shm identifier it then crashes.
If it ain't broke, I can fix that.
Rainer von Bongartz
Honored Contributor

Re: releasing shared memory


Try ipcrm -m 458755

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Sridhar Bhaskarla
Honored Contributor

Re: releasing shared memory

HI,

I am sure the word "KEY" in my message is confusing. I meant ID which is still the second field. If you want to literally use KEY (third field) to remove the segment, use the option "-M". Sorry about my garbage articulation.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Bill Hassell
Honored Contributor

Re: releasing shared memory

This is an important concept behind shared memory: it must be released by the owner and aborting Oracle is a sure way to leave these areas behind. NEVER abort database programs with kill -9. Not only will shared memory be left assigned to non-existant programs, but partial records and indexes will created, leading to a corrupted database or at least one that needs to be cleaned, a process that could take hours.

ipcrm will indeed remove a segment but as mentioned, you must be sure that all the processes that share this memory are told to shutdown in an orderly manner according too the manufacturer's instructions. Note also that kill -9 is dangerous to the health of the rest of your applications and if any of them use shared memory, the same fate will befall these programs.

Shared memory is a powerful but fragile resource because multiple programs can read/write to this area and the map for shared memory is common to all programs. Ownership, permissions and the ID number keep programs from stomping on other areas but it must be assigned and returned in an orderly manner.


Bill Hassell, sysadmin
Stanimir
Trusted Contributor

Re: releasing shared memory

Hi!
I thing it is good idea first to see all
resources,suspended after Oracle database crash, you can use:
#ipcs
and find all resources,related to this
database, then use:
#ipcrm -m
/or -s, -q ... /

Also after Oracle database crash sometimes
has openned sockets, so you couldnt start
base becouse of this - you need to find them
with #netstat and use #ndd /on hpux 11.0/
for cleaning.

Regards,Stan


Jdamian
Respected Contributor

Re: releasing shared memory

Thanx a lot everyone.

I didn't know ipcrm command because ipcs man pages don't mention it even in the SEE ALSO section.

Bill, I thank you all your advices about 'kill -9' but in my case, the closed database belongs to a testing environment and it was going to be replaced by a copy of a 'good' database (my system is connected to a HP XP512 and it can copy whole disks).
Dietmar Konermann
Honored Contributor

Re: releasing shared memory

You are right. I just reqested to get the SEE ALSO section changed for future releases.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Bill Hassell
Honored Contributor

Re: releasing shared memory

Here's a hint for those man pages that are hard to find: catman

This clever program will index the 1-liner description of selected man pages for searching using man -k. In it's simplest (but slowest) form, run this once a month:

catman 11m234567

Not only will it build a fast index, it will also format every page, thus eliminating the "please wait..." message when formatting man pages. Use -w to skip this option. Look also at the -m (merge) option for adding new man pages to the index. The see also defect would be bypassed with: man -k ipc


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: releasing shared memory

One last hint: shminfo
which will show the complete shared memory map. Unlike ipcs which only shows a certain type of shared memory, shminfo shows memory mapped files, shared libraries, basically everything, and shows how fragmented the 32bit shared memory window can become. Get a copy from:

ftp://contrib:9unsupp8@hprc.external.hp.com/sysadmin/programs/shminfo/


Bill Hassell, sysadmin
Jdamian
Respected Contributor

Re: releasing shared memory

Bill, Thanx a lot for shminfo. it works fine.