[20191119]探究ipcs命令输出.txt
[20191119]探究ipcs命令输出.txt
$ man ipcs
IPCS(8) Linux Programmer's Manual IPCS(8)
NAME
ipcs - provide information on ipc facilities
SYNOPSIS
ipcs [ -asmq ] [ -tclup ]
ipcs [ -smq ] -i id
ipcs -h
DESCRIPTION
ipcs provides information on the ipc facilities for which the calling process has read access.
The -i option allows a specific resource id to be specified. Only information on this id will be printed.
Resources may be specified as follows:
-m shared memory segments
-q message queues
-s semaphore arrays
-a all (this is the default)
The output format may be specified as follows:
-t time
-p pid
-c creator
-l limits
-u summary
--//ipcs主要用来显示shared memory segments(-m)以及semaphore arrays(-s)
--//好像message queues(-q)没有相关信息.由于oracle使用要使用shared memory segments,而且配置需求很大,一些发布版本要修改
--//参数文件/etc/sysctl.conf,满足应用需求.很少人具体了解一些内核参数具体含义,仅仅copy and paste来安装配置数据库,
--//而且现在的安装如果不满足条件,oracle会提示如何修改相关参数.自己根据学习做一些测试.千万不要在生产系统做这些测试!!
--//从网上转抄的:
set kernel parameters by adding the following lines in "/etc/sysctl.conf"
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
--//kernel.shmall * kernel.shmmni = 2097152*4096 = 8589934592
--//8589934592/1024/1024/1024 = 8G
shmmax-> This parameter represents the size in bytes of a single shared memory segment
shmmni-> This parameter represents total no.of shared memory segments system wide(4096 is most probably enough)
shmall-> We specify this parameter in pages. The SHMALL defines the largest amount of shared memory pages that can be
used at one time on the system.
kernel.sem -> This parameter is related to semaphores
e.g.,
kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
where
semmsl: The number of semaphores per set
semmns: The total number of semaphores available
semopm: The number of operations which can be made per semaphore call
semmni: The maximum number of shared memory segments available in the system
--//主要学习了解如下参数,因为这些与ipcs命令输出有关.
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
--//为了测试方便,我建立了实例文件并没有数据文件.
$ cat /tmp/test.ora
test.__db_cache_size=1258291200
test.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
test.__shared_pool_size=1048576000
*.db_name='test'
*.processes=2596
*.sga_target=2500M
*.undo_management='auto'
--//注:test.__shared_pool_size=1G,test.__db_cache_size=1.2G.
--//内核相关参数配置如下:
# grep "^kernel.s[he]" /etc/sysctl.conf
##kernel.shmmax = 68719476736 -> 与下面重复了
kernel.shmall = 4294967296
kernel.shmmax = 19327352832
kernel.shmmni = 4096
kernel.sem = 2600 332800 2600 128
--//68719476736/1024/1024/1024 = 64G
--//4294967296/1024/1024/1024 = 4G
--//19327352832/1024/1024/1024 = 18G
--//注:你可以发现我配置kernel.shmmax重复,最后1个配置有效.
1.测试1:
--//首先关闭一些测试库,避免影响.修改环境变量ORACLE_SID=test.
$ export ORACLE_SID=test
$ ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
------ Semaphore Arrays --------
key semid owner perms nsems
------ Message Queues --------
key msqid owner perms used-bytes messages
SYS@test> startup nomount pfile='/tmp/@.ora';
ORACLE instance started.
Total System Global Area 2622255104 bytes
Fixed Size 2256112 bytes
Variable Size 1124074256 bytes
Database Buffers 1476395008 bytes
Redo Buffers 19529728 bytes
$ ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 401735681 oracle 640 33554432 18
0x00000000 401768450 oracle 640 167772160 18
0x00000000 401801219 oracle 640 16777216 18
0x00000000 401833989 oracle 640 2415919104 18
0x8a931fb8 401866758 oracle 640 2097152 18
------ Semaphore Arrays --------
key semid owner perms nsems
0xc13ea218 326893568 oracle 640 2600
------ Message Queues --------
key msqid owner perms used-bytes messages
--//你可以发现建立5个Shared Memory Segments.nattch表示进程连接数量.
--//实际上你看连接数量有多少,直接看ipcs 的nattch就很快.而不用执行下面命令.
# ps -ef | grep "tes[t]" |wc
18 145 1163
--//查看Semaphore Arrays.
$ ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
0xc13ea218 326893568 oracle 640 2600
$ ipcs -s -i 326893568
Semaphore Array semid=326893568
uid=502 gid=502 cuid=502 cgid=502
mode=0640, access_perms=0640
nsems = 2600
otime = Tue Nov 19 09:26:22 2019
ctime = Tue Nov 19 09:26:22 2019
semnum value ncount zcount pid
0 0 0 0 52844
1 2559 0 0 52844
2 19574 0 0 52844
3 1 0 0 52844
4 0 0 0 0
5 0 0 0 0
6 0 0 0 0
7 0 1 0 52849
8 0 0 0 0
9 0 1 0 52855
10 0 1 0 0
11 0 1 0 0
12 0 1 0 0
13 0 1 0 52863
14 0 1 0 0
15 0 1 0 0
16 0 1 0 0
17 0 1 0 0
18 0 1 0 52873
19 0 1 0 0
20 0 1 0 0
21 0 1 0 52879
22 0 1 0 0
23 0 0 0 0
24 0 0 0 52885
25 0 0 0 52887
...--//截断.
2590 0 0 0 0
2591 0 0 0 0
2592 0 0 0 0
2593 0 0 0 0
2594 0 0 0 0
2595 0 0 0 0
2596 0 0 0 0
2597 0 0 0 0
2598 0 0 0 0
2599 0 0 0 52844
--//查看sem可以发现nsems=2600,实际上我数据库参数文件中定义*.processes=2596,多出4个与参数kernel.sem = 2600 332800 2600 128 的SEMMSL.
--//kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
--//semmsl: The number of semaphores per set ,你可以理解每一个进程有需要一个信号与共享内存段通讯.这个参数与oracle的processes有关.
$ ipcs -s -i 326893568 | awk '/semnum/,/^2599/' | awk '$5>0 {print $5}' | sort | uniq -c
5 52844
1 52849
1 52855
1 52863
1 52873
1 52879
1 52885
1 52887
1 pid
--//并没有18个进程与信号对应.而且并没有pid=52844进程.也许仅仅安装到nomount的缘故.
$ ps -fp 52844
UID PID PPID C STIME TTY TIME CMD
$ ps -eLf | grep "tes[t]" | sort -nk2
UID PID PPID LWP C NLWP STIME TTY TIME CMD
oracle 52847 1 52847 0 1 09:26 ? 00:00:00 ora_pmon_test
oracle 52849 1 52849 0 1 09:26 ? 00:00:00 ora_psp0_test
oracle 52851 1 52851 1 1 09:26 ? 00:00:19 ora_vktm_test
oracle 52855 1 52855 0 1 09:26 ? 00:00:00 ora_gen0_test
oracle 52857 1 52857 0 1 09:26 ? 00:00:00 ora_diag_test
oracle 52859 1 52859 0 1 09:26 ? 00:00:00 ora_dbrm_test
oracle 52861 1 52861 0 1 09:26 ? 00:00:05 ora_dia0_test
oracle 52863 1 52863 0 1 09:26 ? 00:00:00 ora_mman_test
oracle 52865 1 52865 0 1 09:26 ? 00:00:00 ora_dbw0_test
oracle 52867 1 52867 0 1 09:26 ? 00:00:00 ora_dbw1_test
oracle 52869 1 52869 0 1 09:26 ? 00:00:00 ora_dbw2_test
oracle 52871 1 52871 0 1 09:26 ? 00:00:00 ora_lgwr_test
oracle 52873 1 52873 0 1 09:26 ? 00:00:00 ora_ckpt_test
oracle 52875 1 52875 0 1 09:26 ? 00:00:00 ora_smon_test
oracle 52877 1 52877 0 1 09:26 ? 00:00:00 ora_reco_test
oracle 52879 1 52879 0 1 09:26 ? 00:00:00 ora_mmon_test
oracle 52881 1 52881 0 1 09:26 ? 00:00:01 ora_mmnl_test
oracle 52882 52843 52882 0 1 09:26 ? 00:00:00 oracletest (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
$ ipcs -m -p
------ Shared Memory Creator/Last-op --------
shmid owner cpid lpid
401735681 oracle 52844 52893
401768450 oracle 52844 52893
401801219 oracle 52844 52893
401833989 oracle 52844 52893
401866758 oracle 52844 52893
--//加入-p参数可以发现cpid(Creator)是52844.而lpid(Last-op)是52893(这个进程也不存在)
--//如果看ps -eLF最后一行PPID=52843,也就是建立Shared Memory Segments的进程已经消失.
--//启动一个新连接看看.
SYS@test> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---------- ---------- ------- ------------------ ------ ------- ---------- --------------------------------------------------
3281 3 53194 DEDICATED 53195 20 2 alter system kill session '3281,3' immediate;
SYS@test> select sysdate from dual ;
SYSDATE
-------------------
2019-11-19 09:59:51
$ ipcs -m -p
------ Shared Memory Creator/Last-op --------
shmid owner cpid lpid
401735681 oracle 52844 53195
401768450 oracle 52844 53195
401801219 oracle 52844 53195
401833989 oracle 52844 53195
401866758 oracle 52844 53195
--//SPID=53195,这次可以对上,估计在nomount阶段,一些进程完成某些操作已经退出.
$ ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 401735681 oracle 640 33554432 19
0x00000000 401768450 oracle 640 167772160 19
0x00000000 401801219 oracle 640 16777216 19
0x00000000 401833989 oracle 640 2415919104 19
0x8a931fb8 401866758 oracle 640 2097152 19
------ Semaphore Arrays --------
key semid owner perms nsems
0xc13ea218 326893568 oracle 640 2600
------ Message Queues --------
key msqid owner perms used-bytes messages
--//nattch=19,增加1个链接.
--//另外还有一个参数-t,可以显示时间.
$ ipcs -t
------ Shared Memory Attach/Detach/Change Times --------
shmid owner attached detached changed
401735681 oracle Nov 19 09:55:49 Nov 19 09:27:47 Nov 19 09:26:11
401768450 oracle Nov 19 09:55:49 Nov 19 09:27:47 Nov 19 09:26:11
401801219 oracle Nov 19 09:55:49 Nov 19 09:27:47 Nov 19 09:26:11
401833989 oracle Nov 19 09:55:49 Nov 19 09:27:47 Nov 19 09:26:11
401866758 oracle Nov 19 09:55:49 Nov 19 09:55:49 Nov 19 09:26:11
------ Semaphore Operation/Change Times --------
semid owner last-op last-changed
326893568 oracle Tue Nov 19 09:26:22 2019 Tue Nov 19 09:26:22 2019
------ Message Queues Send/Recv/Change Times --------
msqid owner send recv change
--//你可以从这些时间判断是否存在活动.
2.测试2:
--//我前面定义kernel.shmmax = 19327352832 等于18G,如果定义很小会什么问题呢?
--//假如定义kernel.shmmax=100M,也就是100*1024*1024 = 104857600,实际上就建立许多Shared Memory Segments,实际使用不会有什么问题,
--//这也是为什么许多文档设置该参数为机器物理内存的1半的缘故.
--//当然最好避免建立许多Shared Memory Segments.相互通讯应该有开销,还有就是Attach/Detach需要一点点时间(也就是影响登录与退出)
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmall = 4294967296
kernel.shmmax = 104857600
kernel.shmmni = 4096
kernel.sem = 2600 332800 2600 128
# sysctl -p
--//重新启动实例到nomount看看.
$ ps -ef | grep sqlplus | grep sysdb[a]
oracle 52843 52842 0 09:26 pts/10 00:00:00 /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/sqlplus as sysdba
--//使用strace跟踪pid=52843.
$ strace -f -p 52843 -e ipc -o /tmp/52843.txt
SYS@test> startup nomount pfile='/tmp/@.ora';
ORACLE instance started.
Total System Global Area 2622255104 bytes
Fixed Size 2256112 bytes
Variable Size 1124074256 bytes
Database Buffers 1476395008 bytes
Redo Buffers 19529728 bytes
$ strace -f -p 52843 -e ipc -o /tmp/52843.txt
Process 52843 attached - interrupt to quit
Process 53315 attached
Process 53316 attached
Process 53316 detached
Process 53317 attached
Process 53318 attached
Process 53317 detached
Process 53319 attached
Process 53320 attached
Process 53319 detached
Process 53321 attached
Process 53322 attached (waiting for parent)
Process 53322 resumed (parent 53321 ready)
Process 53321 detached
Process 53323 attached
Process 53322 suspended
Process 53324 attached (waiting for parent)
Process 53324 resumed (parent 53323 ready)
Process 53322 resumed
Process 53323 detached
Process 53324 detached
Process 53325 attached
Process 53326 attached (waiting for parent)
Process 53326 resumed (parent 53325 ready)
Process 53325 detached
Process 53327 attached (waiting for parent)
Process 53327 resumed (parent 53320 ready)
Process 53328 attached (waiting for parent)
Process 53328 resumed (parent 53327 ready)
Process 53327 detached
Process 53329 attached
Process 53330 attached
Process 53329 detached
Process 53331 attached
Process 53332 attached
Process 53331 detached
Process 53333 attached
Process 53334 attached
Process 53333 detached
Process 53335 attached
Process 53336 attached
Process 53335 detached
Process 53337 attached
Process 53338 attached
Process 53337 detached
Process 53339 attached
Process 53340 attached
Process 53339 detached
Process 53341 attached
Process 53342 attached
Process 53341 detached
Process 53343 attached
Process 53344 attached
Process 53343 detached
Process 53345 attached
Process 53346 attached (waiting for parent)
Process 53346 resumed (parent 53345 ready)
Process 53345 detached
Process 53347 attached
Process 53348 attached
Process 53347 detached
Process 53349 attached
Process 53350 attached
Process 53349 detached
Process 53351 attached
Process 53352 attached (waiting for parent)
Process 53352 resumed (parent 53351 ready)
Process 53351 detached
Process 53353 attached
Process 53315 detached
Process 53354 attached
Process 53355 attached
Process 53354 detached
Process 53356 attached
Process 53357 attached (waiting for parent)
Process 53357 resumed (parent 53356 ready)
Process 53356 detached
Process 53355 detached
Process 53357 detached
$ ipcs -a
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 401932289 oracle 640 33554432 18
0x00000000 401965058 oracle 640 100663296 18
0x00000000 401997827 oracle 640 50331648 18
0x00000000 402030597 oracle 640 33554432 18
0x00000000 402063366 oracle 640 100663296 18
0x00000000 402096135 oracle 640 100663296 18
0x00000000 402128904 oracle 640 100663296 18
0x00000000 402161673 oracle 640 100663296 18
0x00000000 402194442 oracle 640 100663296 18
0x00000000 402227211 oracle 640 100663296 18
0x00000000 402259980 oracle 640 100663296 18
0x00000000 402292749 oracle 640 100663296 18
0x00000000 402325518 oracle 640 100663296 18
0x00000000 402358287 oracle 640 100663296 18
0x00000000 402391056 oracle 640 100663296 18
0x00000000 402423825 oracle 640 100663296 18
0x00000000 402456594 oracle 640 100663296 18
0x00000000 402489363 oracle 640 100663296 18
0x00000000 402522132 oracle 640 100663296 18
0x00000000 402554901 oracle 640 100663296 18
0x00000000 402587670 oracle 640 100663296 18
0x00000000 402620439 oracle 640 100663296 18
0x00000000 402653208 oracle 640 100663296 18
0x00000000 402685977 oracle 640 100663296 18
0x00000000 402718746 oracle 640 100663296 18
0x00000000 402751515 oracle 640 100663296 18
0x00000000 402784284 oracle 640 100663296 18
0x00000000 402817053 oracle 640 100663296 18
0x8a931fb8 402849822 oracle 640 2097152 18
--//注意仅仅1个key有值0x8a931fb8.
------ Semaphore Arrays --------
key semid owner perms nsems
0xc13ea218 327057408 oracle 640 2600
------ Message Queues --------
key msqid owner perms used-bytes messages
$ ipcs -m -p
------ Shared Memory Creator/Last-op --------
shmid owner cpid lpid
401932289 oracle 53315 53357
401965058 oracle 53315 53357
401997827 oracle 53315 53357
402030597 oracle 53315 53357
402063366 oracle 53315 53357
402096135 oracle 53315 53357
402128904 oracle 53315 53357
402161673 oracle 53315 53357
402194442 oracle 53315 53357
402227211 oracle 53315 53357
402259980 oracle 53315 53357
402292749 oracle 53315 53357
402325518 oracle 53315 53357
402358287 oracle 53315 53357
402391056 oracle 53315 53357
402423825 oracle 53315 53357
402456594 oracle 53315 53357
402489363 oracle 53315 53357
402522132 oracle 53315 53357
402554901 oracle 53315 53357
402587670 oracle 53315 53357
402620439 oracle 53315 53357
402653208 oracle 53315 53357
402685977 oracle 53315 53357
402718746 oracle 53315 53357
402751515 oracle 53315 53357
402784284 oracle 53315 53357
402817053 oracle 53315 53357
402849822 oracle 53315 53357
--//共建立29个Shared Memory Segments.如果你看前面的strace,就可以发现cpid,lpid对应进程号.
$ ipcs -m -p | grep oracle|wc
29 116 1276
SYS@test> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---- ---------- ------- --------- ------ ------- ---------- --------------------------------------------------
3117 1 52843 DEDICATED 53353 19 1 alter system kill session '3117,1' immediate;
SYS@test> quit
$ grep 53353 /tmp/52843.txt | egrep "shmat|shmdt"
53353 shmat(402849822, 0, 0) = ?
53353 shmdt(0x7f9410123000) = 0
53353 shmat(402849822, 0xfd000000, 0) = ?
53353 shmat(401932289, 0x60000000, 0) = ?
53353 shmat(401965058, 0x62000000, 0) = ?
53353 shmat(401997827, 0x68000000, 0) = ?
53353 shmat(402030597, 0x6b000000, 0) = ?
53353 shmat(402063366, 0x6d000000, 0) = ?
53353 shmat(402096135, 0x73000000, 0) = ?
53353 shmat(402128904, 0x79000000, 0) = ?
53353 shmat(402161673, 0x7f000000, 0) = ?
53353 shmat(402194442, 0x85000000, 0) = ?
53353 shmat(402227211, 0x8b000000, 0) = ?
53353 shmat(402259980, 0x91000000, 0) = ?
53353 shmat(402292749, 0x97000000, 0) = ?
53353 shmat(402325518, 0x9d000000, 0) = ?
53353 shmat(402358287, 0xa3000000, 0) = ?
53353 shmat(402391056, 0xa9000000, 0) = ?
53353 shmat(402423825, 0xaf000000, 0) = ?
53353 shmat(402456594, 0xb5000000, 0) = ?
53353 shmat(402489363, 0xbb000000, 0) = ?
53353 shmat(402522132, 0xc1000000, 0) = ?
53353 shmat(402554901, 0xc7000000, 0) = ?
53353 shmat(402587670, 0xcd000000, 0) = ?
53353 shmat(402620439, 0xd3000000, 0) = ?
53353 shmat(402653208, 0xd9000000, 0) = ?
53353 shmat(402685977, 0xdf000000, 0) = ?
53353 shmat(402718746, 0xe5000000, 0) = ?
53353 shmat(402751515, 0xeb000000, 0) = ?
53353 shmat(402784284, 0xf1000000, 0) = ?
53353 shmat(402817053, 0xf7000000, 0) = ?
53353 shmdt(0x60000000) = 0
53353 shmdt(0x62000000) = 0
53353 shmdt(0x68000000) = 0
53353 shmdt(0x6b000000) = 0
53353 shmdt(0x6d000000) = 0
53353 shmdt(0x73000000) = 0
53353 shmdt(0x79000000) = 0
53353 shmdt(0x7f000000) = 0
53353 shmdt(0x85000000) = 0
53353 shmdt(0x8b000000) = 0
53353 shmdt(0x91000000) = 0
53353 shmdt(0x97000000) = 0
53353 shmdt(0x9d000000) = 0
53353 shmdt(0xa3000000) = 0
53353 shmdt(0xa9000000) = 0
53353 shmdt(0xaf000000) = 0
53353 shmdt(0xb5000000) = 0
53353 shmdt(0xbb000000) = 0
53353 shmdt(0xc1000000) = 0
53353 shmdt(0xc7000000) = 0
53353 shmdt(0xcd000000) = 0
53353 shmdt(0xd3000000) = 0
53353 shmdt(0xd9000000) = 0
53353 shmdt(0xdf000000) = 0
53353 shmdt(0xe5000000) = 0
53353 shmdt(0xeb000000) = 0
53353 shmdt(0xf1000000) = 0
53353 shmdt(0xf7000000) = 0
53353 shmdt(0xfd000000) = 0
--//你可以1个连接要调用shmat attach共享内存段29次,而退出连接一个使用shmdt函数29次.总之尽量避免设置kernel.shmmax过小.
3.测试3:
shmmni-> This parameter represents total no.of shared memory segments system wide(4096 is most probably enough)
--//此参数表示系统范围内共享内存段的总数(4096很可能足够),我以前使用它与shmall相乘完全是理解错误.因为它正好定义是4096.
--//先测试修改kernel.shmmni = 28看看.
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmall = 4294967296
kernel.shmmax = 104857600
kernel.shmmni = 28
kernel.sem = 2600 332800 2600 128
# sysctl -p
SYS@test> startup nomount pfile='/tmp/@.ora';
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
Additional information: 100663296
Additional information: 1
--//增加3个看看.注我测试时忽略1个问题,已经存在2个shared memory segments.使用root用户就可以发现,oracle用户看不到如下信息.
# ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x740202db 2523136 root 600 4 0
0x00000000 348422148 gdm 600 393216 2 dest
------ Semaphore Arrays --------
key semid owner perms nsems
------ Message Queues --------
key msqid owner perms used-bytes messages
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmall = 4294967296
kernel.shmmax = 104857600
kernel.shmmni = 31
kernel.sem = 2600 332800 2600 128
# sysctl -p
SYS@test> startup nomount pfile='/tmp/@.ora';
ORACLE instance started.
Total System Global Area 2622255104 bytes
Fixed Size 2256112 bytes
Variable Size 1124074256 bytes
Database Buffers 1476395008 bytes
Redo Buffers 19529728 bytes
--//OK.这样就可以很准确验证自己的判断.
4.测试4:
--//kernel.shmall 参数.
shmall-> We specify this parameter in pages. The SHMALL defines the largest amount of shared memory pages that can be
used at one time on the system.
--//这个定义最大shared memory pages数量.每页4096.也就是shmall*4096表示当前服务器最大共享内存段大小.
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmall = 4294967296
kernel.shmmax = 19327352832
kernel.shmmni = 4096
kernel.sem = 2600 332800 2600 128
--//我的定义超大,实际上以前对参数不理解.kernel.shmall = 4294967296
--//4294967296*4096/1024/1024/1024 = 16384G.
--//实际上这个参数表示总的sga使用量,也许还要大一些.
--//我当前数据库定义
*.sga_target=2500M
--//假设定义2400*1024*1024/4096 = 614400,相当于2400M.
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmall = 614400
kernel.shmmax = 19327352832
kernel.shmmni = 4096
kernel.sem = 2600 332800 2600 128
# sysctl -p
SYS@test> startup nomount pfile='/tmp/@.ora';
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
Additional information: -1879048192
Additional information: 1
--//如果修改如下:2600*1024*1024/4096 = 665600
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmall = 665600
kernel.shmmax = 19327352832
kernel.shmmni = 4096
kernel.sem = 2600 332800 2600 128
# sysctl -p
SYS@test> startup nomount pfile='/tmp/@.ora';
ORACLE instance started.
Total System Global Area 2622255104 bytes
Fixed Size 2256112 bytes
Variable Size 1124074256 bytes
Database Buffers 1476395008 bytes
Redo Buffers 19529728 bytes
--//OK启动正常.
# ipcs -m| grep "^0x" | awk '{print $5/4096}'
0.000976562
8192
40960
4096
96
589824
512
# ipcs -m| grep "^0x" | awk '{print $5/4096}'| paste -sd+| bc -l
643680.000976562
--//也就是我定义643681可以启动数据库,小于643681无法启动数据库.
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmall = 643681
kernel.shmmax = 19327352832
kernel.shmmni = 4096
kernel.sem = 2600 332800 2600 128
# sysctl -p
SYS@test> startup nomount pfile='/tmp/@.ora';
ORACLE instance started.
Total System Global Area 2622255104 bytes
Fixed Size 2256112 bytes
Variable Size 1124074256 bytes
Database Buffers 1476395008 bytes
Redo Buffers 19529728 bytes
--//OK可以启动数据库.
--//减少1个看看.
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmall = 643680
kernel.shmmax = 19327352832
kernel.shmmni = 4096
kernel.sem = 2600 332800 2600 128
# sysctl -p
SYS@test> startup nomount pfile='/tmp/@.ora';
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
Additional information: 2097152
--//OK.验证自己的判断.
--//还原内核参数.
# grep "^kernel.s[he]" /etc/sysctl.conf
kernel.shmmax = 68719476736
kernel.shmall = 4294967296 -->不改小了.
kernel.shmmni = 4096
kernel.sem = 2600 332800 2600 128
# sysctl -p
5.sysrev命令
--//另外oracle提供1个sysresv 命令.
$ sysresv -h
sysresv: invalid option -- h
usage : sysresv [-if] [-d <on/off>] [-l sid1 <sid2> ...]
-i : Prompt before removing ipc resources for each sid
-f : Remove ipc resources silently, oevrrides -i option
-d <on/off> : List ipc resources for each sid if on
-l sid1 <sid2> .. : apply sysresv to each sid
Default : sysresv -d on -l $ORACLE_SID
Note : ipc resources will be attempted to be deleted for a
sid only if there is no currently running instance
with that sid.
$ sysresv -l test
IPC Resources for ORACLE_SID "test" :
Shared Memory:
ID KEY
406683649 0x00000000
406716418 0x00000000
406749187 0x00000000
406781957 0x00000000
406814726 0x8a931fb8
Semaphores:
ID KEY
327647232 0xc13ea218
Oracle Instance alive for sid "test"
--//才发现sysresv命令-f参数可以Remove ipc resources.而且这个命令相对安全.
$ sysresv -f -l test
IPC Resources for ORACLE_SID "test" :
Shared Memory:
ID KEY
406683649 0x00000000
406716418 0x00000000
406749187 0x00000000
406781957 0x00000000
406814726 0x8a931fb8
Semaphores:
ID KEY
327647232 0xc13ea218
Oracle Instance alive for sid "test"
SYSRESV-005: Warning
Instance maybe alive - aborting remove for sid "test"
--//监测alive,移除ipc失败.
$ sysresv -if -l test
IPC Resources for ORACLE_SID "test" :
Shared Memory:
ID KEY
406683649 0x00000000
406716418 0x00000000
406749187 0x00000000
406781957 0x00000000
406814726 0x8a931fb8
Semaphores:
ID KEY
327647232 0xc13ea218
Oracle Instance alive for sid "test"
SYSRESV-005: Warning
Instance maybe alive - aborting remove for sid "test"
总结:
--//剩下kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI没写,下一篇了.再次摘抄前面内容:
shmmax-> This parameter represents the size in bytes of a single shared memory segment
shmmni-> This parameter represents total no.of shared memory segments system wide(4096 is most probably enough)
shmall-> We specify this parameter in pages. The SHMALL defines the largest amount of shared memory pages that can be
used at one time on the system.
--//我自己仅仅希望这些测试很好理解这些参数的具体含义以及ipcs的相关输出.
[20191119]探究ipcs命令输出.txt的更多相关文章
- [20191119]探究ipcs命令输出2.txt
[20191119]探究ipcs命令输出2.txt --//继续上午的测试:http://blog.itpub.net/267265/viewspace-2664758/=>[20191119] ...
- 如何将cmd中命令输出保存为TXT文本文件
在使用Windows 中的cmd.exe工具时,有时候我们想要把我们的输入命令及结果保存起来, 但是用复制的方法过于麻烦:有时输出数据条数过大,会造成内容自动滚出屏幕,无法阅读,我们可将命令运行的结果 ...
- 将 cmd 中命令输出内容保存为 TXT 文本文件
如果执行的命令输出内容较多,那么 cmd 控制台将会自动清除前面的内容,那么如何将屏幕的所有内容导出到文本文件? 下面给出简单的演示例子 ping百度,不会自动结束,按 Ctrl+C 强制结束,pin ...
- 【Linux开发】将cmd中命令输出保存为TXT文本文件
将cmd中命令输出保存为TXT文本文件 在网上看到一篇名为:"[转载]如何将cmd中命令输出保存为TXT文本文件" 例如:将Ping命令的加长包输出到D盘的ping.txt文本文件 ...
- pip freeze > requirements.txt` 命令输出文件中出现文件路径而非版本号
pip freeze > requirements.txt 命令输出文件中出现文件路径而非版本号 解决办法: pip list --format=freeze > requirements ...
- shell 脚本之获取命令输出字符串以及函数参数传递
在ubuntu 14.04之后,所有的U盘挂载也分用户之分,最近很多操作也和U盘有关,所以就研究了一上午shell脚本函数以及字符串操作的方法. 字符串操作: 获取他的命令输出比较简单,打个简单的比方 ...
- Matlab读取cifar10 train_quick.sh输出txt中信息
感谢 网友 Vagrant的提醒.之前 一直就看个最后的accuracy.这个应该并不靠谱.最好把说有的信息都看一下.而一个一个看.根本记不住.只能把数据读取在图片中显示一下,才比较直观. 本文就是读 ...
- linux C程序中获取shell脚本输出(如获取system命令输出)
转载自 http://blog.csdn.net/hjxhjh/article/details/7909518 1. 前言 Unix 界有一句名言:“一行shell脚本胜过万行C程序”,虽然这句话有些 ...
- ipcs命令以及oracle内存段
今天是2014-01-06,在没过春节之前重新复习一下2013年学习的内容,关于oracle内存段在我之前写的blog中有详细操作.在此记录一下ipcs命令的用法. http://blog.csdn. ...
随机推荐
- 微信 电脑版 HOOK(WeChat PC Hook)- 定位dll获取数据和调用功能的地址
方案一:CE搜索内存数据,OD断点查看堆栈方案二:使用旧版本的特征码,在新版本搜索方案三:借鉴WeTool的dll,用ida分析获取地址方案四:ida静态分析微信,看字符串和输出日志 源码: http ...
- EF Core 中处理 1对1 关系
最近在开发记录感想功能的时候用到了1对1的数据关系,具体情况是这样的,有这样两个1对1的类型 public class Item { public int Id { get; set; } publi ...
- 使用PIL将图片转成字符
注意:转化成txt后,txt的字体使用“宋体”,不能使用“微软雅黑”,否则图像会变形 import numpy as npfrom PIL import Image if __name__ == '_ ...
- VUE+Element UI实现简单的表格行内编辑效果
原理是通过Css控制绑定的输入控件与显示值,在选中行样式下对控件进行隐藏或显示 <!DOCTYPE html> <html> <head> <meta cha ...
- C# 使用TopShelf实现Windows服务部署
一.TopShelf介绍 topShelf是创建Windows服务的一种方式,可以方便管理应用服务,最大广泛应用于,数据实时接收,定时推送等. 二.TopShelf使用 1.安装 TopShelf程序 ...
- RabbitMQ异常注意 reply-code=404, reply-text=NOT_FOUND - no exchange 'topic' in vhost '/', class-id=50, method-id=
第一次,一定要先启动Provider再启动Consumer!!! rabbitmq为初始状态没有队列信息,然后我又没有启动consumer,所以导致provider找不到queue和exchange. ...
- MySQL 是如何处理死锁的
MySQL(InnoDB)是如何处理死锁的 一.什么是死锁 官方定义如下:两个事务都持有对方需要的锁,并且在等待对方释放,并且双方都不会释放自己的锁. 这个就好比你有一个人质,对方有一个人质,你们俩去 ...
- Dijkstra.NET 库体验报告
在VS里用Nuget下载"Dijkstra.NET"库,然后就可以在需要的地方使用了. 首先,这是一个简单的graph,5个节点,7条边. 上代码 移动端看不清楚的可以看下面的: ...
- 网站如何免费升级到HTTPS?
最近在做网站SSL升级,看似简单的操作还是会遇到各种问题,现在和大家分享一下. 证书申请: 公司是创业公司,为了省成本准备申请免费证书,对比了一些证书商,最后选择使用沃通wosign提供的证书服务,发 ...
- leaflet 结合 Echarts4 实现统计图(附源码下载)
前言 leaflet 入门开发系列环境知识点了解: leaflet api文档介绍,详细介绍 leaflet 每个类的函数以及属性等等 leaflet 在线例子 leaflet 插件,leaflet ...