CentOS静默安装Oracle数据库
1、安装RPM包
# yum install binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
expat \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
pdksh \
sysstat \
unixODBC \
unixODBC-devel
备注:部分机器 估计 libaio的32和64包都需要,没有还不行。
2、固定IP地址,hostname,hosts记录
[root@localhost ~]
# vim /etc/sysconfig/network
hostname=oracle11g.example.com
[root@oracle11g ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:1E:68:68
ONBOOT=yes
IPADDR=192.168.1.16
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
[root@oracle11g ~]
# ifconfig eth0 | head -n 2
eth0 Link encap:Ethernet HWaddr 00:0C:29:9F:DF:4A
inet addr:192.168.1.16 Bcast:192.168.1.255 Mask:255.255.255.0
[root@oracle11g ~]
# grep -v '^#' /etc/hosts
127.0.0.1localhost.localdomain localhost
192.168.1.16 oracle11g.example.com
3、设置系统的操作资源
[root@oracle11g ~]
#vim /etc/sysctl.conf 添加到文件底端
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 = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[root@oracle11g ~]
#sysctl -p
shell限制
[root@oracle11g ~]
# grep -v '^#' /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@oracle11g ~]
# grep 'limit' /etc/pam.d/system-auth
session required pam_limits.so
4、设置oracle用户
建议指定GID和UID方式(尤其集群环境)
[root@oracle11g ~]
# groupadd -g 1000 oinstall
[root@oracle11g ~]
# groupadd -g 1001 dba
[root@oracle11g ~]
# useradd -u 1000 -g oinstall -G dba oracle
[root@oracle11g ~]
# passwd oracle
建立oracle软件安装文件目录
[root@oracle11g ~]
# mkdir -p /u01/oracle
[root@oracle11g ~]
# chown -R oracle:oinstall /u01/
设置oracle环境变量
[root@oracle11g ~]
vi ~oracle/.bash_profile
umask 022
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_SID=oracle11g
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
加载配置
oracle用户注销重新登录 或 #
#su - oracle
#source .bash_profile
5、解压安装文件
#unzip linux.x64_11gR2_database_1of2.zip -d /mnt
#unzip linux.x64_11gR2_database_2of2.zip -d /mnt
6、修改配置文件
[root@oracle11g ~]# grep -v '^#' /mnt/database/response/db_install.rsp (参考 静默安装----配置文件 说明)
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle11g.example.com
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/oracle
SELECTED_LANGUAGES=en,zh_CN,zh_TW (选择要支持的语言)
ORACLE_HOME=/u01/oracle/product/11.2.0
ORACLE_BASE=/u01/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.config.starterdb.characterSet=AL32UTF8 (根据生产环境中的需要,进行修改字符集)
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.automatedBackup.enable=false
DECLINE_SECURITY_UPDATES=true (要家上,要不然会报错 【server】
email address 错误
)
7、静默安装数据库
[root@oracle11g ~]#cd /mnt/database/response
[root@oracle11g response]$ chown -R oracle:oinstall /mnt/database/response/db_install.rsp
[root@oracle11g response]$chmod 700 db_install.rsp
#su - oracle
#cd /mnt/database/
$ ./runInstaller -silent -force -responseFile /mnt/database/response/db_install.rsp (注意要写绝对路径)
如报 ins-13014 错误 不需要理会 报 ins-07001 配置文件中的有些文件找不到,对安装没有
多大影响
(日志文件 看安装进度 )
#tail -100f /u01/oracle/logs/installActions2013-06-10_04-01-32PM.log
带出现以下内容,说明安装成功
#!/bin/sh
#Root scripts to run
/u01/oracle/orainstRoot.sh
/u01/oracle/product/11.2.0/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.
注意:必须用root用户跑一下脚本
#/u01/oracle/orainstRoot.sh
#/u01/oracle/product/11.2.0/root.sh
[root@oracle11g 11.2.0]# su - oracle
[oracle@oracle11g ~]$ ps aux |grep ora_
oracle 18649 0.0 0.0 61188 744 pts/2 S+ 16:31 0:00 grep ora_ (说明没有数据库) 只安装了实例
[oracle@oracle11g ~]$ sql
sqlite3 sqlldr sqlldrO sqlplus
[oracle@oracle11g ~]$ sqlplus / as sysdba (出现错误,但实例已安装完成)
sqlplus: error while loading shared libraries: /u01/oracle/product/11.2.0/lib/libclntsh.so.11.1: cannot restore segment prot after reloc: Permission denied
(关闭防火墙与sensetforce )
[root@oracle11g ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@oracle11g ~]# getenforce
Enforcing
[root@oracle11g ~]# setenforce 0
[root@oracle11g ~]# getenforce
Permissive
[oracle@oracle11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 10 16:40:29 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL>