searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

iStack云虚拟机安装Oracle 19c RAC集群数据库

2024-01-16 01:53:28
47
0

1. 环境说明

1.1  主机配置

节点数  2个
操作系统  Centos 7.6
系统内核  3.10.0-957.27.2.el7.x86_64
CPU核数  8核
内存  16GB
网卡数  2个
共享数据盘  1. 投票选举盘(100G) 2. 数据盘(1000G) 3. 备份恢复盘(200G)

1.2 网络配置

节点名称 公共ip地址 心跳ip地址 虚拟ip地址
rac1 192.168.100.2 192.168.100.3 192.168.100.252
rac2 192.168.200.2 192.168.200.3 192.168.100.253
scan ip名称: rac-scan scan ip地址: 192.168.100.254

1.3 物料包

# 其中cvuqdisk-1.0.10-1.rpm可在LINUX.X64_193000_grid_home.zip解压后的目录中获取
cvuqdisk-1.0.10-1.rpm
LINUX.X64_193000_db_home.zip
LINUX.X64_193000_grid_home.zip
oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

1.4 iStack 截图说明

rac1:

rac2:

 

2. 基础环境安装

2.1 hosts文件配置

cat >> /etc/hosts << EOF
#rac1
192.168.100.2     rac1  
192.168.200.2     rac1-priv
192.168.100.252   rac1-vip

#rac2
192.168.100.3     rac2  
192.168.200.3     rac2-priv
192.168.100.253   rac2-vip

#rac-scan
192.168.100.254   rac-scan
EOF

2.2  主机名设置

# rac1 节点
hostnamectl set-hostname  rac1
# rac2 节点
hostnamectl set-hostname  rac2

2.3 yum包安装

yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc-devel -y
yum install ksh -y
yum install libgcc -y
yum install libstdc++ -y
yum install libstdc++-devel -y
yum install libaio -y
yum install libaio-devel -y
yum install libXext -y
yum install libXtst -y
yum install libX11 -y
yum install libXau -y
yum install libxcb -y
yum install libXi -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum install iscsi-initiator-utils -y
yum install device-mapper-multipath -y
yum install smartmontools -y
yum install readline* -y

2.4  图形化安装(仅rac1节点)

yum groupinstall -y "Server with GUI" 
systemctl set-default graphical

2.5 创建oracle用户,用户组

#创建组
groupadd -g 54321 oinstall 
groupadd -g 54322 dba 
groupadd -g 54323 oper 
groupadd -g 54324 backupdba 
groupadd -g 54325 dgdba 
groupadd -g 54326 kmdba 
groupadd -g 54327 asmdba 
groupadd -g 54328 asmoper 
groupadd -g 54329 asmadmin 
groupadd -g 54330 racdba 
#创建用户
useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
useradd -u 54322 -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba,oper grid

2.6 设置grid/oracle密码并赋予su权限

#线上环境注意避免弱密码!!!
echo "*********" | passwd --stdin grid
echo "*********" | passwd --stdin oracle
#赋予用户su权限
sed -i '/required/d' /etc/pam.d/su

2.7 建立相关安装目录

mkdir -p /opt/app/19.3.0/oracle/product/db
mkdir -p /opt/app/grid
mkdir -p /opt/app/oracle
mkdir -p /opt/app/19.3.0/grid/product/grid
mkdir -p /opt/app/oraInventory
chown -R oracle:oinstall  /opt/app/oracle
chown -R oracle:oinstall  /opt/app/19.3.0/oracle/product/db
chown -R grid:oinstall  /opt/app/grid
chown -R grid:oinstall  /opt/app/19.3.0/grid/product/grid
chown -R grid:oinstall  /opt/app/oraInventory

2.8 修改内核参数

# config some parameters
memTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}')
totalMemory=$((memTotal / 2048))
shmall=$((memTotal / 4))
if [ $shmall -lt 2097152 ]; then
shmall=2097152
fi
shmmax=$((memTotal * 1024 - 1))
if [ "$shmmax" -lt 4294967295 ]; then
shmmax=4294967295
fi

