1.1.1.1 安装文件准备
版本:IBM Informix Dynamic Server Version 9.40.UC8
IBM Informix CSDK Version 2.90
将安装文件以informix用户上传到/home/db/informix目录,并解压。
#tar xvf IDS9.4UC8.tar //此文件名以Informix实际安装包名称为准。
#tar xvf CSDK2.90UC3.tar //此文件名以CSDK实际安装包名称为准。
以informix用户登陆
在.bash_profile文件中添加如下内容
INFORMIXDIR=/home/db/informix
INFORMIXSERVER=nettrack
ONCONFIG=onconfig.nettrack
DBDATE=Y4MD-
DB_LOCALE=zh_cn.GB18030-2000
CLIENT_LOCALE=zh_cn.GB18030-2000
PATH=$PATH:$HOME/bin:.
LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/dmi
STMT_CACHE=1
export INFORMIXDIR INFORMIXSERVER ONCONFIG PATH DBDATE DB_LOCALE CLIENT_LOCALE STMT_CACHE LD_LIBRARY_PATH
alias ls='ls --color=no'
alias ll='ls -l --color=no'
alias lf='ls -n --color=no'
alias l='ls -v --color=no'
上述配置完成后,应使上述informix用户的环境变量生效,操作方法如下:
退出informix用户,重新登陆;
1.1.1.2 安装SDK
(1)以informix用户登录 su root
(2)#./installclientsdk
如图:
Welcome to the InstallShield Wizard for IBM Informix Client-SDK
The InstallShield Wizard will install IBM Informix Client-SDK on your computer.
To continue, choose Next.
IBM Informix Client-SDK
IBM Corporation
http://www.ibm.com
Press 1 for Next, 3 to Cancel or 4 to Redisplay [1]1
如图:
中间过程略,全部回车。
You have completed viewing the license agreement. Enter 1 to accept
the agreement or 2 to decline it. If you choose to decline the
agreement, installation will not be completed and you will not be
able to use the Program.
1
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1]1
-------------------------------------------------------------------------------
IBM Informix Client-SDK Install Location
Please specify a directory or press Enter to accept the default directory.
Directory Name: [/home/db/informix]
如图:
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1]1
-------------------------------------------------------------------------------
Choose the setup type that best suits your needs.
[X] 1 - Typical
The program will be installed with the suggested configuration.
Recommended for most users.
[ ] 2 - Custom
The program will be installed with the features you choose.
Recommended for advanced users.
To select an item enter its number, or 0 when you are finished: [0]
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 1
-------------------------------------------------------------------------------
IBM Informix Client-SDK will be installed in the following location:
/home/db/informix
with the following features:
Client
Messages
GLS
for a total size:
30 MB
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1]
如图:
Creating uninstaller...
.....
Installation Directory: /home/db/informix
Performing root portion of installation of messages...
Installation of messages complete.
-------------------------------------------------------------------------------
The InstallShield Wizard has successfully installed IBM Informix Client-SDK.
Choose Finish to exit the wizard.
Press 3 to Finish or 4 to Redisplay [3]
3
安装完成。
1.1.1.3 安装IDS
(1) 以informix用户登录 su root
(2) #./ids_install
IBM Informix Unix Bundle Installer
Installation Requirements:
- A user "informix" and a group "informix" must be known to the system.
- This installation procedure must be run by user root.
- Approximately 770 MB disk space required initially.
- Approximately 500 MB disk space if everything is installed (50 MB
for ISA, 25 MB for JDBC).
0) All Products listed below
1) IBM Informix Dynamic Server 9.40
2) IBM Informix IConnect
3) IBM Informix JDBC
4) IBM Informix Server Administrator
5) Configure a Demo IDS Server (requires IDS)
Enter the number(s) of the products to install, separated by spaces
(i.e. "1 2 3"):
选择 1 回车。
IBM Informix Dynamic Server Install Location
Please specify a directory or press Enter to accept the default directory.
Directory Name: [/home/db/informix] 回车
......
1.1.1.4 建库前准备
1、 修改sqlhost文件
以informix用户登陆
$cd etc
$cp sqlhosts.std sqlhosts
$vi sqlhosts
用informix用户编辑/home/db/informix/etc/sqlhost文件,增加如下内容:
nettrack onipcshm nettrackdb on_shm
nettrack_net onsoctcp nettrackdb sqlexec
2、 以informix用户配置$INFORMIXDIR/etc/onconfig.nettrack
以informix用户登陆
$cd etc
$cp onconfig.std onconfig.nettrack
$vi onconfig.nettrack
将onconfig.nettrack文件中的所有/usr/informix都替换成数据库的实际安装路径/home/db/informix;
在vi下执行 %s/\/usr\/informix/\/home\/db\/informix/g 进行替换
设置数据库参数信息如下:
DBSERVERNAME nettrack # Name of default database server
DBSERVERALIASES nettrack_net # List of alternate dbservernames
NETTYPE ipcshm,1,50,CPU # Configure poll thread(s) for nettype
NETTYPE soctcp,3,200,NET # Configure poll thread(s) for nettype
OPTCOMPIND 2 # To hint the optimizer
ROOTNAME rootdbs # Root dbspace name
ROOTPATH /home/db/informix/bssdbs/rootdbs # Path for device containing root dbspace
RESIDENT 1
建议不使用日志备份:
TAPEDEV /dev/null # Tape device pat
LTAPEDEV /dev/null # Log tape device path
增加参数:(增加SQL会话缓存参数)
STMT_CACHE 1 # SQL STMT CACHE: 1-ON
依据实地设备状况设置如下参数:
ROOTSIZE # Size of root dbspace (Kbytes)
PHYSFILE # Physical log file size (Kbytes)
LOGFILES # Number of logical log files
LOGSIZE # Logical log size (Kbytes)
LOCKS # Maximum number of locks
BUFFERS # Maximum number of shared buffers
NUMAIOVPS # Number of IO vps
MULTIPROCESSOR # 0 for single-processor, 1 for multi-processor
NUMCPUVPS # Number of user (cpu) vps
SINGLE_CPU_VP # If non-zero, limit number of cpu vps to one
PHYSBUFF # Physical log buffer size (Kbytes)
LOGBUFF # Logical log buffer size (Kbytes)
SHMBASE # Shared memory base address
SHMVIRTSIZE # initial virtual shared memory segment size
SHMADD # Size of new shared memory segments (Kbytes)
SHMTOTAL # Total shared memory (Kbytes). 0=>unlimited
CKPTINTVL # Check point interval (in sec)
其他参数,根据实地数据库设备配置状况进行优化配置。
3、 创建链接文件
#su - informix
$mkdir bssdbs
$cd bssdbs
$ln -s /home/db/informix/bssdbs/rootdbs rootdbs
$ln -s /dev/raw/raw11 phydbs
$ln -s /dev/raw/raw12 logdbs
$ln -s /dev/raw/raw13 blobdbs
$ln -s /dev/raw/raw14 tmpdbs
$ln -s /dev/raw/raw15 data0tbs01
$ln -s /dev/raw/raw16 indextbs01
$ln -s /dev/raw/raw17 ywdattbs01
$ln -s /dev/raw/raw18 ywdattbs02
$ln -s /dev/raw/raw19 ywdattbs03
$ln -s /dev/raw/raw20 ywdattbs04
$ln -s /dev/raw/raw21 ywdattbs05
$ln -s /dev/raw/raw22 ywdattbs06
$ln -s /dev/raw/raw23 ywdattbs07
$ln -s /dev/raw/raw24 ywdattbs08
1.1.1.5 以root用户更改卷属性
#chown -R informix:informix /dev/bssvg01/
#chown -R informix:informix /dev/raw/
注意:系统重启后,设备属性将还原,需要在系统启动文件中/etc/rc.d/rc.local加入上述修改设备块属性的语句。
1.1.1.6 创建数据库
$oninit –ivy
$onstat -
以informix用户,首先使用命令:onmode –s;将数据库切换至单用户模式而后执行命令:onmode -BC 1; onmode -BC 2; 取消数据空间chunck的大小限制(即允许添加2G以上的空间块)
$onspaces –c –d phydbs –p /home/db/informix/bssdbs/phydbs -o 0 -s 20000000
$onspaces –c –d logdbs –p /home/db/informix/bssdbs/logdbs -o 0 -s 40000000
$onspaces -c -b blobdbs -g 32 -p /home/db/informix/bssdbs/blobdbs -o 0 -s 480000
(注意:-s参数后定义的blob空间大小,须为 –g参数后定义的页大小的倍数;此处页大小定义为32K)
$onspaces -c -d tmpdbs –t -p /home/db/informix/bssdbs/tmpdbs -o 0 -s 20000000
$onspaces -c -d data0tbs01 -p/home/db/informix/bssdbs/data0tbs01 -o 0 -s 40000000
$onspaces -c -d indextbs01 -p /home/db/informix/bssdbs/indextbs01 -o 0 -s 80000000
$onspaces -c -d ywdattbs01 -p /home/db/informix/bssdbs/ywdattbs01 -o 0 -s 30000000
$onspaces -c -d ywdattbs02 -p /home/db/informix/bssdbs/ywdattbs02 -o 0 -s 30000000
$onspaces -c -d ywdattbs03 -p /home/db/informix/bssdbs/ywdattbs03 -o 0 -s 30000000
$onspaces -c -d ywdattbs04 -p /home/db/informix/bssdbs/ywdattbs04 -o 0 -s 30000000
$onspaces -c -d ywdattbs05 -p /home/db/informix/bssdbs/ywdattbs05 -o 0 -s 30000000
$onspaces -c -d ywdattbs06 -p /home/db/informix/bssdbs/ywdattbs06 -o 0 -s 30000000
$onspaces -c -d ywdattbs07 -p /home/db/informix/bssdbs/ywdattbs07 -o 0 -s 30000000
$onspaces -c -d ywdattbs08 -p /home/db/informix/bssdbs/ywdattbs08 -o 0 -s 30000000
1.1.1.7 添加逻辑日志块
以informix用户,使用onparams命令增加逻辑日志块,数据库至少应创建200个日志块,每块大小为20M;(建议完成此步操作后,使用ontape -s -L 0对数据库做零级备份,而后将数据库初始时建立的逻辑日志块删除)
2) 添加物理日志的逻辑空间
以informix用户,使用onparams命令创建物理日志的逻辑空间
(phydbs的逻辑空间必须小于phydbs的物理空间)
使用onparams改变物理日志位置和大小
$onparams –p –s 10000000 –d phydbs –y
使用onparams逻辑日志
$onparams –a –d logdbs –s 20000(执行200次)
3) 备份数据库
以informix用户,使用ontape -s -L 0对数据库做0级备份
4) 创建ywjk库(初始应用数据库)
以informix用户重启数据库:
关闭:onmode -ky
启动:oninit –vy
解压缩ywjk.tar.gz
tar xvfz ywjk.tar.gz
导入应用数据库:
dbimport ywjk -d data0tbs01 -l buffered
5) 修改数据库日志模式为无缓冲的日志模式
以informix用户,使用命令:ontape -s -U ywjk
1) 以informix用户建立表索引
#dbaccess ywjk<<!
>update statistics high;
>!
7) 添加系统自启动/关闭数据库脚本
以root用户将infd文件拷贝至/etc/rc.d/init.d
cd /etc/rc.d/init.d
chmod 755 infd
cd /etc/rc.d/rc3.d (系统运行级别“3”的自启动脚本目录)
ln -s /etc/rc.d/init.d/infd S99infd
ln -s /etc/rc.d/init.d/infd K99infd