database's docs

1.0 silent模式安装oracle 11G R2 之 环境准备


0. 环境介绍

  • oracle version: oracle 11g R2
  • os version: centos 6.8 x64

参考文档:


1. 系统配置及准备

1) 切换到root用户

su - root

2) 增加用户组

# --groups for database management
# --groups id are the same as for 12C installations
# --some groups are not required here but can be used
# --later for grid binaries installation
groupadd --gid 54321 oinstall
groupadd --gid 54322 dba
groupadd --gid 54323 asmdba
groupadd --gid 54324 asmoper
groupadd --gid 54325 asmadmin
groupadd --gid 54326 oper

3) 增加用户

useradd -u 54321 -g oinstall -G dba,oper,asmadmin oracle
passwd oracle

4) 内核参数修改

# add kernel parameters to /etc/sysctl.conf
vim /etc/sysctl.conf
*****************************
# 虚拟内存设定
vm.swappiness = 0
vm.dirty_background_ratio = 3
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100

# 共享内存
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmmni = 4096

# 信号量设定
kernel.sem = 250 32000 100 128

# 临时端口范围
net.ipv4.ip_local_port_range = 9000 65500

# 增加同步I / O请求数
fs.aio-max-nr = 1048576

# 增加文件句柄
fs.file-max = 6815744

# 优化网络设定
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
*****************************
sysctl -p

# change limits.conf
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    32768
oracle   soft   core     unlimited
oracle   hard   core     unlimited
oracle   soft   memlock  50000000
oracle   hard   memlock  50000000
*****************************

5) 修改hosts文件及hostname

# edit /etc/hosts
vi /etc/hosts
*****************************
127.0.0.1   oel6 oel6.dbaora.com localhost localhost.localdomain localhost4 localhost4.localdomain4
*****************************

# edit hostname
vi /etc/sysconfig/network
*****************************
HOSTNAME=oel6.dbaora.com
*****************************
hostname oel6.dbaora.com

6) 修改oracle用户的环境变量

## EDIT .bash_profile FOR USER oracle
vi /home/oracle/.bash_profile
*****************************
# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=oel6.dbaora.com
export ORACLE_UNQNAME=ORA11G
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ORA11G


PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022
*****************************
## 如果是要图形化,增加以下内容
# export DISPLAY=oel6.dbaora.com:0.0

7) 创建oracle相关目录和检查并安装环境包

## 创建 ORACLE_HOME 和 ORACLE_BASE
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
chown -R oracle.oinstall /u01


## 检查环境包
# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
## 安装检查结果是未安装的环境包
# yum install compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ ksh libaio-devel libstdc++-devel unixODBC unixODBC-devel

yum install -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
yum install -y cloog-ppl libXxf86misc compat-libcap1 libXxf86vm cpp libdmx libstdc++-devel mpfr glibc-headers ppl kernel-headers xorg-x11-utils libXmu xorg-x11-xauth libXt libXv libXxf86dga

8) oracle程序及oracle环境变量准备

# 切换到oracle用户
su - oracle
# 解压oracle程序
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

vim database/stage/cvu/cv/admin/cvu_config
*************************
CV_ASSUME_DISTID=OEL6
*************************

# 安装cvuqdisk
su -
yum install -y smartmontools
rpm -ivh database/rpm/cvuqdisk-1.0.9-1.rpm
su - oracle

# 检查 envo 变量
envo
ORACLE_UNQNAME=ORA11G
ORACLE_SID=ORA11G
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=oel6.dbaora.com
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
# 检查 alias cdob 和 cdoh
cdob
pwd
/u01/app/oracle

cdoh
pwd
/u01/app/oracle/product/11.2.0/dbhome_1