cat <<EOF>>/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = $shmall
kernel.shmmax = $shmmax
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 = 1048576
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.eth1.rp_filter = 2
EOF
#生效配置
sysctl -p

cat >> /etc/security/limits.d/99-grid-oracle-limits.conf << EOF
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
EOF

2.9 禁用防火墙、selinux、ntp

# stop firewalld and selinux
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service

# disable selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
getenforce

#stop ntp
systemctl stop  ntpd.service
systemctl disable  ntpd.service

2.10 配置grid、oracle用户变量(仅rac1)

# grid env config
cat >> /home/grid/.bash_profile << EOF
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac1
export ORACLE_SID=+ASM1
export ORACLE_BASE=/opt/app/grid
export ORACLE_HOME=/opt/app/19.3.0/grid/product/grid
export INVENTORY_LOCATION=/opt/app/oraInventory
export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin
EOF

# oracle env config
cat >> /home/oracle/.bash_profile << EOF
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac1
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/19.3.0/oracle/product/db
export ORACLE_UNQNAME=oracledb
export ORACLE_SID=oracledb1
export INVENTORY_LOCATION=/opt/app/oraInventory
export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin
EOF

2.11 配置grid、oracle用户变量(仅rac2)

# grid env config
cat >> /home/grid/.bash_profile << EOF
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac2
export ORACLE_SID=+ASM2
export ORACLE_BASE=/opt/app/grid
export ORACLE_HOME=/opt/app/19.3.0/grid/product/grid
export INVENTORY_LOCATION=/opt/app/oraInventory
export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin
EOF

# oracle env config
cat >> /home/oracle/.bash_profile << EOF
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac2
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/19.3.0/oracle/product/db
export ORACLE_UNQNAME=oracledb
export ORACLE_SID=oracledb2
export INVENTORY_LOCATION=/opt/oracle/app/oraInventory
export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin
EOF

2.12 免密配置(仅rac1)

#root用户
su root
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  root@rac2
#grid用户
su grid
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  grid@rac2
#oracle用户
su oracle
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  oracle@rac2

2.13 免密配置(仅rac2)

#rac2
#root用户
su root
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  root@rac1
#grid用户
su grid
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  grid@rac1
#oracle用户
su oracle
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  oracle@rac1

2.14 存储配置

#1. 获取共享磁盘id
#sda 100G:投票选举盘 sdb 1000G:数据盘  sdc 200G:备份恢复盘
udevadm info  --query=all --path=/sys/block/sda |grep ID_SERIAL=
udevadm info  --query=all --path=/sys/block/sdb |grep ID_SERIAL=
udevadm info  --query=all --path=/sys/block/sdc |grep ID_SERIAL=

#0QEMU_QEMU_HARDDISK_801701848577736704 -> sda
#0QEMU_QEMU_HARDDISK_801701848577736705 -> sdb
#0QEMU_QEMU_HARDDISK_801701848581931008 -> sdc

#2. vdc 10G作为选举盘 vdd 100G作为数据盘  vde 50G作为归档盘
# 各节点均执行以下命令
cat >> /etc/udev/rules.d/99-oracle-asmdevices.rules << 	EOF
KERNEL=="sd*", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_801701848577736704",SYMLINK+="asm-ocr", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_801701848577736705",SYMLINK+="asm-data", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_801701848581931008",SYMLINK+="asm-fra", OWNER="grid", GROUP="asmadmin", MODE="0660"
EOF

#3. 生效
udevadm trigger --type=devices --action=change
udevadm control --reload

#4. 查看asm磁盘
ls -al /dev/asm*

2.15 安装rpm包

yum -y install oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
rpm -ivh cvuqdisk-1.0.10-1.rpm

2.16 重启虚机

3.Grid Infrastructure安装(仅rac1)

3.1 使用vnc连接,并用grid用户登录

3.2  解压

