2012年1月17日 星期二

Informix基本安裝步驟-IBM AIX環境(SUN和HP類似)


首先,我們當然要取得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重新開機資料庫即可。

沒有留言: