AIX安裝Oracle 11g用戶端、Pro*C/C++編譯環境
- 安裝準備:
首先需要確定AIX版本是否滿足Oracle 11g用戶端安裝的最低要求,可查看Oracle官網相關文檔(http://download.oracle.com/docs/cd/B28359_01/install.111/b32334/toc.htm#CHDFFBIF),處說明了Oracle 11g Release 1用戶端對作業系統的最低要求為:
AIX 5L version 5.3, TL 05, Service Pack 06AIX 6L version 6.1, TL 00, Service Pack 04 or later
文檔(http://download.oracle.com/docs/cd/E11882_01/install.112/e18192/toc.htm#CIHFICFD)處說明了Oracle 11g Release 2用戶端對作業系統的最低要求為:
AIX 5L V5.3 TL 09 SP1 ("5300-09-01"), 64 bit kernelAIX 6.1 TL 02 SP1 ("6100-02-01), 64-bit kernelAIX 7.1 TL 0 SP1 ("7100-00-01"), 64-bit kernel
AIX上可以使用oslevel或oslevel -s查看 AIX具體版本資訊。如果已確認了作業系統版本,但報aio(非同步IO)相關錯誤可參考網上另一篇文章處理,請大家自己google之。公司伺服器AIX版本為5300-06-01-0000,故只能安裝release 1的用戶端此處以安裝Oracle 11g release 1 64位用戶端為例。
首先需要從http://www.oracle.com/technetwork/topics/aix5lsoft-098883.html 下載
basic-11.1.0.7.0-aix-ppc64.zipsdk-11.1.0.7.0-aix-ppc64.zipsqlplus-11.1.0.7.0-aix-ppc64.ziptools-11.1.0.7.0-aix-ppc64.zipprecomp-11.1.0.7.0-aix-ppc64.zip
AIX不內建unzip等程式,可在 windows機器上全部解壓,解壓後組建檔案夾instantclient_11_1。
- 安裝過程:
- 將解壓出來的instantclient_11_1目錄整個上傳至AIX使用者目錄下。
- 添加ORACLE_HOME等環境變數。
在.profile中添加如下內容:
export ORACLE_HOME=$HOME/instantclient_11_1export ORACLE_SID=orclexport LD_LIBRARY_PATH=$ORACLE_HOME:${LD_LIBRARY_PATH}export PATH=$ORACLE_HOME:$ORACLE_HOME/sdk:$PATH
- 建立TNS檔案。
mkdir -p $ORACLE_HOME/network/admintouch $ORACLE_HOME/ network/admin/tnsnames.ora編輯tnsnames.ora內容大致如下:orcl = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.1.2.202)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
- 測試
sqlplus unionkms@orclSQL*Plus: Release 11.1.0.7.0 - Production on Wed Feb 23 16:41:07 2011Copyright (c) 1982, 2008, Oracle. All rights reserved.Enter password: Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP and Data Mining optionsSQL> desc branch; Name Null? Type ----------------------------------------- -------- ---------------------------- UNID NOT NULL CHAR(40) UNBRANCHTYPEID NOT NULL CHAR(40) UNBRANCHFIELD NUMBER(38) UNBRANCHID CHAR(50) UNKMCID CHAR(40) UNIDOFMNGSVR CHAR(40) UNSECUSERVICESVRID CHAR(40) UNMONITORSVRID CHAR(40) UNMANAGER CHAR(128) UNPHONE CHAR(128) UNFAX CHAR(128) UNEMAIL CHAR(128) UNHTTPADDR VARCHAR2(256) UNREMARK CHAR(128) UNINPUTTELLER CHAR(20) UNINPUTDATE CHAR(8) UNINPUTTIME CHAR(6) UNUPDATETELLER CHAR(20) UNUPDATEDATE CHAR(8) UNUPDATETIME CHAR(6)SQL>
Pro*C檔案pc_test中。
pcscfg.cfg :
sys_include=(/u2/chenlong/instantclient_11_1/sdk/include,/usr/include)ltype=shortdefine=__64BIT__define=_IBM_Cdefine=_LONG_LONG
a1.pc :
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "sqlca.h"int main(void){EXEC SQL INCLUDE sqlca;EXEC SQL BEGIN DECLARE SECTION;char *user = "unionkms";char *passwd = "unionkms";char *db = "orcl";EXEC SQL END DECLARE SECTION;EXEC SQL CONNECT :user IDENTIFIED BY :passwd USING :db;if (sqlca.sqlcode == 0)printf("connect success!\n");elseprintf("connect fail!\n");return 0;}
makefile :
all: a1.pcproc config=pcscfg.cfg iname=a1.pccc -q64 -I /u2/chenlong/instantclient_11_1/sdk/include/ -c a1.c cc -q64 -L/u2/chenlong/instantclient_11_1/ -lclntsh -o a1 a1.oclean:rm a1.lis a1.o
(轉載時請註明作者和出處。未經許可,請勿用於商業用途)
更多文章請訪問我的Blog: http://www.cnblogs.com/logicbaby