Linux平台安装Oracle11gR2数据库

时间:2022-08-02 15:07:36

 

1. 数据库安装先决条件

1.1 认证的操作系统检查确认

o RHEL4,OEL4 - update 7 or greater 

o RHEL5,OEL5 - 5.2 or greater 

o RHEL6,OEL6 - 6.0 or greater 

o SLES10 - Kernel 2.6.16.21-0.8 or greater 

o SLES11 - Kernel 2.6.27.19-5 or greater 

o Asianux Server 3 SP2 

NOTE: On RHEL6/OEL6, 11.2.0.3 or later is certified (not 11.2.0.1 or 11.2.0.2) 

详情请参考文档:Certification Information for Oracle Database on Linux x86-64 (Doc ID 1304727.2)

 

1.2 系统硬件和软件环境检查

1) 物理内存至少4G

# grep MemTotal /proc/meminfo

2)swap一般需要和物理内存相当,大于32G则设置32G,不满足需要扩容

# free -g

If RAM between 2 GB and 8 GB then 2 times the size fo RAM.

If RAM between 8 GB to 32 GB then 1.5 times the size of RAM.

If RAM greater than 32 GB then 32 GB

3) Tmp至少1G,不满足需扩容

# df -h

4)建议Oracle软件所需空间至少80G。

lvcreate -L 80G -n lvoraapp rootvg

mkfs.ext4 /dev/mapper/rootvg-lvoraapp

mkdir /oracle

cp /etc/fstab{,_$(date +%Y%m%d)}

echo "/dev/mapper/rootvg-lvoraapp /oracle ext4 defaults 1 2" >> /etc/fstab

mount -a

5) IP 需求

每个节点一个public IP,一个virtual IP,一个private IP;

整个集群需要至少一个SCAN IP;

6)检查数据库版本以及内核,注意RHEL6/OEL6操作系统内核支持11.2.0.3或更高的ORACLE数据库版本,但是不支持11.2.0.1 或者 11.2.0.2(参考文档ID169706.1)

# uname –a

# lsb_release -a

# cat /etc/redhat-release

7) 检查防火墙和selinux是否关闭

# 检查防火墙是否关闭

service iptables status

# 关闭防火墙

chkconfig iptables off

service iptables stop

# 确认防火墙已关闭

service iptables status

chkconfig --list iptables

# 检查selinux是否禁用

# 禁用selinux,配置/etc/sysconfig/selinux,修改SELINUX项为disabled

SELINUX=disabled

# 检查确认,需要重启操作系统生效

grep 'SELINUX=' /etc/sysconfig/selinux

8)检查依赖的系统软件包

<1> Installed the following packages for Oracle Linux5, RHEL5

binutils-2.17.50.0.6-6.el5 (x86_64)

compat-libstdc++-33-3.2.3-61 (x86_64)

compat-libstdc++-33-3.2.3-61 (i386)

elfutils-libelf-0.125-3.el5 (x86_64)

elfutils-libelf-devel-0.125-3 (x86_64)

elfutils-libelf-devel-static-0.125-3 (x86_64)

gcc-4.1.2-42.el5 (x86_64)

gcc-c++-4.1.2-42.el5 (x86_64)

glibc-2.5-24 (x86_64)

glibc-2.5-24 (i686)

glibc-common-2.5-24 (x86_64)

glibc-devel-2.5-24 (x86_64)

glibc-devel-2.5-24 (i386)

glibc-headers-2.5-24 (x86_64)

ksh-20060214-1.7 (x86_64)

libaio-0.3.106-3.2 (x86_64)

libaio-0.3.106-3.2 (i386)

libaio-devel-0.3.106-3.2 (x86_64)

libaio-devel-0.3.106-3.2 (i386)

libgcc-4.1.2-42.el5 (i386)

libgcc-4.1.2-42.el5 (x86_64)

libstdc++-4.1.2-42.el5 (x86_64)

libstdc++-4.1.2-42.el5 (i386)

libstdc++-devel-4.1.2-42 (x86_64)

make-3.81-3.el5 (x86_64)

kernel-headers-2.6.18-92 (x86_64)

libgomp-4.1.2-42 (x86_64)

sysstat-7.0.2-1 (x86_64)

unixODBC-2.2.14 (x86_64)

