1.建文件系统
fdisk后
partprobe /dev/cciss/c0d0
pvcreate /dev/cciss/c0d0p3
vgcreate -s 128m vg01 /dev/cciss/c0d0p3
lvcreate -L 5120M -n lvinformix vg01
mkfs.ext3 /dev/vg01/lvinformix
mkdir-p /home/db/informix
echo "/dev/vg01/lvinformix/home/db/informixext3 defaults 12">>/etc/fstab
mount /home/db/informix
2.建系统用户
groupadd -g 300 informix
useradd -u 300 -g 300 -d /home/db/informix informix
passwd informix
chown -R informix:informix /home/db/informix
chmod -R 755 /home/db/informix
3.建数据裸设备
(vgcreate vgdbs)
lvcreate -L 2048M -n lvrootdbs vgdbs
lvcreate -L 2048M -n lvlogdbs vgdbs
lvcreate -L 2048M -n lvtmpdbs vgdbs
lvcreate -L 2048M -n lvphydbs vgdbs
lvcreate -L 10240M -n lvdatadbs01 vgdbs
创建lv与裸设备的映射
echo "/dev/raw/raw10/dev/vgdbs/lvrootdbs">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw11/dev/vgdbs/lvlogdbs">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw12/dev/vgdbs/lvtmpdbs">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw13/dev/vgdbs/lvphydbs">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw14/dev/vgdbs/lvdatadbs01">>/etc/sysconfig/rawdevices
红帽4的系统下:
# vi /etc/udev/permissions.d/50-udev.permissions
找到raw/*:root:disk:0660,将其改为raw/*:informix:informix:0660,修改完成后执行如下命令使映射生效
# /etc/rc.d/init.d/rawdevices restart
红帽5的系统下:
# vi/etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="raw*", OWNER=="informix",GROUP=="informix", MODE=="0660"
Aft er configuring, please restart udev:
# start_udev
# service rawdevices restart
(
检查裸设备是否已创建:
raw -qa
修改裸设备的属主/组以及权限:
echo "chown informix:informix /dev/raw/*">>/etc/rc.d/rc.local
echo "chmod 660 /dev/raw/*">>/etc/rc.d/rc.local
/etc/rc.d/rc.local
)
4.安装informix软件
(如需要安装isql一定要先装isql再装ids
否则会报错Initializing Dictionary Cache and SPL RoutineCache...Cannot find message file.
Check INFORMIXDIR and DBLANG.FAILED)
root用户登录
cd /home/db/informix
./ids_install
下一步,制定路径,安装完。
PS:若安装报错:
The wizard cannot continue because of the following error: couldnot load wizard
specified in /wizard.inf (104)
解决方法:
which java 找到本机java环境所在地 如/usr/bin/java
需要指定以java运行环境,添加以下参数即可
#./ids_install -javahome /usr/bin/java
5.修改informix用户环境变量bash_profile
INFORMIXDIR=/home/db/informix
PATH=$PATH:$INFORMIXDIR/bin:.
INFORMIXSERVER=hbsmsdb_tcp
ONCONFIG=onconfig.hbsmsdb
DBDATE=Y4MD
DBCENTURY=C
INFORMIXTERM=terminfo
KAIOON=1
export KAIOON
export INFORMIXSERVER ONCONFIG INFORMIXTERM
export INFORMIXDIR PATH DBDATE DACENTURY
LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
==================
修改services服务
vi /etc/services
加入下面行
?sqlexe60999/tcp# informix
sqlexec61000/tcp# informix
============================
sqlhosts配置文件
vi /home/db/informix/etc/sqlhost
============================
hbsmsdb(名字自定义)onipcshm(内存方式)HBAPQ500(主机名)on_shm
hbsmsdb_tcp(名字自定义)onsoctcp(tcp方式)HBAPQ500(主机名)sqlexec
或hbsmsdb_tcp(名字自定义)onsoctcp(tcp方式)ip地址端口号
(sqlexec和端口都是在services文件里定义对应的)
==========================================================================
onconfig配置文件里
ROOTOFFSET50(最好设个偏移量)
/home/db/informix/hbsmsdbs/rootdbs
物理日志和逻辑日志的DBspace出始化时是必须在rootdbs里的,所以不要设置太大,会把ROOT挤爆。
==========================================================================
# System Configuration
SERVERNUM0# Unique id corresponding to a OnLine instance
DBSERVERNAMEhbsmsdb# Name of default database server
DBSERVERALIASEShbsmsdb_tcp(连数据库走网络方式)# List of alternate dbservernames
NETTYPEsoctcp,2,250,NET# Configure poll thread(s) for nettype
NETTYPEipcshm,2,250,CPU# Configure poll thread(s) for nettype
---------------
soctcp,2,250,NET(其中2表2个cpu 250表示最大的进程数)
ipcshm,2,250,CPU(cpu这种方式理论效率高)
多处理器模式
MULTIPROCESSOR1# 0 for single-processor, 1 for multi-processor
NUMCPUVPS22个# Number of user (cpu) vps
# Shared Memory Parameters
LOCKS5000000(常驻内存)# Maximum number of locks
NUMAIOVPS16(偶数)# Number of IO vps
PHYSBUFF64# Physical log buffer size (Kbytes)
LOGBUFF64# Logical log buffer size (Kbytes)
CLEANERS16# Number of buffer cleaner processes
SHMBASE0x44000000L# Shared memory base address
SHMVIRTSIZE8192# initial virtual shared memory segment size
SHMADD8192# Size of new shared memory segments (Kbytes)
...............................
BUFFERPOOLsize=2K,buffers=50000,lrus=8,lru_min_dirty=50.000000,lru_max_dirty=60.000000
相当于2K*50000 = 100M
============================================================================
创建保存指向裸设备的链接文件的目录
mkdir hbsmsdbs
cd ****dbs
ln -s /dev/raw/raw10 rootdbs
ln -s /dev/raw/raw11 logdbs
ln -s /dev/raw/raw12 tmpdbs
ln -s /dev/raw/raw13 phydbs
ln -s /dev/raw/raw14 datadbs01
创建数据库
oninit -ivy
onstat -
都有偏移量 是50(K)
datadbs是表空间的概念 datadbs01是数据文件的概念
onspaces -c -d phydbs -p /home/db/informix/hbsmsdbs/phydbs -o 50 -s2048000
onspaces -c -d logdbs -p /home/db/informix/hbsmsdbs/logdbs -o 50 -s2048000
onspaces -c -d datadbs -p/home/db/informix/hbsmsdbs/datadbs01-o 50 -s 10240000
onspaces -c -d tmpdbs -t -p /home/db/informix/hbsmsdbs/tmpdbs -o 50-s 2048000
使用onparams改变物理日志位置和大小
$onmode -s (执行gracefulshutdown)
$onparams -p -s 2047000 -d phydbs -y(略小于2048000)
使用onparams逻辑日志
$onparams -a -d logdbs -s 100000(执行20次,建20个逻辑日志)
$onmode -m (将系统从quiescent模式变为on-line模式)
释放日志空间
$onmode -l (由于初始化后有6个log建在rootdbs 得运行6次)
(从当前日志切换到下一个日志,onstat -l可以看出效果)
onmode -c (onmode -c 强制校验检查点,onmode-l后,有可能上一个日志中包含检查点,onmode -c可以强制校验,把检查点转到当前日志)
=======此时onstat -l输出(省略上下文)==========
53cc9b306U-B----61:614663102400 10.00(这含以上均为初始化后rootdbs里的逻辑日志)
54ae2e607 U---C-L73:535000020.00(这含以下为新划的100M一个的逻辑日志)
================================================
ontape -s -L 0 //备份
下面可以删前面6个rootdbs里的逻辑日志
onparams -d -l 1 -y
onparams -d -l 2 -y
onparams -d -l 3 -y
onparams -d -l 4 -y
onparams -d -l 5 -y
onparams -d -l 6 -y
$ontape -s -L 0
onstat -l 可以看效果
最后记得改onconfig,加上tmpdbs 再启停一次库,完成。
若要在线加10g数据空间 建裸设备和数据链接
datadbs是表空间的概念 datadbs02是数据文件的事
raw /dev/raw/raw15 /dev/vgdbs/lvdatadbs02
onspaces-adatadbs-p/home/db/informix/hbsmsdbs/datadbs02-o 50 -s 10240000