Linux教程

ORACLE LINUX 7.7 安装ORACLE 11.2.0.4.0 RAC

本文主要是介绍ORACLE LINUX 7.7 安装ORACLE 11.2.0.4.0 RAC,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

环境:oracle linux7.7,安装系统时需双网卡,接心跳线。

 节点一(rac1):
  网卡一:10.244.186.189
  网卡二:192.168.1.101
 节点二(rac2):
  网卡一:10.244.186.220
  网卡二:192.168.1.103

关闭防火墙

  systemctl stop firewalld

  systemctl disable firewalld

  • 1.挂载镜像,配置本地yum(两个节点都要操作):

 

mkdir /mnt/cdrom
mount /dev/sr0 /mnt/cdrom/
mv /etc/yum.repos.d /etc/yum.repos.d.bak
mkdir /etc/yum.repos.d
vi /etc/yum.repos.d/public-yum-ol7.repo

[CDROM]
name=isofile
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///mnt/RPM-GPG-KEY-oracle


yum clean all
yum makecache

2.修改主机名:(11.2.0.4要求主机名小写)

vim /etc/hostname
rac1

3.修改hosts文件

vim /etc/hosts

127.0.0.1   localhostlocalhost.localdomain localhost4 localhost4.localdomain4
::1localhostlocalhost.localdomain localhost6 localhost6.localdomain6

#rac1
10.244.186.189    rac1
10.244.186.196    rac1-vip
192.168.1.101     rac1-priv 
#rac2
10.244.186.220    rac2
10.244.186.197    rac2-vip
192.168.1.103     rac2-priv 
#scan-cluster
10.244.186.199    scan-cluster

4.配置内核参数

vim /etc/sysctl.conf

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 16777216
kernel.shmmax = 68719476735
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 = 1048586

sysctl -p

5.修改limits

grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

6.修改/etc/pam.d/login文件

vim /etc/pam.d/login
    加入如下内容:
session required pam_limits.so

7.修改/etc/profile

vim /etc/profile

加入如下内容:
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

8.禁用selinux

vim /etc/selinux/config
    把SELINUX=enforcing改为SELINUX=disabled

9.添加组和用户

groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 asmoper
groupadd -g 506 asmdba
useradd -g oinstall -G dba,asmdba,oper oracle
useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid

passwd oracle
passwd grid

10.创建目录

mkdir -p /u01/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory

11.配置 grid 和 oracle 用户的环境变量

vim /home/oracle/.bash_profile

export ORACLE_SID=rac1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TMP=/tmp
export TMPDIR=$TMP
export PATH=$PATH:$ORACLE_HOME/bin

source /home/oracle/.bash_profile
vim /home/grid/.bash_profile

export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:$PATH

source /home/grid/.bash_profile

rac2上重复此操作。注意:另外一台数据库实例名须做相应修改:(rac2/+ASM2)

12.安装依赖:

yum install gcc gcc-c++ glibc* glibc-devel* libgcc* libstdc++* libstdc++-devel* make sysstat -y
yum install -y compat-libstdc*
yum install -y unixODBC*
yum install -y compat-libcap*
yum install -y libcap*
yum install libaio-devel
yum install xdpyinfo
yum install perl-Env
yum install -y smartmontools
yum install elfutils-libelf-devel
yum install unzip

13.配置互相信任,grid/oracle用户都需要

切换到oracle用户:
rac1:
ssh-keygen -t rsa [这里一路回车就可以了]
cat ~/.ssh/id_rsa.pub  >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub  >> ~/.ssh/authorized_keys[输入yes]
ssh-copy-id oracle@rac2[将本地公钥追加到authorized_keys上]
ssh rac2 date
只要不再提示输入密码就成功了。
rac2:
ssh-keygen -t rsa [这里一路回车就可以了]
cat ~/.ssh/id_rsa.pub  >> ~/.ssh/authorized_keys
ssh rac1 cat ~/.ssh/id_rsa.pub  >> ~/.ssh/authorized_keys[输入yes]
ssh-copy-id oracle@rac1       [将本地公钥追加到authorized_keys上]
ssh rac1 date
只要不再提示输入密码就成功了。
grid用户重复此步骤,把oracle改为grid即可。

14.配置共享存储,这里用的是3par8400,已在3par管理软件中划好磁盘并映射到主机,只需格式化即可

fdisk -l
fdisk /dev/sdc
fdisk /dev/sdd
fdisk /dev/sde
fdisk /dev/sdf
fdisk /dev/sdg
fdisk /dev/sdh
fdisk /dev/sdi
fdisk /dev/sdj
fdisk /dev/sdk
fdisk /dev/sdl

disk /dev/sdc表示要对/dev/sdc磁盘进行格式化,其中,输入的命令分别表示:
n表示新建1个分区;
p表示分区类型选择为primary partition 主分区;
1表示分区编号从1开始;
起始、终止柱面选择默认值,即1和500;
w表示将新建的分区信息写入硬盘分区表。

15.配置ASM磁盘(需要上传并安装如下三个依赖包):

rpm -ivh pdksh-5.2.14-37.el5.x86_64.rpm 
rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm 
rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm

执行如下命令

oracleasm configure -i命令进行配置时,用户配置为grid,组为asmadmin,启动ASM library driver驱动服务,并且将其配置为随着操作系统的启动而自动启动。

oracleasm configure -i

Configuring the Oracle ASM library driver.
 
This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.
 
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
配置完成后,记得执行 oracleasm init命令来加载oracleasm内核模块。

oracleasm init

Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm

在rac1创建共享盘:

oracleasm createdisk OCR1 /dev/sdc1 
oracleasm createdisk OCR2 /dev/sdd1 
oracleasm createdisk OCR3 /dev/sde1 
oracleasm createdisk FRA /dev/sdf1 
oracleasm createdisk DATA1 /dev/sdg1 
oracleasm createdisk DATA2 /dev/sdh1 
oracleasm createdisk DATA3 /dev/sdi1 
oracleasm createdisk DATA4 /dev/sdj1 
oracleasm createdisk DATA5 /dev/sdk1 
oracleasm createdisk DATA6 /dev/sdl1 

在rac2扫描磁盘:

oracleasm scandisks

Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "OCR1"
Instantiating disk "OCR2"
Instantiating disk "OCR3"
Instantiating disk "FRA"
Instantiating disk "DATA1"
Instantiating disk "DATA2"
Instantiating disk "DATA3"
Instantiating disk "DATA4"
Instantiating disk "DATA5"
Instantiating disk "DATA6"

16.安装grid

  上传并解压安装包

unzip p13390677_112040_Linux-x86-64_1of7.zip 
unzip p13390677_112040_Linux-x86-64_2of7.zip 
unzip p13390677_112040_Linux-x86-64_3of7.zip

chown -R grid:oinstall /u01/app/grid/
chown -R oracle:oinstall /u01/app/database/

 使用grid用户进入到解压目录 

cd /u01/app/grid/
验证:
./runcluvfy.sh stage -pre crsinst -n mcebgcd-hrdb1,mcebgcd-hrdb2 -fixup -verbose

安装Grid Infrastructure

1.安装流程

只需要在一个节点上安装即可,会自动复制到其他节点中,这里在rac1中安装。
进入图形化接口,在grid用户下进行安装

安装之前进入grid下rpm目录安装一个包(需在root用户下): 

cd /u01/app/grid/rpm/
rpm -ivh cvuqdisk-1.0.9-1.rpm 

再到grid用户/u01/app/grid/下执行./runInstaller

 

这篇关于ORACLE LINUX 7.7 安装ORACLE 11.2.0.4.0 RAC的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!