unixODBC-2.2.14 (i386)

unixODBC-devel-2.2.14 (x86_64)

unixODBC-devel-2.2.14 (i386)

<2> Installed the following packages for Oracle Linux6, RHEL6

binutils-2.20.51.0.2-5.11.el6 (x86_64)

compat-libcap1-1.10-1 (x86_64)

compat-libstdc++-33-3.2.3-69.el6 (x86_64)

compat-libstdc++-33-3.2.3-69.el6.i686

gcc-4.4.4-13.el6 (x86_64)

gcc-c++-4.4.4-13.el6 (x86_64)

glibc-2.12-1.7.el6 (i686)

glibc-2.12-1.7.el6 (x86_64)

glibc-devel-2.12-1.7.el6 (x86_64)

glibc-devel-2.12-1.7.el6.i686

ksh

libgcc-4.4.4-13.el6 (i686)

libgcc-4.4.4-13.el6 (x86_64)

libstdc++-4.4.4-13.el6 (x86_64)

libstdc++-4.4.4-13.el6.i686

libstdc++-devel-4.4.4-13.el6 (x86_64)

libstdc++-devel-4.4.4-13.el6.i686

libaio-0.3.107-10.el6 (x86_64)

libaio-0.3.107-10.el6.i686

libaio-devel-0.3.107-10.el6 (x86_64)

libaio-devel-0.3.107-10.el6.i686

make-3.81-19.el6

sysstat-9.0.4-11.el6 (x86_64)

unixODBC-2.2.14-11.el6 (x86_64) or later

unixODBC-2.2.14-11.el6.i686 or later

unixODBC-devel-2.2.14-11.el6 (x86_64) or later

unixODBC-devel-2.2.14-11.el6.i686 or later

cpp-4.4.4-13.el6(x86_64)

glibc-headers-2.12-1.7.el6(x86_64)

mpfr.x86_64 0:2.4.1-6.el6(x86_64)

<3> Installed the following packages for Oracle Linux7, RHEL7

binutils-2.23.52.0.1-12.el7.x86_64

compat-libcap1-1.10-3.el7.x86_64

compat-libstdc++-33-3.2.3-71.el7.i686

compat-libstdc++-33-3.2.3-71.el7.x86_64

gcc-4.8.2-3.el7.x86_64

gcc-c++-4.8.2-3.el7.x86_64

glibc-2.17-36.el7.i686

glibc-2.17-36.el7.x86_64

glibc-devel-2.17-36.el7.i686

glibc-devel-2.17-36.el7.x86_64

ksh

libaio-0.3.109-9.el7.i686

libaio-0.3.109-9.el7.x86_64

libaio-devel-0.3.109-9.el7.i686

libaio-devel-0.3.109-9.el7.x86_64

libgcc-4.8.2-3.el7.i686

libgcc-4.8.2-3.el7.x86_64

libstdc++-4.8.2-3.el7.i686

libstdc++-4.8.2-3.el7.x86_64

libstdc++-devel-4.8.2-3.el7.i686

libstdc++-devel-4.8.2-3.el7.x86_64

libXi-1.7.2-1.el7.i686

libXi-1.7.2-1.el7.x86_64

libXtst-1.2.2-1.el7.i686

libXtst-1.2.2-1.el7.x86_64

make-3.82-19.el7.x86_64

sysstat-10.1.5-1.el7.x86_64

unixODBC-2.3.1-6.el7.x86_64 or later

unixODBC-2.3.1-6.el7.i686 or later

unixODBC-devel-2.3.1-6.el7.x86_64 or later

unixODBC-devel-2.3.1-6.el7.i686 or later

cpp-4.8.2-16.el7.x86_64

glibc-headers-2.17-55.el7.x86_64

mpfr-3.1.1-4.el7.x86_64

-- 将上面软件包写入到/tmp/pkg.info文件

OLDIFS=${IFS}

IFS=$'\n'

for i in $(cat /tmp/pkg.info); do

if [[ "$(uname -r)" =~ "2.6.18" ]]; then

a=${i%-*};

[[ "${i}" =~ "(32" ]] && a=$a.i686

else

a=${i%-*};

a=${a%-*};

[[ "${i}" =~ "i686" ]] && a=$a.i686

fi

rpm -q $a

