RedHat6.6安装Oracle11gR2
一、Centos6.6的安装配置
1- 选择安装模式
2- 选择“skip”,跳过检查。
3- 选择“下一步”
4- 选择“中文简体”,继续“下一步”。
5- 选择“美国英语式”键盘,继续“下一步”。
6- 保持默认,继续“下一步”
7- 选择“是,忽略所有数据”,继续“下一步”。
8- 配置主机名,继续“下一步”。
9- 取消“系统时钟使用UTC时间(S)”,选择时区为“亚洲/上海”,继续“下一步”。
10- 设置root密码,继续“下一步”。
11- 选择“使用所有空间”,继续“下一步”。
12- 选择“基本服务器”软件组,“现在自定义”安装,继续“下一步”。
“基本系统”中去掉Java、perl。
“应用程序”中选上Emacs和互联网浏览器。
“桌面”中选上除了“KDE桌面外”的所有组件。
13- 系统自动安装,大约5、6分钟安装完毕。
二、安装之前的一些配置问题
1- 关闭防火墙、selinux
Service iptables stop ###关闭防火墙
Service ip6tables stop
Chkconfig iptables off ###禁止iptables开机自启动
Chkconfig ip6tables off ###禁止ip6tables开机自启动
Sed –I ‘s/=enforing/=disabled/g’ /etc/sysconfig/selinux ###关闭selinix
Setenforce 0 ###临时关闭selinux
2- 配置网络
vi /etc/sysconfig/network-scripts/ifcfg-eth0
sed –i ‘s/=no/=yes/g’ /etc/sysconfig/network-scripts/ifcfg-eth0 ###设置网卡随主板启动而启动。
sed –i ‘s/dhcp/static/g’ /etc/sysconfig/network-scripts/ifcfg-eth0 ###设置静态ip
echo –e “IPADDR=172.16.1.214\nNETMASK=255.255.255.0\nGATEWAY=172.16.1.254\nDNS1=202.106.196.115\nDNS2=202.106.0.20” >> /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart ###重启网卡
3- 执行脚本查看服务器缺什么包
#!/bin/bash
rpm -qa|grep binutils
if [ $? != 0 ]; then
echo "缺少binutils-2.20.51.0.2-5.11.el6 (x86_64)包" >> log.txt
fi
rpm -qa|grep compat-libcap
if [ $? != 0 ]; then
echo "缺少compat-libcap1-1.10-1 (x86_64)" >>log.txt
fi
rpm -qa|grep compat-libstdc.*x86_64
if [ $? != 0 ]; then
echo "缺少compat-libstdc++-33-3.2.3-69.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep compat-libstdc.*i686
if [ $? != 0 ]; then
echo "缺少compat-libstdc++-33-3.2.3-69.el6.i686" >>log.txt
fi
rpm -qa|grep gcc-4
if [ $? != 0 ]; then
echo "缺少gcc-4.4.4-13.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep gcc-c++-4
if [ $? != 0 ]; then
echo "缺少gcc-c++-4.4.4-13.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep glibc-2.12.*i686
if [ $? != 0 ]; then
echo "缺少glibc-2.12-1.7.el6 (i686)" >>log.txt
fi
rpm -qa|grep glibc-2.12.*x86_64
if [ $? != 0 ]; then
echo "缺少glibc-2.12-1.7.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep glibc-devel-2.12.*x86_64
if [ $? != 0 ]; then
echo "缺少glibc-devel-2.12-1.7.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep glibc-devel-2.12.*i686
if [ $? != 0 ]; then
echo "缺少glibc-devel-2.12-1.7.el6.i686" >>log.txt
fi
rpm -qa|grep ksh
if [ $? != 0 ]; then
echo "缺少ksh" >>log.txt
fi
rpm -qa|grep libgcc-4.4.4-13.*i686
if [ $? != 0 ]; then
echo "缺少libgcc-4.4.4-13.el6 (i686)" >>log.txt
fi
rpm -qa|grep libgcc-4.4.4-13.*x86_64
if [ $? != 0 ]; then
echo "缺少libgcc-4.4.4-13.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep libstdc++-4.4.4-13.*x86_64
if [ $? != 0 ]; then
echo "缺少libstdc++-4.4.4-13.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep libstdc++-4.4.4-13.*i686
if [ $? != 0 ]; then
echo "缺少libstdc++-4.4.4-13.el6.i686" >>log.txt
fi
rpm -qa|grep libstdc++-devel-4.4.4-13.*x86_64
if [ $? != 0 ]; then
echo "缺少libstdc++-devel-4.4.4-13.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep libstdc++-devel-4.4.4-13.*i686
if [ $? != 0 ]; then
echo "缺少libstdc++-devel-4.4.4-13.el6.i686" >>log.txt
fi
rpm -qa|grep libaio-0.3.107-10.*x86_64
if [ $? != 0 ]; then
echo "缺少libaio-0.3.107-10.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep libaio-0.3.107-10.i686
if [ $? != 0 ]; then
echo "缺少libaio-0.3.107-10.el6.i686" >>log.txt
fi
rpm -qa|grep libaio-devel-0.3.107.*x86_64
if [ $? != 0 ]; then
echo "缺少libaio-devel-0.3.107-10.el6 (x86_64)" >>log.txt
fi
rpm -qa|grep libaio-devel-0.3.107.*i686
if [ $? != 0 ]; then
echo "缺少libaio-devel-0.3.107-10.el6.i686" >>log.txt
fi
rpm -qa|grep make-3.81-19.el6
if [ $? != 0 ]; then
echo "缺少make-3.81-19.el6" >>log.txt
fi
rpm -qa|grep sysstat
if [ $? != 0 ]; then
echo "缺少sysstat-9.0.4-11.el6 (x86_64)" >>log.txt
fi
执行结果:如下
缺少compat-libcap1-1.10-1 (x86_64)
缺少compat-libstdc++-33-3.2.3-69.el6 (x86_64)
缺少compat-libstdc++-33-3.2.3-69.el6.i686
缺少gcc-c++-4.4.4-13.el6 (x86_64)
缺少glibc-2.12-1.7.el6 (i686)
缺少glibc-devel-2.12-1.7.el6.i686
缺少ksh
缺少libgcc-4.4.4-13.el6 (i686)
缺少libgcc-4.4.4-13.el6 (x86_64)
缺少libstdc++-4.4.4-13.el6 (x86_64)
缺少libstdc++-4.4.4-13.el6.i686
缺少libstdc++-devel-4.4.4-13.el6 (x86_64)
缺少libstdc++-devel-4.4.4-13.el6.i686
缺少libaio-0.3.107-10.el6.i686
缺少libaio-devel-0.3.107-10.el6 (x86_64)
缺少libaio-devel-0.3.107-10.el6.i686
缺少make-3.81-19.el6
总体确定缺以下几个包:
cloog-ppl-0.15.7-1.2.el6.i686.rpm gmp-4.3.1-7.el6_2.2.i686.rpm libstdc++-devel-4.4.7-11.el6.i686.rpm
cloog-ppl-0.15.7-1.2.el6.x86_64.rpm gmp-4.3.1-7.el6_2.2.x86_64.rpm libstdc++-devel-4.4.7-11.el6.x86_64.rpm
compat-libcap1-1.10-1.x86_64.rpm ksh-20120801-21.el6.x86_64.rpm make-3.81-20.el6.x86_64.rpm
compat-libstdc++-33-3.2.3-69.el6.i686.rpm libaio-0.3.107-10.el6.i686.rpm mpfr-2.4.1-6.el6.i686.rpm
compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm libaio-devel-0.3.107-10.el6.i686.rpm mpfr-2.4.1-6.el6.x86_64.rpm
cpp-4.4.7-11.el6.x86_64.rpm libaio-devel-0.3.107-10.el6.x86_64.rpm nss-softokn-freebl-3.14.3-17.el6.i686.rpm
gcc-4.4.7-11.el6.x86_64.rpm libgcc-4.4.7-11.el6.i686.rpm nss-softokn-freebl-3.14.3-17.el6.x86_64.rpm
gcc-c++-4.4.7-11.el6.x86_64.rpm libgcc-4.4.7-11.el6.x86_64.rpm ppl-0.10.2-11.el6.i686.rpm
glibc-2.12-1.149.el6.i686.rpm libstdc++-4.4.7-11.el6.i686.rpm ppl-0.10.2-11.el6.x86_64.rpm
glibc-devel-2.12-1.149.el6.i686.rpm libstdc++-4.4.7-11.el6.x86_64.rpm
unix2dos-2.2-35.el6.x86_64.rpm unixODBC-2.2.14-14.el6.i686.rpm
unixODBC-2.2.14-14.el6.x86_64.rpm unixODBC-devel-2.2.14-14.el6.i686.rpm
unixODBC-devel-2.2.14-14.el6.x86_64.rpm libtool-ltdl-2.2.6-15.5.el6.i686.rpm
libtool-ltdl-2.2.6-15.5.el6.x86_64.rpm ncurses-libs-5.7-3.20090208.el6.i686.rpm
ncurses-libs-5.7-3.20090208.el6.x86_64.rpm readline-6.0-4.el6.i686.rpm
readline-6.0-4.el6.x86_64.rpm
4- 配置机器名
确保 /etc/sysconfig/network中hostname要与 /etc/hosts中的一致
5- 建立用户,组,安装目录。
① - 建立用户,组
groupadd oinstall
groupadd dba
groupadd oper
useradd –g oinstall –G dba,oper oracle
echo “oracle” | passwd –stdin oracle
如果oracle用户存在,第四个命令可以变成
usermod –g oinstall –g dba,oper,oracle
② -建立安装目录
mkdir –p /u01/app/oracle/product/11.2.0/db_1
chown –R oracle:oinstall /u01/app
chmod –R 755 /u01/app
③ -配置环境变量
sed –i ‘s/^PATH/#PATH/g’ ~/.bash_profile
sed –i ‘s/^ export/#export/g’ ~/.bash_profile
echo -e “TMP=/tmp; export TMP\t
TMPDIR=$TMP; export TMPDIR\t
ORACLE_HOSTNAME=dbserver; export ORACLE_HOSTNAME\t
ORACLE_UNQNAME=ORADB; export ORACLE_UNQNAME\t
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE\t
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME\t
ORACLE_SID=ORADB; export ORACLE_SID\t
PATH=/usr/sbin:$PATH; export PATH\t
PATH=$ORACLE_HOME/bin:$PATH; export PATH\t
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH\t
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH” >> ~/.bash_profile
source ~/.bah_profile
6- 修改参数
① -修改内核参数
注意: 最需要注意的是shmmax 这个参数,最小500M,最大比内存少一个字节就可以了,推荐比内存的一半大一点点
sed -i ‘s/^ kernel.shmall/#/g’/etc/sysctl.conf
sed -i ‘s/^ kernel.shmmax /#/g’ /etc/sysctl.conf
echo -e “
fs.aio-max-nr = 1048576\t
fs.file-max = 6815744\t
kernel.shmall = 2097152\t
kernel.shmmax = 2200000000\t
kernel.shmmni = 4096\t
kernel.sem = 250 32000 100 128\t
net.ipv4.ip_local_port_range = 9000 65500\t
net.core.rmem_default = 262144\t
net.core.rmem_max = 4194304\t
net.core.wmem_default = 262144\t
net.core.wmem_max = 1048576\t” >> /etc/sysct.conf
sysctl -p
报错处理
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
解决办法:
modprobe bridge
lsmod |grep bridge
② -改文件限制
echo -e "
oracle soft nproc 2047\t
oracle hard nproc 16384\t
oracle soft nofile 1024\t
oracle hard nofile 65536\t
oracle soft stack 10240\t" >> /etc/security/limits.conf
#注意:修改此文件是即时生效的,但可能要重登录后再看
ulimit -Sn
ulimit -Hn
ulimit -Sn
ulimit -Sn
ulimit –Sn
vi /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
source /etc/profile
③ -pam.d文件修改
vi /etc/pam.d/login
#session required /lib/security/pam_limits.so
session required pam_limits.so
三、安装
1- 上传oracle11gR2文件到/u01/app/oracle
xhost +#一定要运行一下
su – oracle
cd /u01/app/oracle
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
unset LANG en_US#解决中文乱码,可不做。
cd /u01/app/oracle/databse
./runInstaller
报下面错误
解决办法:
切换到root用户,执行
xhost +
然后切换到oracle用户
执行./runInstaller
最后切
最后切换到root用户,执行两个脚本
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
四、启动
1- 启动报错。
解决办法:
cp /u01/app/oracle/admin/orcl/pfile/init.ora.618201614350 /u01/app/oracle/product/11.2.0/db_1/dbs/initORCL.ora