CentOS7下Informix 12.10执行oninit -v报错bad INFORMIXSERVER求助
Let’s walk through the most common fixes for this frustrating error—this is a classic misconfiguration issue, so we’ll start with the basics and work our way up:
1. Verify Your Environment Variables
First, make sure your core Informix environment variables are set correctly, and that you’re running commands as the right user:
- Switch to the dedicated
informixuser (created during installation) withsu - informix—root doesn’t have the correct environment set by default. - Run
echo $INFORMIXSERVERto check if the value matches the server name you defined in your config files. - Confirm other critical variables are set:
INFORMIXDIR: Should point to your Informix installation path (e.g.,/opt/informix)PATH: Must include$INFORMIXDIR/binINFORMIXSQLHOSTS(optional): If set, it should point directly to yoursqlhostsfile (default is$INFORMIXDIR/etc/sqlhosts)
2. Check the sqlhosts File Configuration
The sqlhosts file maps your server name to connection details—this is where mismatches often happen:
- Open
$INFORMIXDIR/etc/sqlhostsand look for an entry matching yourINFORMIXSERVERvalue. The format should be:
Example entry:<server_name> <connection_type> <host> <service/port>my_infx_server onsoctcp localhost infx_1210_port - Critical note:
<server_name>must matchINFORMIXSERVERexactly—Informix is case-sensitive here! - Ensure the service/port in the entry exists in
/etc/services(e.g.,infx_1210_port 9088/tcp) or use a direct port number instead of a service name.
3. Match onconfig File Settings
Your onconfig file defines server-level parameters, and it needs to align with your server name:
- Locate your onconfig file (default is
$INFORMIXDIR/etc/onconfig, oronconfig.<server_name>if you created a custom one). - Check the
DBSERVERNAMEparameter—this must be identical toINFORMIXSERVERand the server name insqlhosts. - If you’re using a custom onconfig file, specify it explicitly when starting the server:
oninit -v -c $INFORMIXDIR/etc/onconfig.my_infx_server
4. Validate File Permissions
Informix needs proper access to its configuration files and temp directories:
- Ensure the
informixuser has read/write permissions on$INFORMIXDIR/etc/sqlhosts,$INFORMIXDIR/etc/onconfig, and all subdirectories of$INFORMIXDIR. - Check
/tmppermissions—Informix creates temporary files here, so runchmod 1777 /tmpif needed to ensure global read/write with sticky bit.
5. Test Basic Connectivity
Once you’ve adjusted settings, test if the configuration works:
- Run
dbaccess -lto list available servers. If this succeeds, yourINFORMIXSERVERis correctly recognized. - If
oninit -vstill fails, check the online log ($INFORMIXDIR/tmp/online.log) for more detailed error messages—this often reveals specific misconfigurations the initial error doesn’t mention.
Most of the time, this error boils down to a simple mismatch between INFORMIXSERVER, sqlhosts, and onconfig settings. Double-check case sensitivity first—this is the #1 culprit!
内容的提问来源于stack exchange,提问作者Matias Barrios