[[ "$?" = "0" ]] || yum -y install $a

done

IFS=${OLDIFS}

 

# 检查软件包

-- linux5

rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc-2.5 glibc-2.5.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat unixODBC.i686 unixODBC-devel unixODBC

-- linux6

rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat elfutils-libelf-devel elfutils-libelf unixODBC unixODBC-devel smartmontools pdksh compat-libstdc++-33.i686 glibc.i686 glibc-devel.i686  libgcc.i686 libstdc++.i686 libstdc++-devel.i686 libaio.i686 libaio-devel.i686 unixODBC.i686 unixODBC-devel.i686

-- linux7

rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" binutils compat-libcap1 compat-libstdc++-33.i686 compat-libstdc++-33 gcc gcc-c++ glibc.i686 glibc glibc-devel.i686 glibc-devel ksh libaio.i686 libaio libaio-devel.i686 libaio-devel libgcc.i686 libgcc libstdc++.i686 libstdc++ libstdc++-devel.i686 libstdc++-devel libXi.i686 libXi libXtst.i686 libXtst make sysstat unixODBC unixODBC.i686 unixODBC-devel unixODBC-devel.i686

# 安装软件包

-- linux5

yum install -y binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc-2.5 glibc-2.5.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat unixODBC.i686 unixODBC-devel unixODBC

-- linux6

yum install -y binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat elfutils-libelf-devel elfutils-libelf unixODBC unixODBC-devel smartmontools pdksh compat-libstdc++-33.i686 glibc.i686 glibc-devel.i686  libgcc.i686 libstdc++.i686 libstdc++-devel.i686 libaio.i686 libaio-devel.i686 unixODBC.i686 unixODBC-devel.i686

-- linux7

yum install -y binutils compat-libcap1 compat-libstdc++-33.i686 compat-libstdc++-33 gcc gcc-c++ glibc.i686 glibc glibc-devel.i686 glibc-devel ksh libaio.i686 libaio libaio-devel.i686 libaio-devel libgcc.i686 libgcc libstdc++.i686 libstdc++ libstdc++-devel.i686 libstdc++-devel libXi.i686 libXi libXtst.i686 libXtst make sysstat unixODBC unixODBC.i686 unixODBC-devel unixODBC-devel.i686

1.3 修改/etc/hosts文件

注1:hostname不允许使用下划线_,建议统一使用小写字母和数字组合,否则安装过程可能会报错。

cp /etc/hosts{,_$(date +%Y%m%d)}

cat >> /etc/hosts <EOF

127.0.0.1 loopback localhost

::1 loopback localhost

# Public Network - (bond0)

192.168.8.145 orcl1

192.168.8.146 orcl2

# Private Interconnect - (bond1)

192.168.168.145 orcl1-priv

192.168.168.146 orcl2-priv

# Public Virtual IP (VIP) addresses - (bond0:X)

192.168.8.147 orcl1-vip

192.168.8.148 orcl2-vip

# SCAN IP - (bond0:X)

192.168.8.149 orcl-scan

EOF

1.4 创建用户和组并赋予权限

# 创建用户组:

/usr/sbin/groupadd -g 1000 oinstall

/usr/sbin/groupadd -g 1031 dba

/usr/sbin/groupadd -g 1032 oper

/usr/sbin/groupadd -g 1020 asmadmin

/usr/sbin/groupadd -g 1021 asmdba

/usr/sbin/groupadd -g 1022 asmoper

# 创建用户:

useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -m -d /home/grid -c "Grid Infrastructure Owner" grid

useradd -u 1101 -g oinstall -G dba,asmdba,oper -m -d /home/oracle -c "Oracle Software Owner" oracle

# 修改用户密码

echo "p#ssw0rd"|passwd --stdin oracle

echo "p#ssw0rd"|passwd --stdin grid

# su测试一下密码是否修改成功

# 检查确认

id oracle

id grid

1.5 配置/etc/pam.d/login

# 添加如下配置,使得/etc/pam.d/login中的限制资源参数生效

session required pam_limits.so

cp -p /etc/pam.d/login{,_$(date +%Y%m%d)}

cat >> /etc/pam.d/login << EOF

session required pam_limits.so

EOF

1.6 配置/etc/security/limits.conf

