How to "kill Semaphore of Oracle Instance" / "Remove Shared memory of Oracle Instnace"



We had Oracle instance running , Pmon of Instance was also visible .
While connecting to Oracle database it looked Normal , But while query V$database.It throws error.

So I had take look into Tail of alert log , Instance was cleanly shutdown. On Attempt to startup it gave below error. 

1.ORA-01081: cannot start already-running ORACLE - shut it down first

So,
·                     PMON is visible,
·                     Alertlog shows clean shutdown of instnace last time.
·                     you cant query even v$database or v$instnace.

This whole scenario leads to conclusion that semaphore of Instance is still locked.

And here we go .

To see how many Oracle symaphores/Shared memory are running. 
01.ipcs | grep oracle
02.m  916291602 0xc0a8ed2c --rw-rw----    oracle       dba
03.m  154730522 0xee8c7308 --rw-rw----    oracle       dba
04.m   34111516 0x8fe194f8 --rw-rw----    oracle       dba
05.m  975011880 0xa1b69514 --rw-rw----    oracle       dba
06.s  237666346 0xe0695054 --ra-ra----    oracle       dba
07.s 1828749356 0x74616ad0 --ra-ra----    oracle       dba
08.s 1802698797 0xf9afd36c --ra-ra----    oracle       dba
09.s 1491337262 0xf40cfa70 --ra-ra----    oracle       dba

To identify which symaphore is connected to which Oracle instance . 
1.echo $ORACLE_SID
2.VVCBDMQ1
sysresv is command to find symaphore attached to Instance.It will also shows shared memory address. 
01.sysresv
02.IPC Resources for ORACLE_SID "VVCBDMQ1" :
03.Shared Memory:
04.ID              KEY
05.34111516        0x8fe194f8    
06.Semaphores:
07.ID              KEY
08.237666346       0xe0695054
09.Oracle Instance not alive for sid "VVCBDMQ1"

To confirm do as below 
1.ipcs -a | grep oracle | grep <id> | grep <key>
2. 
3.ipcs -a | grep oracle | grep 34111516 | grep 0x8fe194f8
4.ipcs -a | grep oracle | grep 237666346 | grep 0xe0695054
5.</key></id>

To clean up symaphore. 
1.ipcrm -s 34111516   <- ID
2.ipcrm -M 0x8fe194f8 <- key
Check again to confirm it. 
01.sysresv
02.IPC Resources for ORACLE_SID "VVCBDMQ1" :
03.Shared Memory
04.ID              KEY
05.No shared memory segments used
06.Semaphores:
07.ID              KEY
08.No semaphore resources used
09.Oracle Instance not alive for sid "VVCBD


No comments:

Post a Comment