1. 下載oraclefor Linux ,上傳至Linux
若CentOS的版本太高Oracle不支援此版本時,需修改設定檔,使其支援Oracle10g:
$ vim /etc/redhat-release
直接修改內容為: CentOSLinux release 4.0 (Final)
安裝完成之後,將其改回:CentOSLinux release 6.0 (Final)
2. 安裝前準備
(2)環境要求: 檢查包
rpm –q gcc
rpm –q make
rpm –q setarch
rpm –q openmotif
rpm –q libgomp
rpm –q libXp
rpm –q glibc
rpm –q compat-libstdc++
基本有這些包就不會出錯了.
要保證Internet可用,上述包大部分在安裝OS時已經安裝了,沒有安裝的用yum install直接安裝即可.
yum install gcc
yum install make
yum install setarch
yum install openmotif
yum install libgomp
yum install libXp
yum install glibc
yum install compat-libstdc++
3. 核心參數修改
1)vim /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
#the configuration @ superdome
#kernel.shmall = 2147483648
#kernel.shmmax = 137438953472
#kernel.shmmni = 4096
# semaphores: semmsl,semmns, semopm, semmni
kernel.sem =250 32000 100 128 #four numbers
fs.file-max =65536
net.ipv4.ip_local_port_range= 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
對以上設定生效 /sbin/sysctl-p
2)vim /etc/security/limits.conf加入以下內容
* soft nproc2047
* hard nproc16384
* soft nofile1024
* hard nofile65536
3)vim /etc/pam.d/login在後面加入一行,注意對應
sessionrequired /lib/security/pam_limits.so
4)vim/etc/selinux/config--(禁用SELINUX,安裝完後可再還原成原值)將SELINUX設定為
SELINUX=disabled
4. 添加使用者和組
groupadd oinstall
groupadd dba
#groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle
5. 建立oracle安裝資料夾,並設定相應許可權
假設裝在/opt這個掛載點下:
mkdir -p /opt/oracle/product/10.2.0/db_1
chown -R oracle:oinstall/opt/oracle
6. 修改使用者環境變數
su - oracle
vi .bash_profile添加如下內容
# for installing oracle
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
# RACLE_DATA=$ORACLE_BASE/oradata
ORACLE_SID=orcl
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/network/lib
CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
# NLS_LANG="SIMPLIFIEDCHINESE_CHINA.ZHS16GBK"
export ORACLE_BASE
export ORACLE_HOME
# export RACLE_DATA
export ORACLE_SID
export PATH
export LD_LIBRARY_PATH
export CLASSPATH
#export LANG
if [ $USER = "oracle"]; then
if [ $SHELL = "/bin/ksh"]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
注意:ORACLE_BASE , ORACLE_HOME, JAVA_HOME ;ORACLE_SID=orcl為oracle設定SID
安裝前的注意:
1)root使用者執行:xhost+
2)若CentOS是英文環境,oracle亂碼時可修改/etc/sysconfig/i18n
#LANG="en_US.UTF-8"
#SUPPORTED="en_US.UTF-8:en_US:en"
#SYSFONT="latarcyrheb-sun16"
LANG="zh_CN.GBK"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:zh_CN.GBK"
3)修改oracle字元集
su - oracle
sqlplus /nolog
conn/as sysdba
shutdown immediate
startup
alter system enable restricted session;
alter system set job_queue_processes=0;
alter system set aq_tm_processes=0;
alter database open;
alter database character set internal_use ZHS16GBK;
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE AL16UTF16;
shutdown immediate ;
startup ;
查看oracle字元集:
select userenv('language') from dual;
7. 建立response檔案
此檔案是一個回答oracle正常圖形安裝時的回應檔.將oracle壓縮檔解壓後會出現database目錄,假設路徑為:
/home/oracle/database
在/home/oracle/database/response中找到enterprise把檔案拷貝出來,如拷貝到 /opt/oracle/product 中,修改一下相關設定,儲存即可.需要修改的設定如下:
FROM_LOCATION="/home/oracle/database/stage/products.xml"
ORACLE_HOME="/opt/oracle/product/10.2.0/db_1"
ORACLE_HOME_NAME="OraDb10g_home1" #optionally
UNIX_GROUP_NAME="oinstall" #the initial group of oracle
INSTALL_TYPE="EE"
s_nameForDBAGrp="dba" #the supplementary group of oracle
s_nameForOPERGrp=”oper”# not essential
SELECTED_LANGUAGES={"en","zh_CN"} # not essential
COMPONENT_LANGUAGES={"en","zh_CN"} # not essential
n_dbType="1"
s_globalDBName="orcl"
s_dbSid="orcl"
n_dbStorageType="1"
n_performUpgrade="0"
基本上這些就夠了,儲存即可。
8. 開始安裝,oracle帳戶進入安裝目錄:
./runInstaller -silent-responseFile /opt/oracle/product/enterprise.rsp
若出現:
# An unexpected error hasbeen detected by HotSpot Virtual Machine:
# SIGILL (0x4) atpc=0x20000000039a4070, pid=6583, tid=2305843009217038912
# Java VM: JavaHotSpot(TM) 64-Bit Server VM (1.4.2_10-b03 mixed mode)
# Problematic frame:
這種錯誤,一般是系統預設安裝的libgcj的緣故,此時輸入java–version會出現
java version "1.4.2"
gij (GNU libgcj) version4.1.2 20080704 (Red Hat 4.1.2-44)
類似的資訊。刪除即可:yumremove libgcj
或者安裝時加入本地jre庫,此時需要安裝jre設jre安裝目錄為:
/usr/local/java/jre1.6.0_17
則執行:
./runInstaller -silent–jreLoc /usr/local/java/jre1.6.0_17 -responseFile/opt/oracle/product/enterprise.rsp
切換到root,執行這二個指令碼
sh/u01/app/oracle/oraInventory/orainstRoot.sh
sh/u01/app/oracle/product/10.2.0/db_1/root.sh
至此安裝就成功了.