一台新虚拟机,CentOS 6.5系统,用lnmp一键安装包安装好Nginx + PHP环境,再安装Oracle客户端,准备搭建PHP连接Oracle,访问oracle.php,测试连接Oracle的时候,出错:
ORA-24408: could not generate unique server group name
度娘了好久,都说是主机名的事,但也都没有说明白原理,最后谷叔告诉我一个链接http://stackoverflow.com/questions/10484231/ora-24408-could-not-generate-unique-server-group-name
LZ也是遇到这样的问题,Camden S.给出的回答很详细:
You can downgrade to 10g if you want (it evidently doesn't care about this) but that's not necessary...
The 11g instant client requires a /etc/hosts
file entry for your hostname pointing to 127.0.0.1. The normal "localhost" entry is not sufficient on it's own.
Assuming your host name is foomachine
, there are two places you'll need to check:
In /etc/hosts
, make sure you have any entry like - add it if it's not there:
127.0.0.1 foomachine
And also make sure the /etc/sysconfig/network
file also has
HOSTNAME=foomachine
That should do the trick.
这下就明白了,要在/etc/sysconfig/network中设置HOSTNAME,同时在/etc/hosts中保证127.0.0.1后面有刚才设置的HOSTNAME。
设置好以后重启系统,成功连接Oracle。
特此笔记,以免忘记。