chown -R grid:oinstall LINUX.X64_193000_grid_home.zip
unzip /home/grid/LINUX.X64_193000_grid_home.zip -d  /opt/app/19.3.0/grid/product/grid

3.3  图形化界面安装Grid Infrastructure

cd $ORACLE_HOME
./gridSetup.sh

3.4 ASMCA创建数据磁盘组

3.5 验证Grid Infrastructure

[grid@rac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.chad
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.net1.network
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.ons
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.ASM_DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASM_FRA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASM_VOTE.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                     STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     Started,STABLE
      2        ONLINE  ONLINE       rac2                     Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       rac1                     STABLE
ora.qosmserver
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                     STABLE

4. 安装Oracle(仅rac1)

4.1 使用VNC连接, 并用Oracle用户登录

4.2 解压

chown -R oracle:oinstall LINUX.X64_193000_db_home.zip
unzip /home/oracle/LINUX.X64_193000_db_home.zip -d  /opt/app/19.3.0/oracle/product/db

4.3 图形化安装

cd $ORACLE_HOME 
./runInstaller

5. 创建数据库实例

5.1 创建数据库实例

5.2 验证数据库实例创建是否成功

[grid@rac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.chad
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.net1.network
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.ons
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.ASM_DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASM_FRA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASM_VOTE.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                     STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     Started,STABLE
      2        ONLINE  ONLINE       rac2                     Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       rac1                     STABLE
ora.oracledb.db
      1        ONLINE  ONLINE       rac1                     Open,HOME=/opt/app/1
                                                             9.3.0/oracle/product
                                                             /db,STABLE
      2        ONLINE  ONLINE       rac2                     Open,HOME=/opt/app/1
                                                             9.3.0/oracle/product
                                                             /db,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
--------------------------------------------------------------------------------
0条评论
作者已关闭评论
张****强
6文章数
1粉丝数
张****强
6 文章 | 1 粉丝
原创

iStack云虚拟机安装Oracle 19c RAC集群数据库

2024-01-16 01:53:28
47
0

1. 环境说明

1.1  主机配置

节点数  2个
操作系统  Centos 7.6
系统内核  3.10.0-957.27.2.el7.x86_64
CPU核数  8核
内存  16GB
网卡数  2个
共享数据盘  1. 投票选举盘(100G) 2. 数据盘(1000G) 3. 备份恢复盘(200G)

1.2 网络配置

节点名称 公共ip地址 心跳ip地址 虚拟ip地址
rac1 192.168.100.2 192.168.100.3 192.168.100.252
rac2 192.168.200.2 192.168.200.3 192.168.100.253
scan ip名称: rac-scan scan ip地址: 192.168.100.254

1.3 物料包

# 其中cvuqdisk-1.0.10-1.rpm可在LINUX.X64_193000_grid_home.zip解压后的目录中获取
cvuqdisk-1.0.10-1.rpm
LINUX.X64_193000_db_home.zip
LINUX.X64_193000_grid_home.zip
oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

1.4 iStack 截图说明

rac1:

rac2:

 

2. 基础环境安装

2.1 hosts文件配置

cat >> /etc/hosts << EOF
#rac1
192.168.100.2     rac1  
192.168.200.2     rac1-priv
192.168.100.252   rac1-vip

#rac2
192.168.100.3     rac2  
192.168.200.3     rac2-priv
192.168.100.253   rac2-vip

#rac-scan
192.168.100.254   rac-scan
EOF

2.2  主机名设置

# rac1 节点
hostnamectl set-hostname  rac1
# rac2 节点
hostnamectl set-hostname  rac2

2.3 yum包安装

yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc-devel -y
yum install ksh -y
yum install libgcc -y
yum install libstdc++ -y
yum install libstdc++-devel -y
yum install libaio -y
yum install libaio-devel -y
yum install libXext -y
yum install libXtst -y
yum install libX11 -y
yum install libXau -y
yum install libxcb -y
yum install libXi -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum install iscsi-initiator-utils -y
yum install device-mapper-multipath -y
yum install smartmontools -y
yum install readline* -y

2.4  图形化安装(仅rac1节点)

yum groupinstall -y "Server with GUI" 
systemctl set-default graphical

2.5 创建oracle用户,用户组

#创建组
groupadd -g 54321 oinstall 
groupadd -g 54322 dba 
groupadd -g 54323 oper 
groupadd -g 54324 backupdba 
groupadd -g 54325 dgdba 
groupadd -g 54326 kmdba 
groupadd -g 54327 asmdba 
groupadd -g 54328 asmoper 
groupadd -g 54329 asmadmin 
groupadd -g 54330 racdba 
#创建用户
useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
useradd -u 54322 -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba,oper grid

2.6 设置grid/oracle密码并赋予su权限

#线上环境注意避免弱密码!!!
echo "*********" | passwd --stdin grid
echo "*********" | passwd --stdin oracle
#赋予用户su权限
sed -i '/required/d' /etc/pam.d/su

2.7 建立相关安装目录

mkdir -p /opt/app/19.3.0/oracle/product/db
mkdir -p /opt/app/grid
mkdir -p /opt/app/oracle
mkdir -p /opt/app/19.3.0/grid/product/grid
mkdir -p /opt/app/oraInventory
chown -R oracle:oinstall  /opt/app/oracle
chown -R oracle:oinstall  /opt/app/19.3.0/oracle/product/db
chown -R grid:oinstall  /opt/app/grid
chown -R grid:oinstall  /opt/app/19.3.0/grid/product/grid
chown -R grid:oinstall  /opt/app/oraInventory

2.8 修改内核参数

# config some parameters
memTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}')
totalMemory=$((memTotal / 2048))
shmall=$((memTotal / 4))
if [ $shmall -lt 2097152 ]; then
shmall=2097152
fi
shmmax=$((memTotal * 1024 - 1))
if [ "$shmmax" -lt 4294967295 ]; then
shmmax=4294967295
fi

cat <<EOF>>/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = $shmall
kernel.shmmax = $shmmax
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 = 1048576
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.eth1.rp_filter = 2
EOF
#生效配置
sysctl -p

cat >> /etc/security/limits.d/99-grid-oracle-limits.conf << EOF
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
EOF

2.9 禁用防火墙、selinux、ntp

# stop firewalld and selinux
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service

# disable selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
getenforce

#stop ntp
systemctl stop  ntpd.service
systemctl disable  ntpd.service

2.10 配置grid、oracle用户变量(仅rac1)

# grid env config
cat >> /home/grid/.bash_profile << EOF
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac1
export ORACLE_SID=+ASM1
export ORACLE_BASE=/opt/app/grid
export ORACLE_HOME=/opt/app/19.3.0/grid/product/grid
export INVENTORY_LOCATION=/opt/app/oraInventory
export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin
EOF

# oracle env config
cat >> /home/oracle/.bash_profile << EOF
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac1
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/19.3.0/oracle/product/db
export ORACLE_UNQNAME=oracledb
export ORACLE_SID=oracledb1
export INVENTORY_LOCATION=/opt/app/oraInventory
export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin
EOF

2.11 配置grid、oracle用户变量(仅rac2)

# grid env config
cat >> /home/grid/.bash_profile << EOF
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac2
export ORACLE_SID=+ASM2
export ORACLE_BASE=/opt/app/grid
export ORACLE_HOME=/opt/app/19.3.0/grid/product/grid
export INVENTORY_LOCATION=/opt/app/oraInventory
export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin
EOF

# oracle env config
cat >> /home/oracle/.bash_profile << EOF
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac2
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/19.3.0/oracle/product/db
export ORACLE_UNQNAME=oracledb
export ORACLE_SID=oracledb2
export INVENTORY_LOCATION=/opt/oracle/app/oraInventory
export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin
EOF

2.12 免密配置(仅rac1)

#root用户
su root
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  root@rac2
#grid用户
su grid
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  grid@rac2
#oracle用户
su oracle
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  oracle@rac2

2.13 免密配置(仅rac2)

#rac2
#root用户
su root
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  root@rac1
#grid用户
su grid
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  grid@rac1
#oracle用户
su oracle
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub  oracle@rac1

2.14 存储配置

#1. 获取共享磁盘id
#sda 100G:投票选举盘 sdb 1000G:数据盘  sdc 200G:备份恢复盘
udevadm info  --query=all --path=/sys/block/sda |grep ID_SERIAL=
udevadm info  --query=all --path=/sys/block/sdb |grep ID_SERIAL=
udevadm info  --query=all --path=/sys/block/sdc |grep ID_SERIAL=

#0QEMU_QEMU_HARDDISK_801701848577736704 -> sda
#0QEMU_QEMU_HARDDISK_801701848577736705 -> sdb
#0QEMU_QEMU_HARDDISK_801701848581931008 -> sdc

#2. vdc 10G作为选举盘 vdd 100G作为数据盘  vde 50G作为归档盘
# 各节点均执行以下命令
cat >> /etc/udev/rules.d/99-oracle-asmdevices.rules << 	EOF
KERNEL=="sd*", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_801701848577736704",SYMLINK+="asm-ocr", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_801701848577736705",SYMLINK+="asm-data", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_801701848581931008",SYMLINK+="asm-fra", OWNER="grid", GROUP="asmadmin", MODE="0660"
EOF

#3. 生效
udevadm trigger --type=devices --action=change
udevadm control --reload

#4. 查看asm磁盘
ls -al /dev/asm*

2.15 安装rpm包

yum -y install oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
rpm -ivh cvuqdisk-1.0.10-1.rpm

2.16 重启虚机

3.Grid Infrastructure安装(仅rac1)

3.1 使用vnc连接,并用grid用户登录

3.2  解压

chown -R grid:oinstall LINUX.X64_193000_grid_home.zip
unzip /home/grid/LINUX.X64_193000_grid_home.zip -d  /opt/app/19.3.0/grid/product/grid

3.3  图形化界面安装Grid Infrastructure

cd $ORACLE_HOME
./gridSetup.sh

3.4 ASMCA创建数据磁盘组

3.5 验证Grid Infrastructure

[grid@rac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.chad
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.net1.network
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.ons
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.ASM_DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASM_FRA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASM_VOTE.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                     STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     Started,STABLE
      2        ONLINE  ONLINE       rac2                     Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       rac1                     STABLE
ora.qosmserver
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                     STABLE

4. 安装Oracle(仅rac1)

4.1 使用VNC连接, 并用Oracle用户登录

4.2 解压

chown -R oracle:oinstall LINUX.X64_193000_db_home.zip
unzip /home/oracle/LINUX.X64_193000_db_home.zip -d  /opt/app/19.3.0/oracle/product/db

4.3 图形化安装

cd $ORACLE_HOME 
./runInstaller

5. 创建数据库实例

5.1 创建数据库实例

5.2 验证数据库实例创建是否成功

[grid@rac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.chad
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.net1.network
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.ons
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.ASM_DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASM_FRA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASM_VOTE.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                     STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     Started,STABLE
      2        ONLINE  ONLINE       rac2                     Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       rac1                     STABLE
      2        ONLINE  ONLINE       rac2                     STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       rac1                     STABLE
ora.oracledb.db
      1        ONLINE  ONLINE       rac1                     Open,HOME=/opt/app/1
                                                             9.3.0/oracle/product
                                                             /db,STABLE
      2        ONLINE  ONLINE       rac2                     Open,HOME=/opt/app/1
                                                             9.3.0/oracle/product
                                                             /db,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
--------------------------------------------------------------------------------
文章来自个人专栏
ctyun-zhangq
6 文章 | 1 订阅
0条评论
作者已关闭评论
作者已关闭评论
1
0