1.校验系统内存和交换分区
内存至少900+MB , 交换分区至少1G; 使用如下命令校验:
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo
2.校验必要软件包
内核版本: uname -r #2.4.9-e.25(或更高版本)
其他所需程序包的版本(或更高版本):
gcc-2.96-124
make-3.79
binutils-2.11
openmotif-2.1.30-11
glibc-2.2.4-31
使用命令校验:rpm -q gcc make binutils openmotif glibc
如果缺少某个包,可以在安装盘中找到相应的rpm包,用命令rpm -Uvh <NAME>安装
3. 用户准备
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
passwd oracle
4. 准备文件目录
mkdir -p /u01/app/oracle
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01/app/oracle /u02/oradata
chmod -R 775 /u01/app/oracle /u02/oradata
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 = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF
/sbin/sysctl -p
6.设置shell权限
cat >> /etc/security/limits.conf <<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
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
umask 022
fi
EOF
cat >> /etc/csh.login <<EOF
if ( /$USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
EOF
7. 设置oracle环境变量
包括:
ORACLE_BASE
ORACLE_HOME
ORACLE_SID
PATH
执行以下命令:
su - oracle
cat >> .bash_profile <<EOF
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
EOF