2012年8月17日 星期五

shared memory not initialized for INFORMIXSERVER解法

作業系統AIX 5.3

症狀:
$ onstat -
shared memory not initialized for INFORMIXSERVER 'online'
$ onmode -ky
shared memory not initialized for INFORMIXSERVER 'online'
$ oninit -v
Your evaluation license will expire on 2007-10-30 00:00:00
Checking group membership to determine server run mode...succeeded
Reading configuration file '/opt/informix/etc/onconfig'...succeeded
Creating /INFORMIXTMP/.infxdirs...succeeded
Creating infos file "/opt/informix/etc/.infos.informixserver"...succeeded
Linking conf file "/opt/informix/etc/.conf.informixserver"...succeeded
Writing to infos file...succeeded
Checking config parameters...succeeded

WARNING: If you intend to use J/Foundation with this Server instance, please make sure that your SHMBASE value specifies in onconfig is 0x700000010000000 or above. Other
wise you will have problems while dynamimically adding virtual shared memory segments. Please refer to Server machine notes for more information.

Allocating and attaching to shared memory...FAILED
oninit: Fatal error in shared memory creation

解法:
下env指令,檢查INFORMIX相關的環境變數是否正確
以及檢查sqlhost、/etc/hosts…等等


一般來說環境變數有:
INFORMIXDIR=/usr/informix
INFORMIXSERVER=test
有的還會把ONCONFIG編進去 (可是我的server原本就沒編)

結果發現INFORMIXSERVER這個環境變數設錯了

informix本身的環境變數放在此路徑:/usr/informix/.profile

我這次遇到的神奇狀況是…
informix下的.profile這個檔案的INFORMIXSERVER是對的
但root使用的 /.profile(在根目錄)下的INFORMIXSERVER設錯,因為我中途先su 成root,env吃到root的設定,於是造成變數錯誤的問題
不知道哪個前人從別台亂copy過來,真他奶奶的
所以,最後修正root的profile後,重啟informix就OK了(這算是特例吧= =)


另外,我下oninit -v以後,雖然有出現一行很長的Warning如下:
WARNING: If you intend to use J/Foundation with this Server instance, please make sure that your SHMBASE value specifies in onconfig is 0x700000010000000 or above.
但我照著改onconfig中的SHMBASE值後還是不能啟動informix=.= 所以…是一個無效的建議


附錄 - 重啟informix指令:
onmode -ky → 關掉informix
oninit -v → 啟動informix並檢視過程,會逐項報告success or fail



註:
google了一下,通常一般人遇到是其它地方,比如說sqlhost設錯之類的
可參考:http://bbs.chinaunix.net/thread-915528-1-1.html