参考了以下三篇文章安装成功,特记录!
http://ithero.javaeye.com/blog/315092
http://www.oracle.com/technology/global/cn/obe/11gr1_db/install/dbinst/dbinst.htm
http://linux.chinaunix.net/techdoc/database/2008/04/25/996956.shtml
建议,安装系统的时候将硬盘空间大于等于10G,可以单独弄一个大的分区来存放oracle安装后的程序,我此次实验系统共总就10G,完成的时候很险,差一点不够,安装oracle 11g 提示是需要3.4G,而我只有3.6G了。。。。
一、检查硬件需求
1、检查内存空间大小
[root@tech_002 ~]# grep MemTotal /proc/meminfo
MemTotal: 3041772 kB
MemTotal: 3041772 kB
2、查看交换分区swap
[root@tech_002 home]# grep SwapTotal
/proc/meminfo SwapTotal: 2031608 kB
/proc/meminfo SwapTotal: 2031608 kB
3、假如交换分区空间不够,可以增加
创建/home/swap这么一个分区文件。文件的大小是5120000个block,一般情况下1个block为1K,所以这里空间是5G。
dd if=/dev/zero of=/home/swap bs=1024 count=5120000
5120000+0 records in
5120000+0 records out
5242880000 bytes (5.2 GB) copied, 39.3974 seconds, 133 MB/s
5120000+0 records in
5120000+0 records out
5242880000 bytes (5.2 GB) copied, 39.3974 seconds, 133 MB/s
接着再把这个分区变成swap分区。
[root@tech_002 home]# /sbin/mkswap /home/swap
Setting up swapspace version 1, size = 5242875 kB
Setting up swapspace version 1, size = 5242875 kB
然后把它加到fstab里面
[root@tech_002 home]# echo "/home/swap swap swap defaults 0 0" >> /etc/fstab ; cat /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/home/swap swap swap defaults 0 0
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/home/swap swap swap defaults 0 0
4、oracle 11g 所必须的安装包
[root@tech_002 ~]# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc- gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
binutils-2.17.50.0.6-9.el5
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.137-3.el5
elfutils-libelf-devel-0.137-3.el5
glibc-2.5-34
glibc-common-2.5-34
glibc-devel-2.5-34
gcc-4.1.2-44.el5
gcc-c++-4.1.2-44.el5
libaio-devel-0.3.106-3.2
libaio-0.3.106-3.2
libgcc-4.1.2-44.el5
libstdc++-4.1.2-44.el5
libstdc++-devel-4.1.2-44.el5
make-3.81-3.el5
sysstat-7.0.2-3.el5
unixODBC-2.2.11-7.1
unixODBC-devel-2.2.11-7.1
binutils-2.17.50.0.6-9.el5
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.137-3.el5
elfutils-libelf-devel-0.137-3.el5
glibc-2.5-34
glibc-common-2.5-34
glibc-devel-2.5-34
gcc-4.1.2-44.el5
gcc-c++-4.1.2-44.el5
libaio-devel-0.3.106-3.2
libaio-0.3.106-3.2
libgcc-4.1.2-44.el5
libstdc++-4.1.2-44.el5
libstdc++-devel-4.1.2-44.el5
make-3.81-3.el5
sysstat-7.0.2-3.el5
unixODBC-2.2.11-7.1
unixODBC-devel-2.2.11-7.1
5、配置内核参数
cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max=4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max=4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF
然后执行
[root@tech_002 etc]# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
6、给系统添加oracle 用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
7、添加参数
cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
cat >> /etc/pam.d/login <<EOF
session required /lib/security/pam_limits.so
session required pam_limits.so
EOF
session required /lib/security/pam_limits.so
session required pam_limits.so
EOF
cat >> /etc/profile <<EOF
if [ $USER = "oracle " ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
if [ $USER = "oracle " ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
8、创建目录
mkdir -p /oracle_11/app/
chown -R oracle :oinstall /oracle_11/app/
chmod -R 755 /oracle_11/app/
sudo mkdir /oracle_11/tmp
sudo chmod a+wr /oracle_11/tmp
chown -R oracle :oinstall /oracle_11/app/
chmod -R 755 /oracle_11/app/
sudo mkdir /oracle_11/tmp
sudo chmod a+wr /oracle_11/tmp
9、修改用户的shell
more /home/oracle /.bash_profile
# .bash_profile
umask 022
TMP=/oracle_11/tmp
TMPDIR=/oracle_11/tmp
export TMP TMPDIR
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/oracle_11/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11 .1.0/db_1
export ORACLE_SID=orcl
##注意,如果是想远程无界面安装oracle,在这里请用这行:export DISPLAY=10.10.10.254:0.0,并在远程安装的主机上启用Xmanager - Passive 程序 。
export DISPLAY=:0.0
export PATH=$ORACLE_HOME/bin:$PATH
#export ORA_CRS_HOME=$ORACLE_BASE/crs
#export ORACLE_PATH=$ORACLE_BASE/common/oracle /sql:.:$ORACLE_HOME/rdbms/admin
#export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:${PATH}:$HOME/bin
#export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
#export PATH=${PATH}:$ORACLE_BASE/common/oracle /bin
#export ORACLE_TERM=xterm
#export TNS_ADMIN=$ORACLE_HOME/network/admin
#export ORA_NLS10=$ORACLE_HOME/nls/data
#export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib
#export LIBPATH=$LIBPATH:$ORA_CRS_HOME/lib:$ORACLE_HOME/lib
#export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/JRE
#export NLS_LANG=AMERICAN_AMERICA.ZHS16G
#export ORA_NLS10=$ORACLE_HOME/nls/data
# .bash_profile
umask 022
TMP=/oracle_11/tmp
TMPDIR=/oracle_11/tmp
export TMP TMPDIR
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/oracle_11/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11 .1.0/db_1
export ORACLE_SID=orcl
##注意,如果是想远程无界面安装oracle,在这里请用这行:export DISPLAY=10.10.10.254:0.0,并在远程安装的主机上启用Xmanager - Passive 程序 。
export DISPLAY=:0.0
export PATH=$ORACLE_HOME/bin:$PATH
#export ORA_CRS_HOME=$ORACLE_BASE/crs
#export ORACLE_PATH=$ORACLE_BASE/common/oracle /sql:.:$ORACLE_HOME/rdbms/admin
#export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:${PATH}:$HOME/bin
#export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
#export PATH=${PATH}:$ORACLE_BASE/common/oracle /bin
#export ORACLE_TERM=xterm
#export TNS_ADMIN=$ORACLE_HOME/network/admin
#export ORA_NLS10=$ORACLE_HOME/nls/data
#export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib
#export LIBPATH=$LIBPATH:$ORA_CRS_HOME/lib:$ORACLE_HOME/lib
#export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/JRE
#export NLS_LANG=AMERICAN_AMERICA.ZHS16G
#export ORA_NLS10=$ORACLE_HOME/nls/data
以root身份打开另一个终端窗口
--这步至关重要,不执行这步在以oracle用户运行 # ./runInstaller时会启动不了图型安装界面
#xhost +
#xhost + localhost
#su - oracle
$unzip linux_x86_11gR1_database.zip
$cd database/
$./runInstaller -ignoreSysPreReqs
--这步至关重要,不执行这步在以oracle用户运行 # ./runInstaller时会启动不了图型安装界面
#xhost +
#xhost + localhost
#su - oracle
$unzip linux_x86_11gR1_database.zip
$cd database/
$./runInstaller -ignoreSysPreReqs
如果是使用的远程无界面安装方式,需要在远程windows主机上打开Xmanager - Passive程序,当在oracle主机执行./runinstall的时候安装界面会出现在windows主机上。
然后就参照http://www.oracle.com/technology/global/cn/obe/11gr1_db/install/dbinst/dbinst.htm 官方进行安装!!
来源:https://www.cnblogs.com/codefly/archive/2011/01/18/Oracle11g.html