#01 RPM
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})/N' binutils compat-db compat-libstdc++ gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel make setarch glibc-devel libaio libaio-devel openmotif compat-gcc libXp
#以上包有些不是必需的,建议有就打上。
#02
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.240.0
IPADDR=192.168.0.XXX
GATEWAY=192.168.0.254
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
EOF
echo "127.0.0.1 localhost" >> /etc/hosts
echo "192.168.0.XXX XXXX" >> /etc/hosts
#检查完所需包、网络配置,以下即可直接运行安装。
# O3
echo "fs.file-max = 65536" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.shmmax = 536870912" >> /etc/sysctl.conf
echo "net.core.rmem_default=262144" >> /etc/sysctl.conf
echo "net.core.rmem_max=262144" >> /etc/sysctl.conf
echo "net.core.wmem_default=262144" >> /etc/sysctl.conf
echo "net.core.wmem_max=262144" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf
sysctl -p
#kernel.shmmax如是小内存则与内存一样大,大内存就设置成比数据库SGA大一点即可。
# O4
echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
# O5 配置环境资源限制,前两行用于HugePage内存技术。后面分别为文件句柄、进程句柄数量
echo "oracle soft memlock 5242880" >>/etc/security/limits.conf
echo "oracle hard memlock 5242880" >>/etc/security/limits.conf
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 65536" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
# O6
echo 'if [ $USER = "oracle" ]; then' >> /etc/profile
echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo 'ulimit -p 16384' >> /etc/profile
echo 'ulimit -n 65536' >> /etc/profile
echo 'else' >> /etc/profile
echo 'ulimit -u 16384 -n 65536' >> /etc/profile
echo 'fi' >> /etc/profile
echo 'fi' >> /etc/profile
# 07 修改系统版本,但安装完后需改回原来版本
echo "Red Hat Enterprise Linux Server release 4 (Tikanga)" > /etc/redhat-release
# O8 创建用户、配置环境变量
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -d /home/oracle oracle
echo "oracle" | passwd --stdin oracle
echo "export ORACLE_BASE=/u01/app/oracle" >> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1' >> /home/oracle/.bash_profile
echo "export ORACLE_SID=orcl" >> /home/oracle/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/oracle/.bash_profile
echo "export NLS_LANG=american_america.ZHS16GBK" >> /home/oracle/.bash_profile
echo "export ORACLE_TERM=xterm" >> /home/oracle/.bash_profile
echo "export EDITOR=vi" >> /home/oracle/.bash_profile
echo "export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib:" >> /home/oracle/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile
# O8
mkdir -p /u01/app/oracle
mkdir -p /stage
mkdir -p /home/oracle
chown oracle:oinstall /u01/app/oracle
chown oracle:oinstall /stage
chown oracle:oinstall /home/oracle
# 09
gunzip 10201_database_linux_x86_64.cpio.gz
cpio -idmv < 10201_database_linux_x86_64.cpio
unzip p6810189_10204_Linux-x86-64.zip
#执行xhost +,进入oracle用户,再执行./runInstaller即可进入安装
# 10
#如果使用中文的环境建库,最后时候企业管理器有可能会有个错误提示,重新配置企业管理器.
#emca -config dbcontrol db -repos |recreate
#另附官方安装文档:http://www.oracle.com/technology/global/cn/pub/articles/smiley_10gdb_install.html