首页 > 数据库 >centos7 安装ORACLE 11.2.0.4.0 RAC

centos7 安装ORACLE 11.2.0.4.0 RAC

时间:2024-06-11 14:55:50浏览次数:28  
标签:RAC rac1 app 0.4 11.2 grid dev root u01

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

 节点一(rac1):
  网卡一:10.121.116.91
  网卡二:192.168.1.101
 节点二(rac2):
  网卡一:10.121.116.92
  网卡二: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.121.116.91    rac1
10.121.116.93    rac1-vip
192.168.1.101    rac1-priv 
#rac2
10.121.116.92    rac2
10.121.116.94    rac2-vip
192.168.1.103    rac2-priv 
#scan-cluster
10.121.116.95    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

fdisk /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 rac1,rac2 -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 

cd /u01/app/grid/
export DISPLAY=IP:0.0
./runInstaller

跳过更新

选择安装集群

 选择自定义安装

 选择语言为English

 

定义集群名字,SCAN Name 为hosts中定义的scan-cluster,取消GNS

 界面只有第一个节点rac1,点击“Add”把第二个节点rac2加上

 

 选择网卡

 

 

 配置ASM实例需要为具有sysasm权限的sys用户,具有sysdba权限的asmsnmp用户设置密码,这里设置统一密码。

yes即可

 

 不选择智能管理。

 

检查ASM实例权限分组情况,默認既可。

 选择grid软件安装路径和base目录,默認既可。

 

选择grid安装清单目录,默認既可。

 环境检测出现dervice checks for asm警告,我並不是通過udev配置asm,可忽略。resolv.conf错误,是因为没有配置DNS,可以忽略。

 

安装grid概要

 

 提示需要root用户依次执行脚本orainstRoot.sh ,root.sh (一定要先在rac1执行完脚本后,才能在其他节点执行)。

注意:RHEL 7 安装oracle rac 11.2.0.4执行root.sh会报错ohasd failed to start 报错原因:因为RHEL 7使用systemd而不是initd运行进程和重启进程,而root.sh通过传统的initd运行ohasd进程。

解决方法:
在RHEL 7中ohasd需要被设置为一个服务,在运行脚本root.sh之前。
以root用户创建服务文件

touch /usr/lib/systemd/system/ohas.service
chmod 777 /usr/lib/systemd/system/ohas.service

将以下内容添加到新创建的ohas.service文件中

复制代码
vim /usr/lib/systemd/system/ohas.service
[Unit]
Description=Oracle High Availability Services
After=syslog.target

[Service]
ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
Restart=always

[Install]
WantedBy=multi-user.target
复制代码

以root用户运行下面的命令

systemctl daemon-reload
systemctl enable ohas.service
systemctl start ohas.service
systemctl status ohas.service
ohas.service正常运行即可依次执行脚本orainstRoot.sh ,root.sh
复制代码
[root@rac1 rules.d]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@rac1 rules.d]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
OLR initialization - successful
root wallet
root wallet cert
root cert export
peer wallet
profile reader wallet
pa wallet
peer wallet keys
pa wallet keys
peer cert request
pa cert request
peer cert
pa cert
peer root cert TP
profile reader root cert TP
pa root cert TP
peer pa cert TP
pa peer cert TP
profile reader pa cert TP
profile reader peer cert TP
peer user cert
pa user cert
Adding Clusterware entries to upstart
CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1'
CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1'
CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1'
CRS-2672: Attempting to start 'ora.gipcd' on 'rac1'
CRS-2676: Start of 'ora.gipcd' on 'rac1' succeeded
CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac1'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac1'
CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac1' succeeded

ASM created and started successfully.

Disk Group DATA created successfully.

clscfg: -install mode specified
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4256: Updating the profile
Successful addition of voting disk 75df39da21084f84bf866b66b29c3ce3.
Successfully replaced voting disk group with +DATA.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   75df39da21084f84bf866b66b29c3ce3 (ORCL:VOL1) [DATA]
Located 1 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'rac1'
CRS-2676: Start of 'ora.asm' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.DATA.dg' on 'rac1'
CRS-2676: Start of 'ora.DATA.dg' on 'rac1' succeeded
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
在rac2上執行:
[root@rac2 rpm]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@rac2 rpm]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
OLR initialization - successful
Adding Clusterware entries to upstart
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node rac1, number 1, and is terminating
An active cluster was found during exclusive startup, restarting to join the cluster
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
复制代码

完成脚本后,点击OK,进行下一步。

