/***********************************************************************************************************/
8T数据库搭建
/***********************************************************************************************************/
1 安装虚拟机 D:\jibunn\software\vmware\oracle-vm\VirtualBox-5.0.20-106931-Win 到 D:\vm
2 虚拟机 上 安装LINUX6 D:\jibunn\software\linux-操作系统\centos-6.8 到 D:\vmlinuxnode1
使用setup 设置网卡 选on boot ,虚拟机配置为 1.bridged(桥接模式)
3 安装xftp4
4 创建用户和 目录
1) 创建用户,组,设置口令
groupadd informix
useradd -g informix -d /home/informix -s /bin/bash -m informix
passwd informix
2)创建安装目录
mkdir /home/informix/gbase
chown -Rf informix:informix /home/informix/gbase
3) 创建数据库 文件目录
cd /opt
mkdir dbs
chown -Rf informix:informix dbs
4)配置.bash_profile
su - informix
# vi .bash_profile
export INFORMIXSERVER=gbaseserver
export INFORMIXDIR=/home/informix/gbase
export ONCONFIG=onconfig.gbaseserver
export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts.gbaseserver
export PATH=$INFORMIXDIR/bin:/usr/bin:${PATH}:.
export GL_DATE="%m%d%iY"
export DATETIME="%iY-%m-%d %H:%M:%S"
export DB_LOCALE=zh_cn.utf8
export CLIENT_LOCALE=zh_cn.utf8
export LD_LIBRARY_PATH=${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql:${INFORMIXDIR}/lib/cli
export TERM=vt100
export TREMCAP=$INFORMIXDIR/etc/termcap
export INFORMIXTERM=termcap
export DBTEMP=$INFORMIXDIR/tmp
--注:
INFORMIXSERVER 为INFORMIX server 的名称
INFORMIXDIR 为INFORMIX 安装目录
ONCONFIG 为 配置文件名称
GL_DATE 为日期数据显示格式
DB_LOCALE 为 服务器,数据库
CLIENT_LOCALE 为客户端 字符集
5 安装 8T D:\南大通用\GBase 8t培训\GBase8tV8.5.12.10.FC4G1AEE_1.6.3.54.RHEL6_x86
[root@node1 file]# tar -xvf GBase8tV8.5.12.10.FC4G1AEE_1.6.3.54.RHEL6_x86.tar
[root@node1 file]# ./ids_install $INFORMIXDIR
6 数据库 初始化
su - informix
1) 创建DBSPACE,授权
cd /opt/dbs
touch rootdbs
chmod 660 rootdbs
2)相关配置文件
cp $INFORMIXDIR/etc/sqlhosts.std $INFORMIXSQLHOSTS
cd $INFORMIXDIR
cp $INFORMIXDIR/etc/onconfig.std $INFORMIXDIR/etc/$ONCONFIG
3)配置数据库 IP,端口
echo "$INFORMIXSERVER onsoctcp 192.168.1.100 9088">>$INFORMIXSQLHOSTS
4) 其他 配置
sed -i "s#^ROOTPATH.*#ROOTPATH /opt/dbs/rootdbs #g" $INFORMIXDIR/etc/$ONCONFIG
sed -i "s#^DBSERVERNAME.*#DBSERVERNAME $INFORMIXSERVER #g" $INFORMIXDIR/etc/$ONCONFIG
sed -i "s#^TAPEDEV.*#TAPEDEV /dev/null #g" $INFORMIXDIR/etc/$ONCONFIG
sed -i "s#^LTAPEDEV.*#LTAPEDEV /dev/null #g" $INFORMIXDIR/etc/$ONCONFIG
5) 数据库 初始化
# oninit -ivy
7 创建其他 DBSPACE,授权
1)dbspcae 创建
cd /opt/dbs
touch datadbs1 datadbs2 plogdbs logdbs2 tmpdbs1 tmpdbs2
chmod 660 datadbs1 datadbs2 plogdbs logdbs2 tmpdbs1 tmpdbs2
onspaces -c -d datadbs1 -p /opt/dbs/datadbs1 -o 0 -s 200000 -k 8k
onspaces -c -d datadbs2 -p /opt/dbs/datadbs2 -o 0 -s 200000 -k 8k
onspaces -c -d plogdbs -p /opt/dbs/plogdbs -o 0 -s 2000000
onspaces -c -d logdbs2 -p /opt/dbs/logdbs2 -o 0 -s 2000000
onspaces -c -d tmpdbs1 -p /opt/dbs/tmpdbs1 -o 0 -s 200000 -t -k 8k
onspaces -c -d tmpdbs2 -p /opt/dbs/tmpdbs2 -o 0 -s 200000 -t -k 8k
2) sbspace 大对象的 空间创建 -S 参数
onspaces -c -S sbspace -p /opt/dbs/sbspace -o 0 -s 2000000 -k 8k
8 常用命令
1) 静默 模式,杀掉用户连接
onmode -uy
2) 多用户模式
onmode -m
3) 关闭数据库
onmode -ky
4) 启动数据库
oninit -vy
5) 日志等 文件操作
onparams -p -s 1999000 -d plogdbs -y
onparams -a -d logdbs2 -s 100000
6)与备份有关的
ontape -s -L 0
7) 数据库状态
a: 启动状态
onstat -m
b: 当前连接用户
onstat -g sql
c: 数据库 空间
onstat -d
9 优化数据库参数重启数据库
sed -i "s#^SBSPACENAME.*#SBSPACENAME sbspace #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^SYSSBSPACENAME.*#SYSSBSPACENAME sbspace #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^DBSPACETEMP.*#DBSPACETEMP tmpdbs1,tmpdbs2 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^MULTIPROCESSOR.*#MULTIPROCESSOR 1 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^VPCLASS.*#VPCLASS cpu,num=2,noage #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^CLEANERS.*#CLEANERS 32 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^LOCKS.*#LOCKS 100000 # g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^DEF_TABLE_LOCKMODE.*#DEF_TABLE_LOCKMODE row #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^SHMVIRTSIZE.*#SHMVIRTSIZE 326560 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^SHMADD.*#SHMADD 82656 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^BUFFERPOOL size=8K.*#BUFFERPOOL size=8K, buffers=50000,lrus=32,lru_min_dirtyize=50,lru_max_dirtyize=60 #g" $INFORMIXDIR/etc/$ONCONFIG;
10 连接方式
1) JDBC 连接
jdbc:informix-sqli://192.168.5.120:9088/testdb:informixserver=gbaseserver;DB_LOCALE=zh_cn.GB18030-2000;CLIENT_LOCALE=zh_cn.GB18030-2000;NEWCODESET=GB18030,GB18030-2000,5488
2) dbaccess 连接
# dbaccess dbname -
例如: dbaccess ifmis_jsx -
11 启动错误处理 : 如果启动 报错,请参考下面的 操作
1)oninit -ivy
shared memory not initialized for INFORMIXSERVER 'gbaseserver'
[informix@localhost ~]$ onstat -m
shared memory not initialized for INFORMIXSERVER 'gbaseserver'
Message Log File: /home/informix/gbase/tmp/online.log
11:03:42 CCFLAGS2 value set to 0x200
11:03:42 SQL_FEAT_CTRL value set to 0x8008
11:03:42 SQL_DEF_CTRL value set to 0x4b0
11:03:42 GBase 8t Database Server Version 12.10.FC4G1AEE Software Serial Number AAA#B000000
11:03:42 Assert Warning: Unable to bind to the port (9088) on the host (192.168.1.100) for the server (gbaseserver).
11:03:42 GBase 8t Database Server Version 12.10.FC4G1AEE
11:03:42 Who: Session(3, informix@, 0, (nil))
Thread(9, soctcplst, 0, 1)
File: soc_be.c Line: 2501
11:03:42 stack trace for pid 2265 written to /home/informix/gbase/tmp/af.3f1060e
11:03:42 See Also: /home/informix/gbase/tmp/af.3f1060e
11:03:42 Unable to bind to the port (9088) on the host (192.168.1.100) for the server (gbaseserver).
11:03:42 DISK INITIALIZATION ABORTED: potential instance overwrite detected.
To disable this check, set FULL_DISK_INIT to 1 in your config file and retry.
11:03:42 oninit: Fatal error in shared memory initialization
11:03:42 GBase 8t Database Server Stopped.
11:03:42 mt_shm_remove: WARNING: may not have removed all/correct segments
[informix@localhost ~]$
2) FULL_DISK_INIT 参数 --重新初始化前需要将该参数 设置为1
11:10:09 DISK INITIALIZATION ABORTED: potential instance overwrite detected.
To disable this check, set FULL_DISK_INIT to 1 in your config file and retry.
11:10:09 oninit: Fatal error in shared memory initialization
11:10:09 GBase 8t Database Server Stopped.
11:10:09 mt_shm_remove: WARNING: may not have removed all/correct segments
# vi /home/informix/gbase/etc/onconfig.gbaseserver
FULL_DISK_INIT 1
3) oninit: Not enough room in ROOT DBspace.
Requested 2250038K, ONCONFIG value 'ROOTSIZE' 300000K.
FAILED
8T数据库搭建
/***********************************************************************************************************/
1 安装虚拟机 D:\jibunn\software\vmware\oracle-vm\VirtualBox-5.0.20-106931-Win 到 D:\vm
2 虚拟机 上 安装LINUX6 D:\jibunn\software\linux-操作系统\centos-6.8 到 D:\vmlinuxnode1
使用setup 设置网卡 选on boot ,虚拟机配置为 1.bridged(桥接模式)
3 安装xftp4
4 创建用户和 目录
1) 创建用户,组,设置口令
groupadd informix
useradd -g informix -d /home/informix -s /bin/bash -m informix
passwd informix
2)创建安装目录
mkdir /home/informix/gbase
chown -Rf informix:informix /home/informix/gbase
3) 创建数据库 文件目录
cd /opt
mkdir dbs
chown -Rf informix:informix dbs
4)配置.bash_profile
su - informix
# vi .bash_profile
export INFORMIXSERVER=gbaseserver
export INFORMIXDIR=/home/informix/gbase
export ONCONFIG=onconfig.gbaseserver
export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts.gbaseserver
export PATH=$INFORMIXDIR/bin:/usr/bin:${PATH}:.
export GL_DATE="%m%d%iY"
export DATETIME="%iY-%m-%d %H:%M:%S"
export DB_LOCALE=zh_cn.utf8
export CLIENT_LOCALE=zh_cn.utf8
export LD_LIBRARY_PATH=${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql:${INFORMIXDIR}/lib/cli
export TERM=vt100
export TREMCAP=$INFORMIXDIR/etc/termcap
export INFORMIXTERM=termcap
export DBTEMP=$INFORMIXDIR/tmp
--注:
INFORMIXSERVER 为INFORMIX server 的名称
INFORMIXDIR 为INFORMIX 安装目录
ONCONFIG 为 配置文件名称
GL_DATE 为日期数据显示格式
DB_LOCALE 为 服务器,数据库
CLIENT_LOCALE 为客户端 字符集
5 安装 8T D:\南大通用\GBase 8t培训\GBase8tV8.5.12.10.FC4G1AEE_1.6.3.54.RHEL6_x86
[root@node1 file]# tar -xvf GBase8tV8.5.12.10.FC4G1AEE_1.6.3.54.RHEL6_x86.tar
[root@node1 file]# ./ids_install $INFORMIXDIR
6 数据库 初始化
su - informix
1) 创建DBSPACE,授权
cd /opt/dbs
touch rootdbs
chmod 660 rootdbs
2)相关配置文件
cp $INFORMIXDIR/etc/sqlhosts.std $INFORMIXSQLHOSTS
cd $INFORMIXDIR
cp $INFORMIXDIR/etc/onconfig.std $INFORMIXDIR/etc/$ONCONFIG
3)配置数据库 IP,端口
echo "$INFORMIXSERVER onsoctcp 192.168.1.100 9088">>$INFORMIXSQLHOSTS
4) 其他 配置
sed -i "s#^ROOTPATH.*#ROOTPATH /opt/dbs/rootdbs #g" $INFORMIXDIR/etc/$ONCONFIG
sed -i "s#^DBSERVERNAME.*#DBSERVERNAME $INFORMIXSERVER #g" $INFORMIXDIR/etc/$ONCONFIG
sed -i "s#^TAPEDEV.*#TAPEDEV /dev/null #g" $INFORMIXDIR/etc/$ONCONFIG
sed -i "s#^LTAPEDEV.*#LTAPEDEV /dev/null #g" $INFORMIXDIR/etc/$ONCONFIG
5) 数据库 初始化
# oninit -ivy
7 创建其他 DBSPACE,授权
1)dbspcae 创建
cd /opt/dbs
touch datadbs1 datadbs2 plogdbs logdbs2 tmpdbs1 tmpdbs2
chmod 660 datadbs1 datadbs2 plogdbs logdbs2 tmpdbs1 tmpdbs2
onspaces -c -d datadbs1 -p /opt/dbs/datadbs1 -o 0 -s 200000 -k 8k
onspaces -c -d datadbs2 -p /opt/dbs/datadbs2 -o 0 -s 200000 -k 8k
onspaces -c -d plogdbs -p /opt/dbs/plogdbs -o 0 -s 2000000
onspaces -c -d logdbs2 -p /opt/dbs/logdbs2 -o 0 -s 2000000
onspaces -c -d tmpdbs1 -p /opt/dbs/tmpdbs1 -o 0 -s 200000 -t -k 8k
onspaces -c -d tmpdbs2 -p /opt/dbs/tmpdbs2 -o 0 -s 200000 -t -k 8k
2) sbspace 大对象的 空间创建 -S 参数
onspaces -c -S sbspace -p /opt/dbs/sbspace -o 0 -s 2000000 -k 8k
8 常用命令
1) 静默 模式,杀掉用户连接
onmode -uy
2) 多用户模式
onmode -m
3) 关闭数据库
onmode -ky
4) 启动数据库
oninit -vy
5) 日志等 文件操作
onparams -p -s 1999000 -d plogdbs -y
onparams -a -d logdbs2 -s 100000
6)与备份有关的
ontape -s -L 0
7) 数据库状态
a: 启动状态
onstat -m
b: 当前连接用户
onstat -g sql
c: 数据库 空间
onstat -d
9 优化数据库参数重启数据库
sed -i "s#^SBSPACENAME.*#SBSPACENAME sbspace #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^SYSSBSPACENAME.*#SYSSBSPACENAME sbspace #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^DBSPACETEMP.*#DBSPACETEMP tmpdbs1,tmpdbs2 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^MULTIPROCESSOR.*#MULTIPROCESSOR 1 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^VPCLASS.*#VPCLASS cpu,num=2,noage #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^CLEANERS.*#CLEANERS 32 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^LOCKS.*#LOCKS 100000 # g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^DEF_TABLE_LOCKMODE.*#DEF_TABLE_LOCKMODE row #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^SHMVIRTSIZE.*#SHMVIRTSIZE 326560 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^SHMADD.*#SHMADD 82656 #g" $INFORMIXDIR/etc/$ONCONFIG;
sed -i "s#^BUFFERPOOL size=8K.*#BUFFERPOOL size=8K, buffers=50000,lrus=32,lru_min_dirtyize=50,lru_max_dirtyize=60 #g" $INFORMIXDIR/etc/$ONCONFIG;
10 连接方式
1) JDBC 连接
jdbc:informix-sqli://192.168.5.120:9088/testdb:informixserver=gbaseserver;DB_LOCALE=zh_cn.GB18030-2000;CLIENT_LOCALE=zh_cn.GB18030-2000;NEWCODESET=GB18030,GB18030-2000,5488
2) dbaccess 连接
# dbaccess dbname -
例如: dbaccess ifmis_jsx -
11 启动错误处理 : 如果启动 报错,请参考下面的 操作
1)oninit -ivy
shared memory not initialized for INFORMIXSERVER 'gbaseserver'
[informix@localhost ~]$ onstat -m
shared memory not initialized for INFORMIXSERVER 'gbaseserver'
Message Log File: /home/informix/gbase/tmp/online.log
11:03:42 CCFLAGS2 value set to 0x200
11:03:42 SQL_FEAT_CTRL value set to 0x8008
11:03:42 SQL_DEF_CTRL value set to 0x4b0
11:03:42 GBase 8t Database Server Version 12.10.FC4G1AEE Software Serial Number AAA#B000000
11:03:42 Assert Warning: Unable to bind to the port (9088) on the host (192.168.1.100) for the server (gbaseserver).
11:03:42 GBase 8t Database Server Version 12.10.FC4G1AEE
11:03:42 Who: Session(3, informix@, 0, (nil))
Thread(9, soctcplst, 0, 1)
File: soc_be.c Line: 2501
11:03:42 stack trace for pid 2265 written to /home/informix/gbase/tmp/af.3f1060e
11:03:42 See Also: /home/informix/gbase/tmp/af.3f1060e
11:03:42 Unable to bind to the port (9088) on the host (192.168.1.100) for the server (gbaseserver).
11:03:42 DISK INITIALIZATION ABORTED: potential instance overwrite detected.
To disable this check, set FULL_DISK_INIT to 1 in your config file and retry.
11:03:42 oninit: Fatal error in shared memory initialization
11:03:42 GBase 8t Database Server Stopped.
11:03:42 mt_shm_remove: WARNING: may not have removed all/correct segments
[informix@localhost ~]$
2) FULL_DISK_INIT 参数 --重新初始化前需要将该参数 设置为1
11:10:09 DISK INITIALIZATION ABORTED: potential instance overwrite detected.
To disable this check, set FULL_DISK_INIT to 1 in your config file and retry.
11:10:09 oninit: Fatal error in shared memory initialization
11:10:09 GBase 8t Database Server Stopped.
11:10:09 mt_shm_remove: WARNING: may not have removed all/correct segments
# vi /home/informix/gbase/etc/onconfig.gbaseserver
FULL_DISK_INIT 1
3) oninit: Not enough room in ROOT DBspace.
Requested 2250038K, ONCONFIG value 'ROOTSIZE' 300000K.
FAILED