cp -p /etc/security/limits.conf{,_$(date +%Y%m%d)}

cat >> /etc/security/limits.conf << EOF

# modify for oracle

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 4096

oracle hard nofile 65536

oracle soft stack 10240

oracle hard stack 32768

# modify for grid

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 4096

grid hard nofile 65536

grid soft stack 10240

grid hard stack 32768

oracle soft memlock 1000000

oracle hard memlock 1000000

grid soft memlock 1000000

grid hard memlock 1000000

EOF

# 说明

soft nofile: 可打开的文件描述符的最大数(软限制)

hard nofile:可打开的文件描述符的最大数(硬限制)

soft nproc:单个用户可用的最大进程数量(软限制)

hard nproc:单个用户可用的最大进程数量(硬限制)

# 检查确认oracle用户的配置是否生效

su – oracle

$ ulimit –a

 

1.7 配置/etc/profile

cp -p /etc/profile{,$(date +%Y%m%d)}

cat >> /etc/profile <<EOF

if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then

if [ \$SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

umask 022

fi

EOF

1.8 配置grid、oracle用户环境变量

su - grid

cat << EOF >> ${HOME}/.bash_profile

# GI user environments

export ORACLE_SID=+ASM1

export ORACLE_BASE=/apps/oracle/grid

export ORACLE_HOME=/apps/oracle/11.2.0/grid

export PATH=\${PATH}:\${ORACLE_HOME}/bin:\${ORACLE_HOME}/OPatch

umask 022

EOF

exit

su - oracle

cat << EOF >> ${HOME}/.bash_profile

# DB user environments

export ORACLE_SID=orcl1

export ORACLE_BASE=/apps/oracle/database

export ORACLE_HOME=\${ORACLE_BASE}/11.2/db_1

export GI_HOME=/apps/oracle/11.2.0/grid

export LD_LIBRARY_PATH=\${ORACLE_HOME}/lib

export PATH=\${ORACLE_HOME}/bin:\${ORACLE_HOME}/OPatch:\${GI_HOME}/bin:\${HOME}/dba:\$PATH

export TNS_ADMIN=\${GI_HOME}/network/admin

umask 022

EOF

1.9 创建软件安装目录

#创建目录

mkdir -p /apps/oracle/grid

mkdir -p /apps/oracle/11.2.0/grid

mkdir -p /apps/oracle/oraInventory

chown -R grid:oinstall /apps/oracle

mkdir -p /apps/oracle/database

mkdir -p /apps/oracle/database/11.2/db_1

chown oracle:oinstall /apps/oracle/database

chmod -R 775 /apps/oracle

#检查目录属性,确认修改是否正确

ls -ltrd /apps/oracle/grid /apps/oracle/11.2.0/grid /apps/oracle/database

1.10 配置/etc/sysctl.conf

cp -p /etc/sysctl.conf{,_$(date +%Y%m%d)}

MEMTOTAL=$(free -b | sed -n '2p' | awk '{print $2}')

SHMMAX=$(expr $MEMTOTAL / 2)

SHMMNI=4096

PAGESIZE=$(getconf PAGE_SIZE)

cat >> /etc/sysctl.conf << EOF

# -- The number of asynchronous IO requests at the same time(as per Note 579108.1),for example 1048576 = 1024 * 1024

fs.aio-max-nr = 3145728

# -- 512 * processes (for example 6815744 for 13312 processes)

fs.file-max = 6815744

kernel.shmmax = $SHMMAX

kernel.shmall = $(expr \( $SHMMAX / $PAGESIZE \) \* \( $SHMMNI / 16 \))

kernel.shmmni = $SHMMNI

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

vm.min_free_kbytes=51200

EOF

1.11 配置ntp服务

# 查看当前时区

cat /etc/sysconfig/clock

# 添加ntp服务器,根据实际环境修改服务地址

vi /etc/ntp.conf

server 127.127.0.1

# 配置ntpd的参数,我们主要强调的是要配置成"微调的模式" 也就是在options中要加入-x的选项

vi /etc/sysconfig/ntpd

OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"

# 开机启动NTPD服务

chkconfig ntpd on

# 重启服务,使最新配置生效

service ntpd restart

# 检查是否生效

ntpq -p

ps -ef |grep ntp|grep -v grep

# 安装完成后需要使用如下命令确认

$ crsctl check ctss

1.12 配置SSH互信

-- 1)人为配置互相

