1. 程式人生 > >Redhat 安裝Informix 12.10

Redhat 安裝Informix 12.10

IBM官方下載 Informix 12.10   Developer Edition

https://www.ibm.com/developerworks/cn/downloads/im/informix/index.html

前提環境

linux 版本:  Redhat6.6
linux主機名:redhat
informix安裝包:iif.12.10.FC12DE.linux-x86_64.tar
informix服務名: tramsserver 

安裝步驟

整個安裝過程都以root使用者執行

1. 建立informix使用者
# groupadd -g 1000 informix
# useradd -g informix -d /opt/informix -m -s /bin/bash  informix
#passwd informix

2. 設定環境變數,直接命令列執行即可

INFORMIXDIR=/opt/informix
export INFORMIXDIR
PATH=$PATH:$INFORMIXDIR/bin
export PATH

3. 解壓安裝包
# tar xvf iif.12.10.FC12DE.linux-x86_64.tar

4. 執行"ids_install"進行安裝
# ./ids_install
選擇非GUI模式安裝,其他根據提示保持預設選項

安裝後的配置

1. 切換到informix使用者
su - informix

2.  修改 "~/.basr_profile"檔案,加入如下環境變數
export INFORMIXDIR=/opt/informix
export INFORMIXSQLHOSTS=/opt/informix/etc/sqlhosts
export ONCONFIG=onconfig.tramsserver
export INFORMIXSERVER=tramsserver
export PATH=$INFORMIXDIR/bin:.:$PATH
使修改生效
. ~/.bash_profile

3. 拷貝"onconfig"配置模板
cd $INFORMIXDIR/etc
cp onconfig.std onconfig.tramsserver

4. 編輯"onconfig.tramsserver",修改或新增以下內容
DBSERVERNAME tramsserver
PHYSDBS rootdbs
ROOTNAME rootdbs
ROOTPATH /opt/informix/data/rootdbs
NETTYPE soctcp,1,50,NET
LTAPEDEV /dev/null

5. 建立"rootdbs"資料庫空間檔案
cd /opt/informix/
mkdir data
cd data
touch rootdbs logdbs tempdbs userdbs phydbs
chmod 660 *dbs
注意:“rootdbs”檔案許可權必須是:660

6. 修改"/opt/informix/etc/sqlhosts"檔案
cp sqlhosts.std sqlhosts 修改
tramsserver onsoctcp 192.168.0.110 12100
第一列為資料庫服務名;第三列為機器名;

重新初始化資料庫

1. 初始化資料庫
oninit -ivy
檢視訊息日誌 onstat -m

2.新增storage spaces (logdbs tempdbs userdbs phydbs)
eg:
$ onspaces -c -d tempdbs -p /opt/informix/data/tempdbs -o 0 -s 40960 


[[email protected] etc]$  onstat -d

IBM Informix Dynamic Server Version 12.10.FC12DE -- On-Line -- Up 00:09:29 -- 164468 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
44bd1028         1        0x20001    1        1        2048     N  BA    informix rootdbs
4d74a8b0         2        0x20001    2        1        2048     N  BA    informix logdbs
462a3d50         3        0x20001    3        1        2048     N  BA    informix phydbs
462b2d50         4        0x20001    4        1        2048     N  BA    informix tempdbs
45e1d5c0         5        0x20001    5        1        2048     N  BA    informix userdbs
 5 active, 2047 maximum

Chunks
address          chunk/dbs     offset     size       free       bpages     flags pathname
44bd1268         1      1      0          150000     85067                 PO-B-- /opt/informix/data/rootdbs
462a3028         2      2      0          20480      20427                 PO-B-- /opt/informix/data/logdbs
462b2028         3      3      0          20480      20427                 PO-B-- /opt/informix/data/phydbs
46152028         4      4      0          20480      20427                 PO-B-- /opt/informix/data/tempdbs
4644a028         5      5      0          20480      20427                 PO-B-- /opt/informix/data/userdbs
 5 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.


Expanded chunk capacity mode: always

3. 開啟、停止當前資料庫程序

oninit -vy
onmode -ky

4.IDS使用者介面工具DB-Acess

[[email protected] ]$ more test.sql 
create database test;
create table table_test(col1 int);
 
insert into table_test values (1);
insert into table_test values (2);
insert into table_test values (3);

[[email protected] sql]$ ls -ltr
total 4
-rw-rw-r--. 1 informix informix 162 Dec  9 14:46 test.sql
[[email protected] sql]$ dbaccess - test.sql 

Database created.


Table created.


1 row(s) inserted.


1 row(s) inserted.


1 row(s) inserted.


Database closed.

[[email protected] sql]$ dbaccess - -
> database test;

Database selected.

> select * from table_test;


       col1 

          1
          2
          3

3 row(s) retrieved.

> 

Database closed.