首先有两个脚本作为oracle的基础环境配置:
(1)[root@localhost opt]# cat rpm.txt
binutils
compat-libcap1
compat-libstdc++*
compat-libstdc++*
gcc
gcc-c++
glibc
glibc-devel
ksh
libgcc
libstdc++
libstdc++-devel
libaio
libaio-devel
make
sysstat
unixODBC*
这些主要是oracle的依赖包,并且都存在于yum源中,可采用如下命令进行安装:
#yum -y install $(cat rpm.txt)
(2)基础环境配置的脚本:
[root@localhost opt]# cat test.sh
ORACLE_SID=zydb
ORACLE_BASE=/db/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
groupadd oinstall
groupadd dba
groupadd oper
##user
useradd -g oinstall -G dba,oper oracle
passwd oracle
passwd --stdin oracle <<EOF
oracle
oracle
EOF
id nobody
SYSCTL_CONF_FILE="/etc/sysctl.conf";
echo "####begin####" >> $SYSCTL_CONF_FILE
echo "kernel.shmall = 2097152" >> $SYSCTL_CONF_FILE
echo "kernel.shmmax = 2147483648" >> $SYSCTL_CONF_FILE
echo "kernel.shmmni = 4096" >> $SYSCTL_CONF_FILE
echo "kernel.sem = 250 32000 100 128" >> $SYSCTL_CONF_FILE
echo "fs.file-max = 65536" >> $SYSCTL_CONF_FILE
echo "net.ipv4.ip_local_port_range = 1024 65000" >> $SYSCTL_CONF_FILE
echo "net.core.rmem_default = 1048576" >> $SYSCTL_CONF_FILE
echo "net.core.rmem_max = 1048576" >> $SYSCTL_CONF_FILE
echo "net.core.wmem_default = 262144" >> $SYSCTL_CONF_FILE
echo "net.core.wmem_max = 262144" >> $SYSCTL_CONF_FILE
echo "####end####" >> $SYSCTL_CONF_FILE
sysctl -p
LIMIT_CONF_FILE="/etc/security/limits.conf"
echo "#####begin#####" >> $LIMIT_CONF_FILE
echo "oracle soft nproc 2047" >> $LIMIT_CONF_FILE
echo "oracle hard nproc 16384" >> $LIMIT_CONF_FILE
echo "oracle soft nofile 1024" >> $LIMIT_CONF_FILE
echo "oracle hard nofile 65536" >> $LIMIT_CONF_FILE
echo "#####end#####" >> $LIMIT_CONF_FILE
PAM_LOGIN_FILE="/etc/pam.d/login"
echo "####begin###" >> $PAM_LOGIN_FILE
echo "session required /lib/security/pam_limits.so" >> $PAM_LOGIN_FILE
echo "session required pam_limits.so" >> $PAM_LOGIN_FILE
echo "####end###" >> $PAM_LOGIN_FILE
PROFILE_FILE="/etc/profile"
echo "####begin###" >> $PROFILE_FILE
echo "if [ $USER = 'oracle' ]; then" >> $PROFILE_FILE
echo " if [ $SHELL = '/bin/ksh' ]; then" >> $PROFILE_FILE
echo " ulimit -p 16384" >> $PROFILE_FILE
echo " ulimit -n 65536" >> $PROFILE_FILE
echo " else" >> $PROFILE_FILE
echo " ulimit -u 16384 -n 65536" >> $PROFILE_FILE
echo " fi" >> $PROFILE_FILE
echo "fi" >> $PROFILE_FILE
echo "####end###" >> $PROFILE_FILE
CSH_LOGIN_FILE="/etc/csh.login"
echo "####begin###" >> $CSH_LOGIN_FILE
echo "if ( $USER == 'oracle' ) then" >> $CSH_LOGIN_FILE
echo " limit maxproc 16384" >> $CSH_LOGIN_FILE
echo " limit descriptors 65536" >> $CSH_LOGIN_FILE
echo "endif" >> $CSH_LOGIN_FILE
echo "####end###" >> $CSH_LOGIN_FILE
mkdir -p $ORACLE_BASE
chown -R oracle:oinstall $ORACLE_BASE
chmod -R 775 $ORACLE_BASE
BASH_PROFILE_FILE="/home/oracle/.bash_profile"
echo "####begin####" >> $BASH_PROFILE_FILE
echo "umask 022" >> $BASH_PROFILE_FILE
echo "ORACLE_BASE=$ORACLE_BASE" >> $BASH_PROFILE_FILE
echo "ORACLE_HOME=$ORACLE_HOME" >> $BASH_PROFILE_FILE
echo "ORACLE_SID=$ORACLE_SID" >> $BASH_PROFILE_FILE
echo "PATH=$ORACLE_HOME/bin:$PATH:." >> $BASH_PROFILE_FILE
echo "export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH" >> $BASH_PROFILE_FILE
echo "####end####" >> $BASH_PROFILE_FILE
需要执行下这个脚本sh test.sh
这俩个在附件中采用oracle.zip存储,https://files.cnblogs.com/baoyiluo/oracle.zip
然后就是实际安装oracle数据库了。
1解压俩个相关的oracle包,这个比较大2G。
链接如下:
http://60.5.255.227/hot.cdn.baidupcs.com/file/b86b3f97a55745302036ff2c8bb4df9d?fid=2132836718-250528-905942008&time=1369042985&rt=pr&sign=FDTAR-DCb740ccc5511e5e8fedcff06b081203-gfBLxjxHaf8H77%2Bx8Z03yLHbsRc%3D&expires=8h&r=897330518&xcode=d482726de3adb748f6f70fcaa1f42d7c&redirect=1&wsiphost=ipdbm
---------------------
http://qd.cache.baidupcs.com/file/f070b470de2dbdf44d4e7f28a2d67e93?fid=2132836718-250528-4259107601&time=1369042985&rt=pr&sign=FDTAR-DCb740ccc5511e5e8fedcff06b081203-KayWRd8EJ6V4w0URtvW1h9T1bz4%3D&expires=8h&r=124833311&xcode=85a2a1c8bb9c2891f6f70fcaa1f42d7c&redirect=1
2.cd database;
3../runInstaller
如果遇到目录不正确的错误,在对应目录中间添加oracle。
有一步需要对一些信息进行忽略,勾选图形框的右上角ignore all,才能进行下一步安装。