-- grid用户, 分别生成密钥

#su - grid

grid@rac1:~$ mkdir ~/.ssh

grid@rac1:~$ chmod 700 ~/.ssh

grid@rac1:~$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

grid@rac1:~$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa

#su - grid

grid@rac2:~$ mkdir ~/.ssh

grid@rac2:~$ chmod 700 ~/.ssh

grid@rac2:~$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

grid@rac2:~$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa

节点一:

-- 将生成的rsa和dsa密钥复制到authorized_keys

$ cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys

-- 将节点2的生成的密钥追加到节点1的authorized_keys中,若有多个节点,依次执行

$ ssh node2 "cat ~/.ssh/*.pub" >> ~/.ssh/authorized_keys

-- 将最终的authorized_keys文件传输到其它所有节点

$ scp ~/.ssh/authorized_keys node2:~/.ssh/authorized_keys

-- 修改文件权限

grid@rac1:~/.ssh$ chmod 600 ~/.ssh/authorized_keys

-- oracle用户参照上面步骤配置

-- 互信验证(oracle,grid)所有节点操作

su - grid

export SSH='ssh -o ConnectTimeout=3 -o ConnectionAttempts=5 -o PasswordAuthentication=no -o StrictHostKeyChecking=no'

$ ${SSH} rac1 date

$ ${SSH} rac1-priv date

$ ${SSH} rac2 date

$ ${SSH} rac2-priv date

2)oralce11g可以在安装时进行自动配置ssh,第一次设置,点击“Setup”,设置成功后点击“Test”,成功后需两边节点测试验证互信。

1.13 配置HOTPLUG(Network interface going down when dynamically adding disks to storage using udev in RHEL 6 (Doc ID 1569028.1))

添加HOTPLUG="no"配置到/etc/sysconfig/network-scripts目录下的ifcfg-ethX文件,防止start_udev命令关闭网卡导致VIP漂移或连接异常。

注意确认配置是否生效,可在安装完数据库之后执行start_udev命令确认。

 

1.14 共享存储配置(RAC环境需要)

--存储规划建议

Ø ocr voting:3个2G的lun,ASM对应划分1个normal的dg

Ø 控制文件:3个2G的lun,ASM对应划分3个dg

Ø redo:2个64G的lun(建议raid 1+0,尽量不用raid5),ASM对应划分2个dg

Ø 数据文件:最多500G 1个lun,ASM对应划分1个dg,注意单个dg不超过10T

-- multipath

chkconfig multipathd on

service multipathd restart

#设置磁盘属性:

#配置/etc/udev/rules.d/12-dm-permissions.rules参数文件

ENV{DM_NAME}=="ocr1", OWNER:="grid", GROUP:="asmadmin", MODE:="640", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="ocr2", OWNER:="grid", GROUP:="asmadmin", MODE:="640", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="ocr3", OWNER:="grid", GROUP:="asmadmin", MODE:="640", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="ctl1", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="ctl2", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="ctl3", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="redo1", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="redo2", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="data1", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"

ENV{DM_NAME}=="data2", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="mapper/$env{DM_NAME}"

# 重启udev服务并检查磁盘权限属性

start_udev

ll /dev/mapper/

ll /dev/dm*

--共享存储使用RAW方式

vi /etc/udev/rules.d/60-raw.rules

ACTION=="add", KERNEL=="emcpowerg", RUN+="/bin/raw /dev/raw/raw1 %N"

ACTION=="add", KERNEL=="emcpowerh", RUN+="/bin/raw /dev/raw/raw2 %N"

ACTION=="add", KERNEL=="emcpoweri", RUN+="/bin/raw /dev/raw/raw3 %N"

ACTION=="add", KERNEL=="emcpowere", RUN+="/bin/raw /dev/raw/raw4 %N"

ACTION=="add", KERNEL=="emcpowerf", RUN+="/bin/raw /dev/raw/raw5 %N"

RUN+="/bin/sleep 1"

KERNEL=="raw[1-3]*", OWNER="grid", GROUP="asmadmin", MODE="660"

KERNEL=="raw[4-5]*", OWNER="oracle", GROUP="oinstall", MODE="660" 

