文档1: Resolve TimesTen Error : "TT0925: Cannot create data store semaphores (Invalid argument)" (文档 ID 1630404.1)
APPLIES TO:
Oracle TimesTen In-Memory Database - Version 11.2.2.4.0 and laterInformation in this document applies to any platform.
GOAL
What is a cause and resolution for TimesTen error message, "TT0925: Cannot create data store semaphores (Invalid argument)" ?
SOLUTION
The basic cause of this is that there are not enough semaphores configured, so the database does not load when this error occurs.
Semaphore settings are seen in kernel.sem setting: kernel.sem = 500 32000 100 128,
The first value limits semaphores to 500 total, but if Database loads using Connections=500, TimesTen actually needs semmsi=500 + 155 = 655. Internally TimesTen wants to reserve 155 semaphores for use not related to users connections. This is mentioned in KMDoc ID 1192875.1.
There should be several accompanying messages to error TT0925,
12:15:02.51 Info: : 2778: return 1 925 'Could not create semaphore' arg1='Invalid argument' arg1type='S' arg2='' arg2type='S'
12:15:02.51 Info: : 2778: maind: done with request #469902.99215590
12:15:02.51 Err : : 9643: subd: Error identified in [sub.c: line 2394]
12:15:02.51 Err : : 9643: subd: (Error 925): TT0925: Cannot create data store semaphores (Invalid argument) -- file "db.c", lineno 9701, procedure "sbDbConnect"
12:15:02.51 Err : : 9643: -- file "db.c", lineno 9701, procedure "sbDbConnect"
12:15:02.51 Warn: : 9643: subd: connect trouble, rc 1, reason 925
12:15:02.51 Err : : 9643: Err 925: TT0925: Cannot create data store semaphores (Invalid argument) -- file "db.c", lineno 9701, procedure "sbDbConnect"
12:15:02.51 Info: : 9643: subd: done with request #1.2
12:15:02.51 Info: : 2778: manage request failure: 500, '' <---- This line indicates how many connections is database is requesting semaphores for
12:15:02.51 Info: : 2778: Mark process #1234897 as down (0)
12:15:02.51 Err : : 2778: TT14000: TimesTen daemon internal error: Could not send 'manage' request to subdaemon rc 500 err1 703 err2 925
In the example since semaphores was set to 500, database load would have only succeeded if the Connections was less than or equal to 500-155=345. Or the semphore settings would have to be 655 if the user wants database to load with connections=500.
Keep in mind too that if ramPolicy is set to manually load or always, the connections value will be read in from the checkpoint file and not from a changed value in the DSN definition; a changed value in a DSN definition only takes effect when the load is done with a ramPolicy of inUse.
A User has 2 Choices on how to resolve this depending on what your intended value for connections is:
1) If the intention is to use connections=345 or lower:
Use this example sequence to get the database unloaded, loaded with new connection value while set to inUse, then it sets rampolicy back to always while keeping the db in memory:
ttadmin -rampolicy manual mydsn
ttadmin -ramunload mydsn
ttadmin -rampolicy inuse mydsn
ttisql -e "call ttckpt; call ttckpt; call ttrampolicyset('always'); exit;" mydsn"
2) If you want to use connections=500,
User should set it that way in sys.odbc.ini for mydsn, but you will also need to bump up semmsi to at least 655 so that it will load without getting the TT0925 error.
This will change the value without rebooting:
sysctl -w kernel.sem="655 32000 100 128"
Modify /etc/sysctl.conf to that value, so that after a reboot it uses this value again:
kernel.sem = 655 32000 100 128
The next time the db attempts to load it will be able to use the new semaphore settings.
文档2: HOWTO : Understand Why Connections=N Is Stuck After Increasing SEMMSL And Reloading The Database (文档 ID 1499601.1)
APPLIES TO:
Oracle TimesTen In-Memory Database - Version 11.2.2.2.0 and laterInformation in this document applies to any platform.
GOAL
Explain current behavior and demonstrate workaround.
SOLUTION
Question:
Why is Connections=N stuck (unchanged), after increasing SEMMSL and reloading the database?
Answer:
If a database has been loaded and upon reload the Connections=N value is not explicitly set the previous value stored internally is used,
meaning Connections=N is not dynamically recomputed based on kernel SEMMSL. There are two workarounds:
- Explicitly set Connections=N in the connection string or the DSN when you load the database
- Destroy + Create the database without Connections=N in the connection string or the DSN
In TimesTen 11.2.2.x the default behavior for setting "Connections" changed as follows:
- If the Connections attribute is not set the max Connections will automatically be set based on available SEMMSL
- If the Connections attribute is set (at creation or in the database) the amount of SEMMSL will be verified and if not sufficient TimesTen will error
Error: 925: Cannot create data store semaphores (Invalid argument) - If an application attempts to exceed the Connections configuration TimesTen will disallow the connection
Error: 955: Current Connections attribute setting (2) exceeded by this connection.
Bug 14775941 exist to consider a change in behavior to that Connections=N is always recomputed if Connections=N
is not set as seen in step 4 of the test case below.
Example:
$ vi /home/timesten/TimesTen/mk1122a/info/sys.odbc.ini
[mk1122a]
DatabaseCharacterSet=WE8MSWIN1252
DataStore=/data/dbs/mk1122a
02. Create Database With Default SEMMSL = 250
$ /home/timesten/TimesTen/mk1122a/bin/ttIsql -connstr "dsn=mk1122a" -e "call ttConfiguration;exit;" | grep Connections
Output:
< Connections, 95 >
$ /sbin/sysctl -a | grep "kernel.sem"
Output:
kernel.sem = 250 3200 100 128
If SEMMSL is 250 then the dynamic Connection=N calculation will be 95 (250 - 155 = 95).
03. Increase SEMMSL
$ su - root
$ vi /etc/sysctl.conf (increase SEMMSL)
$ grep "kernel.sem" /etc/sysctl.conf
Output:
kernel.sem = 500 3200 100 128
$ /sbin/sysctl -p | grep "kernel.sem"
Output:
kernel.sem = 500 3200 100 128
$ /sbin/sysctl -a | grep "kernel.sem"
Output:
kernel.sem = 500 3200 100 128
SEMMSL increased from 250 to 500 thus the dynamic Connection=N calculation will be 345 (500 - 155 = 345).
04. Reload Database Without Setting Connections=N
$ /home/timesten/TimesTen/mk1122a/bin/ttIsql -connstr "dsn=mk1122a" -e "call ttConfiguration;exit;" | grep Connections
Output:
< Connections, 95 >
05. Reload Database With Setting Connections=N
$ /home/timesten/TimesTen/mk1122a/bin/ttIsql -connstr "dsn=mk1122a;connections=200" -e "call ttConfiguration;exit;" | grep Connections
Output:
< Connections, 200 >
06 Reload Database Without Setting Connections=N (sanity check)
$ /home/timesten/TimesTen/mk1122a/bin/ttIsql -connstr "dsn=mk1122a" -e "call ttConfiguration;exit;" | grep Connections
Output:
< Connections, 200 >
07. Recreate Database
$ /home/timesten/TimesTen/mk1122a/bin/ttDestroy -connstr "dsn=mk1122a"
$ /home/timesten/TimesTen/mk1122a/bin/ttIsql -connstr "dsn=mk1122a" -e "call ttConfiguration;exit;" | grep Connections
Output:
< Connections, 345 >
07. Demonstrate Insufficient SEMMSL Configuration
$ /home/timesten/TimesTen/mk1122a/bin/ttIsql -connstr "dsn=mk1122a;connections=2000"
Output:
connect "dsn=mk1122a;connections=2000";
925: Cannot create data store semaphores (Invalid argument)
The command failed.
08. Demonstrate Connections Exceeded
$ /home/timesten/TimesTen/mk1122a/bin/ttIsql -connstr "dsn=mk1122a;connections=2;connectionname=con1"
Output:
connect "dsn=mk1122a;connections=2;connectionname=con1";
con1: Command> connect dsn=mk1122a as con2;
con2: Command> connect dsn=mk1122a as con3;
955: Current Connections attribute setting (2) exceeded by this connection.
The command failed.
看了这两个文档以后明白了,这个参数具体和sys.odbc.ini里的Connections有关,看了文档以后心里有谱了,果断上调,上调后问题解决。
另外,在百度上也看到了一篇不错的文档,这里也粘贴一下:
http://blog.chinaunix.net/uid-7589639-id-3132077.html
TimesTen专题:TimesTen邂逅925错误 2012-03-13 18:30:39
分类: Oracle
TimesTen专题:TimesTen邂逅925错误 :
开发人员反映说TimesTen的DataStore突然连不上了, 查看日志,发现一直在报错:
TT0925: Cannot create data store semaphores (Invalid argument)
查看TT配置文件,发现sys.odbc.info中的连接参数为默认值64.是有点小,不能真正发挥TT的强大功能。
于是想通过增加TT的并发连接数来提高TT的处理性能,将默认连接数修改为100后,执行如下命令:
[timesten@db_test info]$ ttDaemonAdmin -stop
[timesten@db_test info]$ ttDaemonAdmin -start
[timesten@db_test info]$ ttisql tt_utf8db
Copyright (c) 1996-2011, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=tt_utf8db";
925: Cannot create data store semaphores (Invalid argument)
The command failed.
Done.
第一反应,可能是kernel的一些配置不对了,但是查看 kernel.shmmax, kernel.shmall都正常。
然后开始搜索有关linux的kernel配置, 发现semaphores跟kernel.sem有关。
查看本机的 kernel.sem, 配置是 kernel.sem="250 32000 100 128"
将其修改为kernel.sem="512 32000 100 256"
同时修改 /etc/sysctl.conf, 保存。
再执行ttisql, 能够正常连接, 问题解决。
[timesten@db_test info]$ ttisql tt_utf8db
Copyright (c) 1996-2011, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=tt_utf8db";
Connection successful: DSN=tt_utf8db;UID=timesten;DataStore=/data0/timesten/datastore/utf8db/utf8db;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER=/data0/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=100;TempSize=32;Connections=357;CkptFrequency=120;CkptLogVolume=0;TypeMode=0;OracleNetServiceName=utf8db;
(Default setting AutoCommit=1)
Command> quit
Disconnecting...
Done.
当把参数设置为kernel.sem = 4096 524288 200 256进行连接测试,TT可支持的最大并发连接数为Connections=2000.
# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 4096 524288 200 256
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
执行如下命令:
$ ttisql tt_workshop
Copyright (c) 1996-2011, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=tt_workshop";
Connection successful: DSN=tt_workshop;UID=timesten;DataStore=/data0/timesten/datastore/tt_workshop/;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/data0/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=100;TempSize=32;Connections=2000;CkptFrequency=120;CkptLogVolume=0;TypeMode=0;OracleNetServiceName=mytest;
(Default setting AutoCommit=1)
Command>
kernel.sem的几个值的具体含义如下:
kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
SEMMSL :Maximum number of semaphores per set
每个信号对象集的最大信号对象数;
SEMMNS :Maximum number of semaphores system-wide
系统范围内最大信号对象数;
SEMOPM :Maximum number of operations per set
每个信号对象支持的最大操作数;
SEMMNI :Maximum number of semaphore identifiers
系统范围内最大信号对象集数。
其中 SEMMNS的值等于 SEMMSL*SEMMNI。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28811352/viewspace-1763000/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28811352/viewspace-1763000/