1.关闭selinux
vim /etc/selinux/conf
SELINUX= disabled
2.安装软件包
官方参考:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCCADGD
用yum进行安装
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
3.创建oinstall和dba组和oracle用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
验证创建是否正确
[root@oracledb ~]# id oracle
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)
4.配置参数
vim /etc/sysctl.conf
在下面添加
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 = 1048576
sysctl -p 使之生效
vim /etc/security/limits.conf
在尾部添加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
vim /etc/pam.d/login
增加或修改以下内容
session required /lib64/security/pam_limits.so
session required pam_limits.so
vim /etc/profile
增加或修改以下内容
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
source /etc/profile
使之生效
5.创建安装路径,开始静默安装
创建安装目录
mkdir -p /u01/app/
chown -R oralce:oinstall
chmod -R 775 /u01/app/
配置环境变量
su oracle
cd ~
vim .bash_profile
底部添加
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=dbsrv2
使之生效
source .bash_profile
解压oracle软件
su root
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_1of2.zip
复制响应文件模板
su oracle
mkdir etc
cp /usr/local/src/database/response/* /home/oracle/etc/
设置响应文件权限
su root
chmod 700 /home/oracle/etc/*.rsp
准备静默安装 ,修改安装Oracle软件的响应文件/home/oracle/etc/db_install.rsp
su oracle
cd ~
vim etc/db_install.rsp
对着下图相应设置
开始静默安装
cd /usr/local/src/database
./runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp
出现类似如下提示表示安装完成:
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
6.配置监听 建库
su oracle
cd ~
vim .bash_profile
增加以下内容
export ROACLE_PID=ora11g
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LANG="zh_CN.UTF-8"
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
配置监听
netca /silent /responsefile /home/oracle/etc/netca.rsp
启动监听
lsnrctl start
编辑dbca建库!!!
建库 (会清屏,连续输入2次密码即可)
dbca -silent -responseFile etc/dbca.rsp
删除实例:(dbca删除实例用法,一般建库成功就算完毕了)
dbca -silent -deleteDatabase -sourcedb dbsrv2
至此。。安装建库一套操作完成