2. 安装Oracle数据库

2.1 预检查

su - grid

unzip -qo p13390677_112040_Linux-x86-64_3of7.zip

./runcluvfy.sh stage -pre crsinst -n node1,node2 -fixup -verbose

2.2 图形界面安装GI软件

以grid用户登录,进入到安装文件解压目录

./runInstaller

…….

-- 用root用户,分别在两个节点执行以下脚本

/oracle/app/oraInventory/orainstRoot.sh

/oracle/app/11.2.0/grid/root.sh

 

2.3 检查集群状态

gsd为OFFLINE状态正常,配置ntp服务则ora.ctssd为OBSERVER的状态

# su - grid

$ crsctl status res -t -init

$ crsctl status res -t

2.4 创建ASM磁盘组

su – grid

$ asmca

 

2.5 图形界面安装RDBMS 软件

注意事项:两个DB的安装包需解压在同个目录下。

unzip -qo p13390677_112040_Linux-x86-64_1of7.zip

unzip -qo p13390677_112040_Linux-x86-64_2of7.zip

cd database

./runInstaller

……

--双节点root用户运行脚本

/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

 

2.6 dbca建库

cd ${ORACLE_HOME}/bin

./dbca

 

完成建库后,检查数据库所有资源状态:

su - grid

crsctl status res –t

 

3. 静默安装

3.1 预检查

su - grid

cd grid

./runcluvfy.sh stage -pre crsinst -n node1,node2 -fixup -verbose

3.2 静默安装GI软件

注意:粗体部分根据实际环境进行相应的修改

su - grid

#配置响应文件/home/grid/grid.rsp

cat > ${HOME}/grid_install.rsp << EOF

oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v11_2_0

SELECTED_LANGUAGES=en,zh_CN

oracle.install.option=CRS_CONFIG

oracle.install.asm.OSDBA=asmdba

oracle.install.asm.OSOPER=asmoper

oracle.install.asm.OSASM=asmadmin

oracle.install.crs.config.gpnp.configureGNS=false

oracle.install.crs.config.gpnp.gnsSubDomain=

oracle.install.crs.config.gpnp.gnsVIPAddress=

oracle.install.crs.config.autoConfigureClusterNodeVIP=

oracle.install.crs.config.storageOption=ASM_STORAGE

oracle.install.crs.config.sharedFileSystemStorage.diskDriveMapping=

oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations=

oracle.install.crs.config.sharedFileSystemStorage.votingDiskRedundancy=NORMAL

oracle.install.crs.config.sharedFileSystemStorage.ocrLocations=

oracle.install.crs.config.sharedFileSystemStorage.ocrRedundancy=NORMAL

oracle.install.crs.config.useIPMI=false

oracle.install.crs.config.ipmi.bmcUsername=

oracle.install.crs.config.ipmi.bmcPassword=

oracle.install.asm.diskGroup.name=CRSDG

oracle.install.asm.diskGroup.redundancy=NORMAL

oracle.install.asm.diskGroup.AUSize=1

oracle.install.crs.upgrade.clusterNodes=

oracle.install.asm.upgradeASM=false

oracle.installer.autoupdates.option=SKIP_UPDATES

oracle.installer.autoupdates.downloadUpdatesLoc=

AUTOUPDATES_MYORACLESUPPORT_USERNAME=

AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=

PROXY_REALM=

INVENTORY_LOCATION=/apps/oracle/oraInventory

ORACLE_HOME=/apps/oracle/11.2.0/grid

ORACLE_BASE=/apps/oracle/grid

ORACLE_HOSTNAME=node1

oracle.install.crs.config.gpnp.scanName=ora11g-scan

oracle.install.crs.config.gpnp.scanPort=1522

oracle.install.crs.config.clusterName=ora11g-cluster

oracle.install.crs.config.clusterNodes=node1:node1-vip,node2:node2-vip

oracle.install.crs.config.networkInterfaceList=eth0:192.168.10.0:1,eth1:172.168.0.0:2

oracle.install.asm.SYSASMPassword=oracle

oracle.install.asm.diskGroup.disks=/dev/mapper/asm_crs1,/dev/mapper/asm_crs2,/dev/mapper/asm_crs3

oracle.install.asm.monitorPassword=oracle

