如何查询oracle的共享内存,[20190104]ipcs查看共享内存段.txt
[20190104]ipcs查看共享內存段.txt
--//數據庫啟動異常,有時候會留下一些共享內存段沒有清理,需要使用ipcrm清理.
--//由于服務器上跑2個實例,必須選擇正確的共享內存段,否則會導致別的數據庫crash.
--//在我工作中,這是遇到的第2次,做一些復習與整理:
--//在linux下有一個命令sysresv可以查看某實例使用的共享內存段.
$ ipcs
------ Shared Memory Segments --------
key ? ? ? ?shmid ? ? ?owner ? ? ?perms ? ? ?bytes ? ? ?nattch ? ? status
0x00000000 287440897 ?oracle ? ?600 ? ? ? ?12288 ? ? ?2 ? ? ? ? ?dest
0x00000000 287473666 ?oracle ? ?600 ? ? ? ?196608 ? ? 2 ? ? ? ? ?dest
0x00000000 287506435 ?oracle ? ?600 ? ? ? ?12288 ? ? ?2 ? ? ? ? ?dest
0x00000000 287211524 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 287244293 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 287277062 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 287309831 ?oracle ? ?600 ? ? ? ?196608 ? ? 2 ? ? ? ? ?dest
0x00000000 287342600 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 287375369 ?oracle ? ?600 ? ? ? ?196608 ? ? 2 ? ? ? ? ?dest
0x00000000 287408138 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 301334539 ?oracle ? ?640 ? ? ? ?12582912 ? 25
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x00000000 301367308 ?oracle ? ?640 ? ? ? ?633339904 ?25
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0xe8a8ec10 301400077 ?oracle ? ?640 ? ? ? ?2097152 ? ?25
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x790209cd 294617102 ?oracle ? ?666 ? ? ? ?808 ? ? ? ?0
0x79020002 294649871 ?oracle ? ?666 ? ? ? ?808 ? ? ? ?0
------ Semaphore Arrays --------
key ? ? ? ?semid ? ? ?owner ? ? ?perms ? ? ?nsems
0x6aa88594 275578880 ?oracle ? ?640 ? ? ? ?184
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x790209cd 269713409 ?oracle ? ?666 ? ? ? ?1
0x79020002 269746178 ?oracle ? ?666 ? ? ? ?1
------ Message Queues --------
key ? ? ? ?msqid ? ? ?owner ? ? ?perms ? ? ?used-bytes ? messages
$ export ORACLE_SID=book
$ sysresv
IPC Resources for ORACLE_SID "book" :
Shared Memory:
ID ? ? ? ? ? ? ?KEY
301334539 ? ? ? 0x00000000
301367308 ? ? ? 0x00000000
301400077 ? ? ? 0xe8a8ec10
Semaphores:
ID ? ? ? ? ? ? ?KEY
275578880 ? ? ? 0x6aa88594
Oracle Instance alive for sid "book"
--//下劃線內容可以對上.
--//注意執行前最好指定確認ORACLE_SID環境變量.
man ipcrm
-m shmid removes the shared memory segment identified by shmid after the last detach is performed.
--//ipcrm 參數-m 對應 shmid.
--//另外ipcs有一個參數-t參看time.
$ ?ipcs -t
------ Shared Memory Attach/Detach/Change Times --------
shmid ? ? ?owner ? ? ?attached ? ? ? ? ? ? detached ? ? ? ? ? ? changed
287440897 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 17:32:14
287473666 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 17:32:14
287506435 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 17:32:14
287211524 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 15:42:08
287244293 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 15:42:08
287277062 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 15:42:08
287309831 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 15:42:08
287342600 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 15:42:09
287375369 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 15:42:17
287408138 ?oracle ? ? ?Dec 12 17:37:06 ? ? ?Dec 12 17:37:07 ? ? ?Dec ?5 15:42:17
301334539 ?oracle ? ? ?Jan ?4 10:13:32 ? ? ?Jan ?4 10:14:02 ? ? ?Jan ?4 09:53:20
301367308 ?oracle ? ? ?Jan ?4 10:13:32 ? ? ?Jan ?4 10:14:02 ? ? ?Jan ?4 09:53:20
301400077 ?oracle ? ? ?Jan ?4 10:13:32 ? ? ?Jan ?4 10:14:02 ? ? ?Jan ?4 09:53:20
294617102 ?oracle ? ? ?Dec 24 09:22:37 ? ? ?Dec 24 09:22:37 ? ? ?Dec 24 09:22:37
294649871 ?oracle ? ? ?Dec 24 10:03:22 ? ? ?Dec 24 10:08:55 ? ? ?Dec 24 09:23:01
------ Semaphore Operation/Change Times --------
semid ? ?owner ? ? ?last-op ? ? ? ? ? ? ? ? ? ?last-changed
275578880 oracle ? ? ?Fri Jan ?4 10:14:43 2019 ? Fri Jan ?4 10:14:43 2019
269713409 oracle ? ? ?Mon Dec 24 09:22:37 2018 ? Mon Dec 24 09:22:37 2018
269746178 oracle ? ? ?Mon Dec 24 10:08:55 2018 ? Mon Dec 24 09:23:01 2018
------ Message Queues Send/Recv/Change Times --------
msqid ? ?owner ? ? ?send ? ? ? ? ? ? ? ? recv ? ? ? ? ? ? ? ? change
--//我仔細看了一下.如果有用戶連上attached會變化,退出后detached時間也會變化.說明有用戶使用.
--//最后一列changed視乎都不變,不知道是否對應oracle實例的啟動時間.
SYS@book> select startup_time from v$instance ;
STARTUP_TIME
-------------------
2019-01-04 09:53:21
--//視乎可以對上.
--//另外使用oradebug ipc命令也可以查看.
SYS@book> oradebug setmypid
Statement processed.
SYS@book> oradebug ipc
IPC information written to the trace file
SYS@book> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_7252.trc
*** 2019-01-04 10:25:15.026
Processing Oradebug command 'ipc'
Dump of unix-generic skgm context
areaflags ? ? ? ? ? ?000000f7
realmflags ? ? ? ? ? 0000001f
mapsize ? ? ? ? ? ? ?00000800
protectsize ? ? ? ? ?00001000
lcmsize ? ? ? ? ? ? ?00001000
seglen ? ? ? ? ? ? ? 00200000
largestsize ?0000000480000000
smallestsize 0000000000400000
stacklimit ? ? 0x7fffc0268300
stackdir ? ? ? ? ? ? ? ? ? -1
mode ? ? ? ? ? ? ? ? ? ? ?640
magic ? ? ? ? ? ? ? ?acc01ade
Handle: ? ? ? ?0x7f0b488e40b0 `/u01/app/oracle/product/11.2.0.4/dbhome_1book'
--//注意這是句柄,還記得環境變量ORACLE_HOME后面帶斜線的設置導致無法連上數據庫的問題嗎?11.2.0.4已經沒有這個問題了.
$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_1
--//參看鏈接:http://blog.itpub.net/267265/viewspace-2055052/=>[20160310]神奇的斜線.txt
Dump of unix-generic realm handle `/u01/app/oracle/product/11.2.0.4/dbhome_1book', flags = 00000000
Area #0 `Fixed Size' containing Subareas 0-0
Total size 0000000000226c00 Minimum Subarea size 00000000
Area ?Subarea ? ?Shmid ? ? ?Stable Addr ? ? ?Actual Addr
0 ? ? ? ?0 301334539 0x00000060000000 0x00000060000000
Subarea size ? ? Segment size
0000000000227000 0000000000c00000
Area #1 `Variable Size' containing Subareas 4-4
Total size 0000000025c00000 Minimum Subarea size 00400000
Area ?Subarea ? ?Shmid ? ? ?Stable Addr ? ? ?Actual Addr
1 ? ? ? ?4 301367308 0x00000060c00000 0x00000060c00000
Subarea size ? ? Segment size
0000000025c00000 0000000025c00000
Area #2 `Redo Buffers' containing Subareas 1-1
Total size 0000000000724000 Minimum Subarea size 00000000
Area ?Subarea ? ?Shmid ? ? ?Stable Addr ? ? ?Actual Addr
2 ? ? ? ?1 301334539 0x00000060227000 0x00000060227000
Subarea size ? ? Segment size
0000000000724000 0000000000c00000
Area #3 `Base Allocator Control' containing Subareas 3-3
Total size 0000000000002000 Minimum Subarea size 00000000
Area ?Subarea ? ?Shmid ? ? ?Stable Addr ? ? ?Actual Addr
3 ? ? ? ?3 301334539 0x00000060bfe000 0x00000060bfe000
Subarea size ? ? Segment size
0000000000002000 0000000000c00000
Area #4 `Slab Allocator Control' containing Subareas 2-2
Total size 00000000002b3000 Minimum Subarea size 00000000
Area ?Subarea ? ?Shmid ? ? ?Stable Addr ? ? ?Actual Addr
4 ? ? ? ?2 301334539 0x0000006094b000 0x0000006094b000
Subarea size ? ? Segment size
00000000002b3000 0000000000c00000
Area #5 `skgm overhead' containing Subareas 5-5
Total size 0000000000002000 Minimum Subarea size 00000000
Area ?Subarea ? ?Shmid ? ? ?Stable Addr ? ? ?Actual Addr
5 ? ? ? ?5 301400077 0x00000086800000 0x00000086800000
Subarea size ? ? Segment size
0000000000002000 0000000000200000
Dump of Linux-specific skgm context
-------------- system semaphore information -------------
------ Shared Memory Segments --------
key ? ? ? ?shmid ? ? ?owner ? ? ?perms ? ? ?bytes ? ? ?nattch ? ? status
0x00000000 287440897 ?oracle ? ?600 ? ? ? ?12288 ? ? ?2 ? ? ? ? ?dest
0x00000000 287473666 ?oracle ? ?600 ? ? ? ?196608 ? ? 2 ? ? ? ? ?dest
0x00000000 287506435 ?oracle ? ?600 ? ? ? ?12288 ? ? ?2 ? ? ? ? ?dest
0x00000000 287211524 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 287244293 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 287277062 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 287309831 ?oracle ? ?600 ? ? ? ?196608 ? ? 2 ? ? ? ? ?dest
0x00000000 287342600 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 287375369 ?oracle ? ?600 ? ? ? ?196608 ? ? 2 ? ? ? ? ?dest
0x00000000 287408138 ?oracle ? ?600 ? ? ? ?393216 ? ? 2 ? ? ? ? ?dest
0x00000000 301334539 ?oracle ? ?640 ? ? ? ?12582912 ? 26
0x00000000 301367308 ?oracle ? ?640 ? ? ? ?633339904 ?26
0xe8a8ec10 301400077 ?oracle ? ?640 ? ? ? ?2097152 ? ?26
0x790209cd 294617102 ?oracle ? ?666 ? ? ? ?808 ? ? ? ?0
0x79020002 294649871 ?oracle ? ?666 ? ? ? ?808 ? ? ? ?0
------ Semaphore Arrays --------
key ? ? ? ?semid ? ? ?owner ? ? ?perms ? ? ?nsems
0x6aa88594 275578880 ?oracle ? ?640 ? ? ? ?184
0x790209cd 269713409 ?oracle ? ?666 ? ? ? ?1
0x79020002 269746178 ?oracle ? ?666 ? ? ? ?1
------ Message Queues --------
key ? ? ? ?msqid ? ? ?owner ? ? ?perms ? ? ?used-bytes ? messages
--//僅僅前面部分的顯示該實例使用共享內存段.
總結
以上是生活随笔為你收集整理的如何查询oracle的共享内存,[20190104]ipcs查看共享内存段.txt的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 快速幂,矩阵乘法,矩阵快速幂
- 下一篇: networkx 有向图强连通_基于ne