首先,我们当然要取得informix数据库的安装包了,不同的系统,安装包不一样。其实基本安装步骤都是差不多。
一:取得informix数据库的安装包,并将其上传到系统中的某个目录
二:建立informix组和informix用户
IBM:mkuser或者useradd建立informix用户,mkgroup建立informix组
HP:useradd建立用户,groupadd建立组
SUN:useradd建立用户,groupadd建立组
三:规划好informix数据库的空间,informix数据库需要如下空间,安装informix数据库本身的空间,rootdbs,tempdbs,phydbs,logdbs以及workdbs。一般,informix数据库本身安装在/opt/informix目录或者/usr/informix目录下。
rootdbs,tempdbs,phydbs,logdbs以及workdbs使用touch命令创建即可。如果数据量比较大,可以单独建立类型为raw的lv。
建立好之后将lv或者dbs赋予相应权限。
chown informix:informix *dbs*
chmod 660 *dbs*
四:开始安装informix数据库
将安装包拷贝到/opt/informix(假设informix安装在此目录下面),在informix用户下解压安装包
编辑.cshrc环境变量
setenv INFORMIXDIR /opt/informix
setenv PATH $INFORMIXDIR/bin:$PATH
setenv ONCONFIG onconfig
保存退出,source .chsrc使环境变量生效。
在刚才的环境下,使用su命令切换到root用户,注意,在切换的时候确保刚才的环境变量不会改变。
#./installserver(informix 7.3) 或者#./ids_install(informix9.4)系统自动进行安装。
五:修改配置文件
主要修改以下几个配置文件:/opt/informix/etc/sqlhosts ,/opt/informix/etc/onconfig /etc/services
下面给出这几个文件的典型例子
/opt/informix/etc/sqlhosts文件
hostname_online onipcshm hostname sqlexec
hostname_online_net onsoctcp hostname sqlexec_net(适用于IBM和HP)
hostname_online_net ontlitcp hostname sqlexec_net (用与SUN)
/etc/services文件
sqlexec 9002/tcp
sqlexec_net 9003/tcp
/opt/informix/etc/onconfig文件,太长,只贴点关键的。这里以IBM的AIX为例子
# Root Dbspace Configuration
ROOTNAME rootdbs # Root dbspace name
ROOTPATH /dev/rlvrootdbs # Path for device containing root dbspace
ROOTOFFSET 40 # Offset of root dbspace into device (Kbytes)
ROOTSIZE 256000 # Size of root dbspace (Kbytes)
# Disk Mirroring Configuration Parameters
MIRROR 0 # Mirroring flag (Yes = 1, No = 0)
MIRRORPATH # Path for device containing mirrored root
MIRROROFFSET 0 # Offset into mirrored device (Kbytes)
# Physical Log Configuration
PHYSDBS phydbs # Location (dbspace) of physical log
PHYSFILE 500000 # Physical log file size (Kbytes)
# Logical Log Configuration
LOGFILES 10 # Number of logical log files
LOGSIZE 50000 # Logical log size (Kbytes)
# Diagnostics
MSGPATH /opt/informix/online.log # System message log file path
CONSOLE /dev/console # System console message path
# To automatically backup logical logs, edit alarmprogram.sh and set
# BACKUPLOGS=Y
ALARMPROGRAM /opt/informix/etc/alarmprogram.sh # Alarm program path
TBLSPACE_STATS 1 # Maintain tblspace statistics
# System Archive Tape Device
#TAPEDEV /dev/null # Tape device path
TAPEDEV /usr/informixdata
TAPEBLK 128 # Tape block size (Kbytes)
TAPESIZE 20400000 # Maximum amount of data to put on tape (Kbytes)
# Log Archive Tape Device
#LTAPEDEV /dev/null # Log tape device path
LTAPEDEV /opt/informix/data/logbackdev
LTAPEBLK 64 # Log tape block size (Kbytes)
LTAPESIZE 8192000 # Max amount of data to put on log tape (Kbytes)
# Optical
STAGEBLOB # Informix Dynamic Server staging area
# System Configuration
SERVERNUM 1 # Unique id corresponding to a OnLine instance
DBSERVERNAME hostname_online # Name of default database server
DBSERVERALIASES hostname_online_net # List of alternate dbservernames
NETTYPE # Configure poll thread(s) for nettype
DEADLOCK_TIMEOUT 60 # Max time to wait of lock in distributed env.
RESIDENT 0 # Forced residency flag (Yes = 1, No = 0)
MULTIPROCESSOR 0 # 0 for single-processor, 1 for multi-processor
NUMCPUVPS 1 # Number of user (cpu) vps
SINGLE_CPU_VP 0 # If non-zero, limit number of cpu vps to one
NOAGE 0 # Process aging
AFF_SPROC 0 # Affinity start processor
AFF_NPROCS 0 # Affinity number of processors
# Shared Memory Parameters
LOCKS 500000 # Maximum number of locks
BUFFERS 50000 # Maximum number of shared buffers
NUMAIOVPS # Number of IO vps
PHYSBUFF 32 # Physical log buffer size (Kbytes)
LOGBUFF 32 # Logical log buffer size (Kbytes)
CLEANERS 1 # Number of buffer cleaner processes
SHMBASE 0x700000010000000 # Shared memory base address
SHMVIRTSIZE 8000 # initial virtual shared memory segment size
SHMADD 8192 # Size of new shared memory segments (Kbytes)
SHMTOTAL 0 # Total shared memory (Kbytes). 0=>unlimited
CKPTINTVL 300 # Check point interval (in sec)
LRUS 8 # Number of LRU queues
LRU_MAX_DIRTY 2 # LRU percent dirty begin cleaning limit
LRU_MIN_DIRTY 1 # LRU percent dirty end cleaning limit
TXTIMEOUT 300 # Transaction timeout (in sec)
STACKSIZE 64
MIRROR 0 # Mirroring flag (Yes = 1, No = 0)
MIRRORPATH # Path for device containing mirrored root
MIRROROFFSET 0 # Offset into mirrored device (Kbytes)
不同的系统,SHMBASE的值不太一样,这里一定要注意,否则,数据库初始化会报错。
informix 9.4在3种小型机上安装的时候,SHMBASE的参数各不相同。
Solaris:SHMBASE 0x10A000000L # Shared memory base address
AIX:SHMBASE 0x700000010000000 # Shared memory base address
HP-UX:SHMBASE 0 # Shared memory base address
还有一点要注意,在数据库进行oninit -iv之前,phydbs和logdbs的空间应该为rootdbs,而且phydbs和logdbs之和应该小于rootdbs空间,否则,oninit -iv无法初始化。
六:使用oninit -iv进行informix的初始化,正常情况下,数据库应该处于online状态。
informix 初始化的一些过程
% oninit -iv
This action will initialize IBM Informix Dynamic Server;
any existing IBM Informix Dynamic Server databases will NOT be accessible -
Do you wish to continue (y/n)? y
Checking group membership to determine server run modesucceeded
Reading configuration file '/opt/informix/etc/onconfig'...succeeded
Creating /INFORMIXTMP/.infxdirs ... succeeded
Creating infos file "/opt/informix/etc/.infos.mscp_online1" ... "/opt/informix/etc/.conf.mscp_online1" ... suc
ceeded
Writing to infos file ... succeeded
Checking config parameters...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 231712 kbytes...succeeded
Creating buffer pool 3962016 kbytes...succeeded
Creating buffer pool 37992 kbytes...succeeded
Initializing rhead structure...succeeded
Initializing ASF ...succeeded
Initializing Dictionary Cache and SPL Routine Cache...succeeded
Bringing up ADM VP...succeeded
Creating VP classes...succeeded
Onlining 6 additional cpu vps...succeeded
Onlining 2 IO vps...succeeded
Initialization of Encryption...succeeded
Forking main_loop thread...succeeded
Initializing DR structures...succeeded
Forking 1 'ipcshm' listener threads...succeeded
Forking 1 'soctcp' listener threads...succeeded
Starting tracing...succeeded
Initializing 15 flushers...succeeded
Initializing log/checkpoint information...succeeded
Opening primary chunks...succeeded
Opening mirror chunks...succeeded
Initializing dbspaces...succeeded
Validating chunks...succeeded
Creating database partition
Initialize Async Log Flusher...succeeded
Forking btree cleaner...succeeded
Initializing DBSPACETEMP list
% Checking database partition index...succeeded
Checking location of physical log...succeeded
Initializing dataskip structure...succeeded
Checking for temporary tables to drop
Forking onmode_mon thread...succeeded
Verbose output complete: mode = 5
使用onstat -,如果出现如下提示,表示数据库初始化成功。
IBM Informix Dynamic Server Version 9.40.FC2 -- On-Line -- Up 12 days 05:44:38 -- 303532 Kbytes
七:使用onspaces创建其它数据空间,并将phydbs和logdbs移出rootdbs,并使用oninit -vy重新启动数据库即可。