TRANSLATE with x English
Arabic Hebrew Polish
Bulgarian Hindi Portuguese
Catalan Hmong Daw Romanian
Chinese Simplified Hungarian Russian
Chinese Traditional Indonesian Slovak
Czech Italian Slovenian
Danish Japanese Spanish
Dutch Klingon Swedish
English Korean Thai
Estonian Latvian Turkish
Finnish Lithuanian Ukrainian
French Malay Urdu
German Maltese Vietnamese
Greek Norwegian Welsh
Haitian Creole Persian  
  TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back

标签:RAC,rac1,app,0.4,11.2,grid,dev,root,u01
From: https://www.cnblogs.com/gaoyuechen/p/18242024

相关文章

  • Mathematica Partial Fraction Decomposition
    遇到的问题Mathematica中有一个自带的部分分式分解函数Apart。In:=Apart[(-3+x)/((-1+x)(1+x))]Out:=-(1/(-1+x))+2/(1+x)但是Apart遇到分解结果中带无理数的就会摆烂:In:=Apart[x/(1-x-x^2)]Out:=-(x/(-1+x+x^2))解决方案1我们有一个......
  • CameraCtrl:文生视频模型中的摄像机控制革命
    在数字内容创作领域,视频生成技术正迅速发展,其中可控性是实现个性化和高质量视频内容的关键。尽管现有技术在文本到视频(T2V)生成方面取得了进展,但现有的T2V模型往往忽略了摄像机姿态的精确控制,这限制了视频内容的深度和用户参与度。为了解决这一问题,本文将介绍一种名为CameraCtrl......
  • Oracle静默安装
    1.安装前准备1.1.关闭防火墙和SELINUXsystemctlstopfirewalldsystemctldisablefirewalldsed-i"s/SELINUX=enforcing/SELINUX=disabled/g"/etc/selinux/config1.2.修改主机名vi/etc/hostname1.3.添加hosts解析vi/etc/hosts#----------------------------------......
  • CDR2024中文版下载cdr2024终身永久版CorelDRAW2024中文破解版Crack下载安装方法
    CorelDRAW2024是一款功能强大的矢量图形设计软件,适用于专业级图形设计作品的设计师和创作者。它提供了智能对象、布局、插图和模板等功能,可以帮助用户快速创建高质量的设计作品。这款软件的用户界面直观且易于使用,允许用户快速访问和管理设计工具和功能。它还提供了多种自定义......
  • 解决 发生异常: RuntimeError (note: full exception trace is shown but execu
    发生异常:RuntimeError(note:fullexceptiontraceisshownbutexecutionispausedat:<module>)Anattempthasbeenmadetostartanewprocessbeforethecurrentprocesshasfinisheditsbootstrappingphase.Thisproba......
  • Pytorch GPU版环境搭建 CUDA11.2
    简单记录下~参考:深度学习环境配置超详细教程【Anaconda+Pycharm+PyTorch(GPU版)+CUDA+cuDNN】pythonpytorch-GPU环境搭建(CUDA11.2)版本概览Python3.8CUDA11.2cuDNN8.1.1torch1.9.1torchvision0.10.1torchaudio0.9.1CUDA判断自己应该下载什么版本的cu......
  • 11.2 第二型曲线积分
    引入向量场是指分布在空间中的一个向量值函数:给定空间的坐标输出一个(可以看作位于这一点坐标的)向量。典型的例子有力场,电场。设想一个质点在力场\(\boldsymbol{F}\)的作用下,自\(\Gamma\)的起点\(\boldsymbol{A}\)运动到终点\(\boldsymbol{B}\),我们要来计算力场所做......
  • cisco packet tracer 8.2.2 安装配置 基础教程 免登录免破解 简单方便
    1官网下载,需要账号2安装3启动之前,直接断网,禁用网卡(⊙﹏⊙)......
  • EBS:Oracle 数据库执行慢SQL
    至少有APPS权限SELECTa.request_id,floor((sysdate-a.actual_start_date)*24)hou,round(((sysdate-a.actual_start_date)*24-floor((sysdate-a.actual_start_date)*24))*60)mini,c.sql_address,c.inst_id,f.full_name,u.user_name,b.user_c......
  • BitMiracle
    usingBitMiracle.LibTiff.Classic;usingSystem;usingSystem.Collections.Generic;usingSystem.Diagnostics;usingSystem.Drawing;usingSystem.Drawing.Imaging;usingSystem.IO;usingEmgu.CV;usingEmgu.Util;usingSystem.Linq;usingSystem.Text;usingSystem.Thread......