【正文】
OnLine 實例(Instance)至少要有一個root dbspace。數(shù)據(jù)庫管理員(DBA) 和數(shù)據(jù)庫(database)和表(table )的創(chuàng)建者可以指定自己的數(shù)據(jù)存放在那個 dbspace 上,但是不能控制具體是存放在該 dbspace 的那個 chunk 上,這是由 OnLine 來決定的。Dbspace 和 chunk 之間的關(guān)系類似于大多數(shù) UNIX 系統(tǒng)中的邏輯卷(Volume)和物理分區(qū)(Subdisk)之間的關(guān)系,往 dbspace 上增加 chunk 類似于卷的動態(tài)擴容。數(shù)據(jù)空間的規(guī)劃包括兩部分工作:[ Informix 數(shù)據(jù)庫手冊 ]共 74 頁 第 10 頁 1.確定需要創(chuàng)建幾個 dbspace 以及每個 dbspace 的用途。2.確定每個 dbspace 的初始空間大小和位置,據(jù)此創(chuàng)建 chunk。這兩部分工作是相互關(guān)聯(lián)的。數(shù)據(jù)空間的規(guī)劃主要有以下作用:1.提高關(guān)鍵數(shù)據(jù)的可靠性。root dbspace、日志文件和其他關(guān)鍵數(shù)據(jù)所在的 chunk 可以建在采用 RAID 技術(shù)進行容錯的磁盤陣列上或進行軟件鏡像。2.提高 I/O 性能。在有多個硬盤和控制器的情況下,盡量將 I/O 操作均衡地分布到各個硬盤上。在多個硬盤的性能有差異的情況下,將最頻繁存取的數(shù)據(jù)放在性能最高的硬盤和分區(qū)上。3.方便備份和恢復工作。因為備份和恢復都是以 dbspace 為最小單位的。因此將不同用途的數(shù)據(jù)放到不同的 dbspace 上可以減輕備份和恢復的工作量。一般說來,至少要創(chuàng)建 4 個 dbspace,分工如下:rootdbs:存放系統(tǒng)數(shù)據(jù)和物理日志。(在 oninit –i 時邏輯日志和物理日志都是放在rootdbs 中的,一定要把邏輯日志放在 logdbs 上)tempdbs:存放臨時表。logdbs:存放邏輯日志。userdbs:存放用戶數(shù)據(jù)。每個 dbspace 的初始 chunk 的大小沒有必要開得很大,非要把所有的硬盤空間都用完,只要夠用就可以了。因為 chunk 增加容易刪除難,把暫時不用的硬盤空間預留起來更加靈活。chunk 有兩種類型,一種是采用塊設(shè)備作為 chunk,稱為 raw disk 方式;另一種是采用普通文件作為 chunk,稱為 cooked file 方式。不難理解, raw disk 方式要比 cooked file 方式效率高。為了提高性能,應該盡可能采用 raw disk 方式的 chunk。創(chuàng)建 raw disk 方式的 chunk 時要注意以下幾點:目前的 OnLine 版本,每個 chunk 最大只能到 2GB,因此創(chuàng)建 raw disk 時大小不要超過2GB,否則超過 2GB 的部分就浪費了。如果 dbspace 需要 2GB 以上的空間,必須創(chuàng)建多個chunk。一些版本的 UNIX,都把 volume 的最后幾 K 空間作為保留區(qū)。因此,如果你想創(chuàng)建一個1000MB 的 chunk,在創(chuàng)建 volume 時,最好建 1001MB,以免 nformix 初始化時失敗。如果要創(chuàng)建 cooked file 方式的 chunk,只要在相應文件系統(tǒng)中你想要放置 chunk 的位置創(chuàng)建一個空文件。命令為:$cat /dev/null 想創(chuàng)建的空文件名在 OnLine 初始化時,會將該文件增大到你設(shè)定的 chunk 大小。注意要保證該文件系統(tǒng)中有足夠的空間創(chuàng)建 chunk。 創(chuàng)建 informix 組和用戶(開始) informix 選擇一個 home 目錄,要保證該目錄所在的文件系統(tǒng)有足夠的空間安裝Informix 軟件。查看文件系統(tǒng)的剩余空間用 df 命令。假設(shè)選定的 informix 的 home 目錄名為/home/informix。 [ Informix 數(shù)據(jù)庫手冊 ]共 74 頁 第 11 頁 informix 組和用戶。 groupadd informix useradd –g informix –m –d /usr/informix –s/usr/bin/ksh informix 舉例:useradd –g informix –m –d/usr/lscp –s/usr/bin/ksh lscpuseradd –g informix –m –d/usr/smp –s/usr/bin/csh smpuseradd –g informix –m –d/usr/ss7 –s/usr/bin/ksh ss7修改 informix 的口令 passwd informix修改/home/informix/.profile,增加以下幾行:INFORMIXDIR=/usr/informixINFORMIXSERVER=fepdb1ONCONFIG=onconfigCLIENT_LOCALE=DB_LOCALE=PS1=[`whoami`@`hostname`:`tty`]39。 $PWD $39。export PS1PATH=$PATH:$INFORMIXDIR/binLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esqlexport INFORMIXDIR INFORMIXSERVER ONCONFIG PATH解釋:fepdb1 為數(shù)據(jù)庫 server 名稱onconfig 為 informix online 運行的配置方案。LD_LIBRARY_PATH 為 informix 所需要的環(huán)境變量.CLIENT_LOCALE=DB_LOCALE=export CLIENT_LOCALE DB_LOCALE 安裝 informix 產(chǎn)品 INFORMIX 產(chǎn)品(OnLine 和 ESQL/C)從安裝介質(zhì)(磁帶或光盤)展開到informix 用戶的 HOME 目錄下。假設(shè)安裝介質(zhì)為光盤,如果光驅(qū)的設(shè)備名為/dev/disk/cdrom0a,則過程可能為:如果需要開發(fā)環(huán)境需要裝 esql。需要把 cli sdk 那張光盤先行展開并安裝。 mkdir /mnt mount –r /dev/disk/cdrom0a /mnt /*先插入 IDS 的安裝光盤*/ cd /usr/informix cpio –idv /mnt/SERVER/ cpio –idv /mnt/ICONNECT/DEC/ umount /mnt /*然后取出 IDS 的安裝光盤*/解釋:不同的系統(tǒng)設(shè)備文件名稱不同。 INFORMIXDIR=/usr/informix export INFORMIXDIR執(zhí)行安裝命令cd /usr/informix /*注意先裝 ESQL/C,再裝 OnLine*/./installconn /*需要輸入產(chǎn)品的序列號和密碼 ACPJ267193 PDEFJO*/ Your existing INFORMIX shared libraries, if any, will be replaced and upgraded.[ Informix 數(shù)據(jù)庫手冊 ]共 74 頁 第 12 頁 Are you sure? [yes/no]yesIs IConnect being installed along with Informix database serverversion (required to be run as user informix)?(yes or no) 回車Enter your serial number (for example, INFX999999) WARNING! This software, and its authorized use and number of users, aresubject to the applicable license agreement with Informix Software, Inc.If the number of users exceeds the licensed number, the excess users maybe prevented from using the software. UNAUTHORIZED USE OR COPYING MAYSUBJECT YOU AND YOUR COMPANY TO SEVERE CIVIL AND CRIMINAL LIABILITIES.Press RETURN to continue,or the interrupt key (usually CTRLC or DEL) to abort. 回車Informix Product: INFORMIXConnectInstallation Directory: /usr/informixPerforming root portion of installation of INFORMIXConnect...Installation of INFORMIXConnect plete ./installserver /*需要輸入產(chǎn)品的序列號和密碼*/Installation and Configuration ScriptThis installation procedure must be run by a privileged user (Super User)It will change the owner, group, mode, (and other file attributes onSecure systems) of all files of this package in this directory. There must be a user informix and a group informix known to the system.Press RETURN to continue,or the interrupt key (usually CTRLC or DEL) to Enter your serial number (for example, INFX999999) ACPJ267193 Enter your serial number KEY (uppercase letters only) PDEFJOWARNING! This software, and its authorized use and number of users, aresubject to the applicable license agreement with Informix Software, Inc.If the number of users exceeds the licensed number, the excess users maybe prevented from using the software. UNAUTHORIZED USE OR COPYING MAYSUBJECT YOU AND YOUR COMPANY TO SEVERE CIVIL AND CRIMINAL LIABILITIES.Press RETURN to continue,or the interrupt key (usually CTRLC or DEL) to abort. 回車 修改內(nèi)核參數(shù)(一定要小心)因為 OnLine 需要申請大量的共享內(nèi)存和信號量,因此,一般 UNIX 系統(tǒng)的缺省內(nèi)核參數(shù)都不能滿足要求,必須進行修改。在 Informix 的聯(lián)機說明文檔 中給出了 OnLine對內(nèi)核參數(shù)的要求。在 OnLine 版中,該文件路徑為 /usr/informix/release/en_us/0333 [ Informix 數(shù)據(jù)庫手冊 ]共 74 頁 第 13 頁該文件內(nèi)容可能是:INFORMIXOnLine Dynamic Server Shared Memory and Kernel Parameters:===============================================================The following kernel parameters must be adjusted to the indicated valuesfor minimally acceptable Informix Online performance. See your Compaq/DigitalUNIX System Administrators Guide, or the doconfig (8) man page, for informationon adjusting these kernel parameters.SHMMAX: 2147483647SHMMIN: 1SHMALL: Not ApplicableSHMMNI: 150SHMSEG: 150SHMBRK: Not ApplicableMAXMEM: Not ApplicableSEMMNI: 400SEMMNS: 100SEMMSL: 1600NFILES: Not ApplicableL