oracle.install.asm.diskGroup.diskDiscoveryString=/dev/mapper/asm*

EOF

cd /apps/soft/grid

./runInstaller -ignorePrereq -silent -responseFile ${HOME}/grid_install.rsp

#执行正常类似输出如下

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB. Actual 1632 MB Passed

Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-06-20_08-47-01AM. Please wait ...[grid@node1 grid]$

You can find the log of this install session at:

/apps/oracle/oraInventory/logs/installActions2017-06-20_08-47-01AM.log

The installation of Oracle Grid Infrastructure 11g was successful.

Please check '/apps/oracle/oraInventory/logs/silentInstall2017-06-20_08-47-01AM.log' for more details.

As a root user, execute the following script(s):

1. /apps/oracle/oraInventory/orainstRoot.sh

2. /apps/oracle/11.2.0/grid/root.sh

Execute /apps/oracle/oraInventory/orainstRoot.sh on the following nodes:

[node1, node2]

Execute /apps/oracle/11.2.0/grid/root.sh on the following nodes:

[node1, node2]

As install user, execute the following script to complete the configuration.

1. /apps/oracle/11.2.0/grid/cfgtoollogs/configToolAllCommands RESPONSE_FILE=<response_file>

Note:

1. This script must be run on the same host from where installer was run.

2. This script needs a small password properties file for configuration assistants that require passwords (refer to install guide documentation).

Successfully Setup Software.

--创建相应文件

cat > ${HOME}/pwdrsp.properties << EOF

oracle.assistants.asm|S_ASMPASSWORD=oracle

oracle.assistants.asm|S_ASMMONITORPASSWORD=oracle

EOF

-- # on the install node host

su - grid

cd /apps/oracle/11.2.0/grid/cfgtoollogs

./configToolAllCommands RESPONSE_FILE=${HOME}/pwdrsp.properties

-- 正常输出如下

Setting the invPtrLoc to /apps/oracle/11.2.0/grid/oraInst.loc

perform - mode is starting for action: configure

Jun 20, 2017 9:33:41 AM oracle.install.driver.oui.config.GenericInternalPlugIn invoke

INFO: Executing ASMCA

Jun 20, 2017 9:33:41 AM oracle.install.driver.oui.config.GenericInternalPlugIn invoke

INFO: Command /apps/oracle/11.2.0/grid/bin/asmca -silent -postConfigureASM -oui_internal

Jun 20, 2017 9:33:41 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: ... GenericInternalPlugIn.handleProcess() entered.

Jun 20, 2017 9:33:41 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: ... GenericInternalPlugIn: getting configAssistantParmas.

Jun 20, 2017 9:33:41 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: ... GenericInternalPlugIn: checking secretArguments.

Jun 20, 2017 9:33:41 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: ... GenericInternalPlugIn: starting read loop.

Jun 20, 2017 9:33:45 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: Read: SYS_PASSWORD_PROMPT

Jun 20, 2017 9:33:45 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: Processing: SYS_PASSWORD_PROMPT for argument tag -sysAsmPassword

Jun 20, 2017 9:33:45 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: Read: ASMSNMP_PASSWORD_PROMPT

Jun 20, 2017 9:33:45 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: Processing: ASMSNMP_PASSWORD_PROMPT for argument tag -asmMonitorPassword

Jun 20, 2017 9:33:45 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: End of argument passing to stdin

Jun 20, 2017 9:33:46 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: Read:

Jun 20, 2017 9:33:46 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: Read: PostConfiguration completed successfully

Jun 20, 2017 9:33:46 AM oracle.install.driver.oui.config.GenericInternalPlugIn handleProcess

INFO: Read:

perform - mode finished for action: configure

You can see the log file: /apps/oracle/11.2.0/grid/cfgtoollogs/oui/configActions2017-06-20_09-32-40-AM.log

[grid@node1 cfgtoollogs]$

3.3 检查集群状态

# su  - grid

$ crsctl stat res -t -init

3.4 静默安装RDBMS 软件

注意一下,我们在图形方式安装的时候只要创建ORACLE_BASE目录即可,家目录会自动创建,但静默方式不可以

su - oracle

#编辑配置响应文件db.rsp

su - oracle

cat > ${HOME}/db_install.rsp << EOF

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

oracle.install.option=INSTALL_DB_SWONLY

