How to manually clean up shared memory / semaphors

This procedure may be useful for something like Oracle database, SAP or Peoplesoft when application was shutdown but shared memory hasn't been cleaned up for some reason.

Get the list of all semaphors for a user:

ipcs | grep [username]

Remove (clean up) semaphor:

ipcrm -s [semaphor id]

You can also use the command below to generate a script:

ipcs | grep [username] | awk '{printf("ipcrm -s %s\n", $2);}'