oracle11g+rhel5.5 前奏 (1)重要//需要配置gdmsetup (2)chkconfig sendmail off (3)光驱挂到本地目录 mkdir -p /mnt/cdrom mount /dev/cdrom /mnt/cdrom 配置本地源 vim /etc/yum.repos.d/mycdrom.repo [Server] name=rhel5server baseurl=file:///mnt/cdrom/Server enable=1 gpcheck=1 gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release (4)安装中文包 yum install -y vim* m17n-db-common-cjk* m17n-db-chinese* fonts-ISO8859-2-75dpi* vim /etc/sysconfig/i18n LANG="zh_CN.UTF-8" (5)解压缩包 unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip 可写入执行脚本,oracle配置 (1)所需安装包 expect*是运行程序的包 yum install -y expect* elfutils-libelf* gcc-* make* binutils* libaio* glibc* yum install -y libgomp* kernel-headers* compat-libstdc++* libgcc* libstdc++* sysstat* unixODBC* ksh* (2)修改ip地址 echo '#--------------------------------------------修改ip地址' cat >/etc/hosts<<EOF # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 (3)创建Oracle用户及安装目录 echo '#--------------------------------------------创建用户与组' groupadd -g 501 oinstall groupadd -g 502 dba useradd -g oinstall -G dba oracle mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1 chown -R oracle.oinstall /u01/app/oracle/ chmod -R 775 /u01/app/oracle/ echo '#------------------------------------------------修改用户密码passwd grid' echo "111111" | passwd grid --stdin > /dev/null 2>&1 (4)编译内核参数 echo '#------------------------------------ vi /etc/sysctl.conf' cat >> /etc/sysctl.conf <<EOF fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 EOF sysctl -p (5)编辑/etc/security/limits.conf文件 echo '#----------------------------------------------------------vi /etc/security/limits.conf' cat >>/etc/security/limits.conf<<EOF #ORACLE SETTING oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 EOF (6)修改/etc/pam.d/login echo '#------------------------------------vi /etc/pam.d/login' echo 'session required pam_limits.so' >>/etc/pam.d/login (7)修改profile echo '#------------------------------------------------------修改profile' 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 (8)修改 csh.login echo '#--------------------------------------------------------修改 csh.login' cat >> /etc/csh.login <<EOF if ( \$USER == "oracle" ) then limit maxproc 16384 limit descriptors 65536 endif EOF (9)修改oracle用户环境变量 echo '#-----------------------------oracle 用户配置文件ORACLE_HOSTNAME 请自行设置' # Oracle Settings oracle cat >> /home/oracle/.bash_profile<<EOF # --------------------------------------------------- # ORACLE_SID # --------------------------------------------------- ORACLE_SID=orcl; export ORACLE_SID # --------------------------------------------------- # ORACLE_UNQNAME # --------------------------------------------------- #ORACLE_UNQNAME=racdb; export ORACLE_UNQNAME # --------------------------------------------------- # JAVA_HOME # --------------------------------------------------- #JAVA_HOME=/usr/local/java; export JAVA_HOME # --------------------------------------------------- # ORACLE_BASE # --------------------------------------------------- ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE # --------------------------------------------------- # ORACLE_HOME # --------------------------------------------------- ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME # --------------------------------------------------- # ORACLE_PATH # --------------------------------------------------- ORACLE_PATH=/u01/app/common/oracle/sql; export ORACLE_PATH # SQLPATH=/u01/app/common/oracle/sql; export SQLPATH # --------------------------------------------------- # ORACLE_TERM # --------------------------------------------------- ORACLE_TERM=xterm; export ORACLE_TERM # --------------------------------------------------- # NLS_DATE_FORMAT # --------------------------------------------------- NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"; export NLS_DATE_FORMAT # --------------------------------------------------- # TNS_ADMIN # --------------------------------------------------- TNS_ADMIN=\$ORACLE_HOME/network/admin; export TNS_ADMIN # --------------------------------------------------- # ORA_NLS11 # --------------------------------------------------- ORA_NLS11=\$ORACLE_HOME/nls/data; export ORA_NLS11 # --------------------------------------------------- # PATH # --------------------------------------------------- PATH=.:\${JAVA_HOME}/bin:\${PATH}:\$HOME/bin:\$ORACLE_HOME/bin PATH=\${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin PATH=\${PATH}:/u01/app/common/oracle/bin export PATH # --------------------------------------------------- # LD_LIBRARY_PATH # --------------------------------------------------- LD_LIBRARY_PATH=\$ORACLE_HOME/lib LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\$ORACLE_HOME/oracm/lib LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib export LD_LIBRARY_PATH # --------------------------------------------------- # CLASSPATH # --------------------------------------------------- CLASSPATH=\$ORACLE_HOME/JRE CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib export CLASSPATH # --------------------------------------------------- # THREADS_FLAG # --------------------------------------------------- THREADS_FLAG=native; export THREADS_FLAG # --------------------------------------------------- # TEMP, TMP, and TMPDIR # --------------------------------------------------- export TEMP=/tmp export TMPDIR=/tmp # --------------------------------------------------- # UMASK # --------------------------------------------------- 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