UNIX_GROUP_NAME=oinstall

SELECTED_LANGUAGES=en,zh_CN

oracle.install.db.InstallEdition=EE

oracle.install.db.EEOptionsSelection=false

oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0

oracle.install.db.DBA_GROUP=dba

oracle.install.db.OPER_GROUP=oper

oracle.install.db.isRACOneInstall=

oracle.install.db.racOneServiceName=

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.password.SYS=

oracle.install.db.config.starterdb.password.SYSTEM=

oracle.install.db.config.starterdb.password.SYSMAN=

oracle.install.db.config.starterdb.password.DBSNMP=

oracle.install.db.config.starterdb.control=DB_CONTROL

oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

oracle.install.db.config.starterdb.automatedBackup.enable=false

oracle.install.db.config.starterdb.automatedBackup.osuid=

oracle.install.db.config.starterdb.automatedBackup.ospwd=

oracle.install.db.config.starterdb.storageType=ASM_STORAGE

oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

MYORACLESUPPORT_USERNAME=

MYORACLESUPPORT_PASSWORD=

SECURITY_UPDATES_VIA_MYORACLESUPPORT=

DECLINE_SECURITY_UPDATES=true

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=

PROXY_REALM=

COLLECTOR_SUPPORTHUB_URL=

oracle.installer.autoupdates.option=SKIP_UPDATES

oracle.installer.autoupdates.downloadUpdatesLoc=

AUTOUPDATES_MYORACLESUPPORT_USERNAME=

AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

INVENTORY_LOCATION=/apps/oracle/oraInventory

ORACLE_HOME=/apps/oracle/database/11.2/db_1

ORACLE_BASE=/apps/oracle/database

ORACLE_HOSTNAME=node1

oracle.install.db.CLUSTER_NODES=node1,node2

oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

oracle.install.db.config.starterdb.globalDBName=orcl

oracle.install.db.config.starterdb.SID=orcl

oracle.install.db.config.starterdb.characterSet=ZHS16GBK

oracle.install.db.config.starterdb.memoryLimit=800

oracle.install.db.config.starterdb.password.ALL=oracle

oracle.install.db.config.asm.diskGroup=DATADG

oracle.install.db.config.asm.ASMSNMPPassword=oracle

EOF

#执行静默安装

su - oracle

cd /apps/soft/database/

./runInstaller -ignorePrereq -silent -responseFile ${HOME}/db_install.rsp

-- 正常输出如下

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB. Actual 22404 MB Passed

Checking swap space: must be greater than 150 MB. Actual 2970 MB Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-04-23_02-36-18PM. Please wait ...[oracle@dciscdb1 ~]$ You can find the log of this install session at:

/oracle/app/oraInventory/logs/installActions2016-04-23_02-36-18PM.log

--安装过程10-30分钟

As a root user, execute the following script(s):

1. /oracle/app/oracle/product/11.2.0/db_1/root.sh

-- 分别在所有节点上执行root.sh脚本

# /oracle/app/oracle/product/11.2.0/db_1/root.sh

3.5 静默DBCA建库

先使用asmca创建ASM卷组,再使用dbca创建数据库

#创建DATA卷

su - grid

$ asmca -silent -createDiskGroup -diskString '/dev/raw/*' -diskGroupName DATA -disk '/dev/raw/raw2' -redundancy EXTERNAL

Disk Group DATA created successfully.

su – oracle

[oracle@node1 ~]$ cat ~/dbca.rsp

[GENERAL]

RESPONSEFILE_VERSION = "11.2.0"

OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]

GDBNAME = "orcl"

SID = "orcl"

TEMPLATENAME = "General_Purpose.dbc"

STORAGETYPE=ASM

DISKGROUPNAME=DATADG

NODELIST=node1,node2

CHARACTERSET = "ZHS16GBK"

NATIONALCHARACTERSET = "AL16UTF16"

DATABASETYPE = "OLTP"

SYSPASSWORD = "oracle"

SYSTEMPASSWORD = "oracle"

ASMSNMP_PASSWORD = "oracle"

[oracle@node1 ~]$

dbca -silent -responseFile ${HOME}/dbca.rsp

 

-- 检查数据库状态

su – grid

crsctl status res –t –init

crsctl status res -t