系统:CentOS64 + oracle11G x86_64
1、关闭防火墙,
# vi /etc/selinux/config
修改SELINUX=disabled,然后重启。
如果不想重启系统,使用命令setenforce 0
2、建立脚本build.sh,
# vim build.sh #注意以root登陆执行
将下列代码粘贴进去:
#!/bin/bash #安装依赖库文件 yum -y install binutils compat-libcap1 \ yum -y install compat-libstdc++-33 yum -y install compat-libstdc++-33*.i686 yum -y install elfutils-libelf-devel yum -y install gcc yum -y install gcc-c++ yum -y install glibc*.i686 yum -y install glibc yum -y install glibc-devel yum -y install glibc-devel*.i686 yum -y install ksh yum -y install libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 yum -y install libaio libaio*.i686 libaio-devel libaio-devel*.i686 yum -y install make yum -y install sysstat yum -y install unixODBC yum -y install unixODBC*.i686 yum -y install unixODBC-devel yum -y install unixODBC-devel*.i686 yum -y install java yum -y install libXp #注意需要安装libXp这个Library,这个一定要安装,否则安装Oracle时会出现java Exception #以root用户登录 /usr/sbin/groupadd dba /usr/sbin/groupadd oper /usr/sbin/groupadd oinstall #添加oracle用户 useradd oracle /usr/sbin/usermod -g oinstall -G dba oracle #为oracle用户添加密码passwd echo passwd|passwd --stdin oracle #预先创建安装目录 mkdir -p /opt/oracle/product mkdir -p /opt/oracle/product/OraHome mkdir -p /opt/oraInventory mkdir -p /opt/oracle/oradata mkdir -p /var/opt/oracle #设置目录的所有者所属组和权限 chown -R oracle.oinstall /opt/oracle chown -R oracle.oinstall /opt/oracle/oradata chown -R oracle.oinstall /opt/oracle/product/OraHome chown -R oracle.dba /opt/oraInventory chown oracle.dba /var/opt/oracle chmod -R 775 /opt/oracle chmod -R 755 /var/opt/oracle
执行脚本
# sh build.sh
3、编辑/etc/security/limits.conf
# vi /etc/security/limits.conf
在文件末尾添加下面几行:
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536
4、 设置用户oracle的环境变量
#su - oracle $ vi /home/oracle/.bash_profile
在文件底部添加
export ORACLE_BASE=/opt/oracle export ORACLE_HOME=$ORACLE_BASE/product/OraHome export ORACLE_SID=orcl export ORACLE_OWNER=oracle export ORACLE_TERM=vt100 export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib export CLASSPATH PATH=$PATH:/usr/sbin; export PATH PATH=$PATH:/usr/bin; export PATH
--执行以下命令让配置马上生效或以oracle用户登录使设置生效
[[email protected] ~]$ source $HOME/.bash_profile
5、上传oracle11G安装包,并解压,注意:要保证上传的目录oracle用户有足够的权限,假如上传到/opt/soft目录
要切换回root用户进行解压: [[email protected] oracle]$ su - [[email protected] ~]# cd /opt/soft/ 解压压缩包: [[email protected] soft]# unzip linux_11gR2_database_1of2.zip [[email protected] soft]# unzip linux_11gR2_database_2of2.zip 给解压后的目录赋权限给oracle用户 #chown -R oracle database #chgrp -R oinstall database
6、开始安装(中间过程中遇到的问题及解决方法,见下一篇:http://i.cnblogs.com/?postid=4471758&update=1)
6-1、重启系统,使设置生效,然后以oracle用户登录,执行命令
[[email protected] ~]#cd /home/oracle/database [[email protected] ~]#./runInstaller
6-2、过程截图:
6-2.1、执行命令
6-2.2、无邮件不更新,去掉复选框,
6-2.3、
6-2.4、
6-2.5、密码:大小写、数字、8位
6-2.7、
6-2.8、
6-2.9、忽略全部
6-2.10、保存响应文件
6-2.11、开始安装产品
6-2.12、
6-2.13、管理密码,将Scott用户解锁
6-2.14、NEXT,
6-2.15、提示以root用户执行脚本
6.2.16、完成安装,点close
7、 切换到root用户执行脚本/opt/oraInventory/orainstRoot.sh 和/opt/oracle/product/OraHome/root.sh
[[email protected] desktop]# su - [[email protected] ~]# /opt/oraInventory/orainstRoot.sh Changing permissions of /opt/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /opt/oraInventory to oinstall. The execution of the script is complete. [[email protected] /]# /opt/oracle/product/OraHome/root.sh Running Oracle 11g root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /opt/oracle/product/OraHome Enter the full pathname of the local bin directory: [/usr/local/bin]: 此处回车 Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script. Now product-specific root actions will be performed. Finished product-specific root actions.
参考网址:
http://blog.163.com/xiangfei209%40126/blog/static/98695674201381910470981/
http://www.linuxidc.com/Linux/2013-06/85357.htm
http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCGJCEA