oracle在linux(我一直用Fedora,現在是Fedora8)下的安裝確實不容易,經過一段時間的探索終於安裝成功了!現把過程分享一下。
1.Download Software 10201_database_linux32.zip
2.解壓文件 unzip 10201_database_linux32.zip
3.Host File vi /etc/hosts 一般不用修改,也可配置真實ip,格式為
4.Set Kernel Parameters
Add the following lines to the /etc/sysctl.conf file:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
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
Run the following command to change the current kernel parameters:
/sbin/sysctl -p
Add the following lines to the /etc/security/limits.conf file:
[indent]* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536[/indent]Add the following line to the /etc/pam.d/login file, if it does not already exist:
[indent]session required /lib/security/pam_limits.so[/indent]Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:
[indent]SELINUX=disabled[/indent]5.安裝依賴包
# From Fedora 8 DVD
cd /media/cdrom/Packages
rpm -Uvh binutils-2.*
rpm -Uvh elfutils-libelf-0.*
rpm -Uvh glibc-2.*
rpm -Uvh glibc-common-2.*
rpm -Uvh libgcc-4.*
rpm -Uvh libstdc++-4.*
rpm -Uvh make-3.*
rpm -Uvh elfutils-libelf-devel-0.*
rpm -Uvh glibc-devel-2.*
rpm -Uvh gcc-4.*
rpm -Uvh gcc-c++-4.*
rpm -Uvh libstdc++-devel-4.*
rpm -Uvh unixODBC-2.*
cd /
eject
# Not available on Fedora 8 DVD, but available from standard yum repository.
yum install libaio libaio-devel
yum install unixODBC-devel
yum install sysstat
yum install compat-libstdc++
# Required to mask Java conflict (thanks to Robert W. Benton for pointing this out)
yum --enablerepo=development install libxcb.i386
6.創建用戶及組
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle
輸入你的oralce 用戶密碼。
7.創建目錄
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01
8.以root 用戶登錄執行以下命令:
xhost +
如我的是在本機安裝的 xhost +localhost
9. 修改/etc/redhat-release文件
內容為:
redhat-4
10.
Login as the oracle user and add the following lines at the end of the .bash_profile file:
以oracle 用戶登錄:編輯.bash_profile 文件。
內容為:
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
11.正式安裝。
將系統註銷,以orace 用戶登錄,第1步解壓的文件database 剪切到 oracle 用戶的home下。
執行下列命令:
DISPLAY=:0.0; export DISPLAY
我的是:
DISPLAY=localhost:0.0; export DISPLAY
進入 database 目錄
執行
./runInstaller
具體安裝步驟如下:
- Select Installation Method
- Specify Inventory Directory and Credentials
- Select Installation Type
- Specify Home Details
- Product-Specific Prerequisite Checks
- Select Configuration Option
- Select Database Configuration
- Specify Database Configuration Options
- Select Database Management Option
- Specify Database Storage Option
- Specify Backup and Recovery Options
- Specify Database Schema Passwords
- Summary
- Install
- Configuration Assistants
- Database Configuration Assistant
- Database Configuration Assistant Password Management
- Execute Configuration Scripts
- End Of Installation
最後:編輯/ect/oratab 文件使
TSH1:/u01/app/oracle/product/10.2.0/db_1:Y至此oracle 安裝完畢,理論上oracle 應該能工作了,
#su oracle
#dbstart
執行dbstart 應該能啟動資料庫,便提示找不到,查看是環境變數的問題,於是我在/ect/profile.d/下建立了文件oracle.sh
內容如下:
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
保存 執行
#sh /etc/profile.d/oracle.sh
#dbstart
成功
#sqlplus /nolog
SQL>connect /as sysdba
成功!
注:後來發現只有oracle用戶能登錄,?決方法,將你的用戶加入oinstall 組
#usermod -G oinstall username(你的用戶名)。