ITPub博客

首页 > 数据库 > Oracle > oracle 12c rac 详细部署教程(二)

oracle 12c rac 详细部署教程(二)

原创 Oracle 作者:dba_sam 时间:2021-06-20 12:15:50 1 删除 编辑

yum install oracle-database-server-12cR2-preinstall.x86_64 -y    #两个节点都进行安装
 
资源限制参数配置:(两个节点)
vi /etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf
增加grid用户的资源限制配置

重启两个节点操作系统
reboot

两节点检查
cat /sys/kernel/mm/transparent_hugepage/enabled
需要为never状态

如果未被禁用,编辑/etc/default/grub,在GRUB_CMDLINE_LINUX末尾处加入选项transparent_hugepage=never",然后重启启动系统

用户组添加(两个节点执行)
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
 
添加用户及设置密码(两个节点执行)
useradd -u 54322 -g oinstall -G dba,oinstall,asmadmin,asmdba,asmoper,racdba grid
echo "grid123" | passwd --stdin grid
 
修改oracle用户所属组及修改密码(两个节点执行)
usermod -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
echo "oracle123" | passwd --stdin oracle
 
检查用户

两个节点执行
mkdir -p /u01/grid
mkdir -p /u01/grid12c
mkdir -p /u01/oracle/product/12c/db_home1
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/oracle
 

两个节点执行
su - grid    #切换到grid用户下执行
vi ~/.bash_profile
增加以下内容:
export ORACLE_BASE=/u01/grid
export ORACLE_HOME=/u01/grid12c
export ORACLE_SID=+ASM1      #节点2 SID +ASM2
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin

source ~/.bash_profile   #使配置生效
 
su - oracle    #切换到oracle用户下执行
vi ~/.bash_profile
增加以下内容:
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12c/db_home1
export ORACLE_SID=db12c1     #节点2 SID  db12c2
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin

source ~/.bash_profile   #使配置生效

两个节点操作(root用户)
yum install iscsi* -y
iscsiadm -m discovery -t st -p 43.98.49.146   #43.98.49.146 为openfile存储系统地址

iscsiadm -m node -L all
systemctl enable iscsi.service
systemctl enable iscsid.service
 
检查磁盘加载情况:

2.15使用udev绑定磁盘

生产环境中,存储设备一般与SAN交换机连接,oracle物理机与SAN交换的连接正常都是提供双线路冗余,所以一般还需要配置多路径存储软件(如Multipath)。见文档《Oracle Linux 7.8 多路径(Multipath)+Udev绑定磁盘》
       此文档提供的环境,不需要配置多路径。
 
创建并配置udev rules文件
两个节点运行以下脚本:
for i in c d e f g h i j k l m; do echo "KERNEL==\"sd*\",ENV{DEVTYPE}==\"disk\",SUBSYSTEM==\"block\",PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d \$devnode\",RESULT==\"`/usr/lib/udev/scsi_id -g -u /dev/sd$i`\",RUN+=\"/bin/sh -c 'mknod /dev/asm-disk$i b \$major \$minor; chown grid:asmadmin /dev/asm-disk$i; chmod 0660 /dev/asm-disk$i'\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules; done

重启服务
/sbin/udevadm trigger --type=devices --action=change
/sbin/udevadm control --reload
 
查看磁盘
ll /dev/asm-disk*

说明:这一步,也可以在安装grid和oracle软件时,在UI界面上配置也可以
 
node1 手动配置
su - grid   #切换到grid用户
[grid@node1 ~]$ ssh-keygen     #输入命令后,一直按回车键完成。
Generating public/private rsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_rsa):
Created directory '/home/grid/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_rsa.
Your public key has been saved in /home/grid/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:yyrK0XsgjLKDeLyitfZyZ4xrSUVr6g1supV46Exfddk grid@node1
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|      .          |
|     . .         |
|      +    o     |
| o . +  S o E    |
|o o+B. o o       |
|+o**=B. o        |
|****Bo*.         |
|o=OO=*.          |
+----[SHA256]-----+
[grid@node1 ~]$
 
[grid@node1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub node1    #copy 公钥到node1
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/grid/.ssh/id_rsa.pub"
The authenticity of host 'node1 (43.98.49.147)' can't be established.
ECDSA key fingerprint is SHA256:P+rVlB3D4Ze1gcV4brcuZCbqcmTVAT3Ab+RSniz+fG4.
ECDSA key fingerprint is MD5:e4:ce:00:89:fa:10:5c:6c:4e:85:71:51:8a:65:cf:09.
Are you sure you want to continue connecting (yes/no)? yes      #输入 yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
grid@node1's password:         #输入grid用户密码
 
Number of key(s) added: 1
 
Now try logging into the machine, with:   "ssh 'node1'"
and check to make sure that only the key(s) you wanted were added.
[grid@node1 ~]$
 
[grid@node1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub node2    #copy 公钥到node2
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/grid/.ssh/id_rsa.pub"
The authenticity of host 'node2 (43.98.49.148)' can't be established.
ECDSA key fingerprint is SHA256:Bu9YuKxM1dBmTzcxYMqYIYPyv2ilewzjolPVL6T90ho.
ECDSA key fingerprint is MD5:f4:5d:53:7a:28:dc:0d:13:f1:63:0c:a4:08:12:3d:f0.
Are you sure you want to continue connecting (yes/no)? yes     #输入 yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
grid@node2's password:   #输入grid用户密码
 
Number of key(s) added: 1
 
Now try logging into the machine, with:   "ssh 'node2'"
and check to make sure that only the key(s) you wanted were added.
[grid@node1 ~]$
 
验证连接:
[grid@node1 ~]$ ssh node1 date;ssh node1.baikedb.com date;ssh node1-priv date;ssh node1-priv.baikedb.com date;ssh node2 date;ssh node2.baikedb.com date;ssh node2-priv date;ssh node2-priv.baikedb.com date;      #输入命令后,因为是第一次连接,会提示yes/no  都输入yes
Mon Aug 31 08:25:59 CST 2020
The authenticity of host 'node1.baikedb.com (43.98.49.147)' can't be established.
ECDSA key fingerprint is SHA256:P+rVlB3D4Ze1gcV4brcuZCbqcmTVAT3Ab+RSniz+fG4.
ECDSA key fingerprint is MD5:e4:ce:00:89:fa:10:5c:6c:4e:85:71:51:8a:65:cf:09.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1.baikedb.com' (ECDSA) to the list of known hosts.
Mon Aug 31 08:26:01 CST 2020
The authenticity of host 'node1-priv (172.250.10.10)' can't be established.
ECDSA key fingerprint is SHA256:P+rVlB3D4Ze1gcV4brcuZCbqcmTVAT3Ab+RSniz+fG4.
ECDSA key fingerprint is MD5:e4:ce:00:89:fa:10:5c:6c:4e:85:71:51:8a:65:cf:09.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1-priv,172.250.10.10' (ECDSA) to the list of known hosts.
Mon Aug 31 08:26:02 CST 2020
The authenticity of host 'node1-priv.baikedb.com (172.250.10.10)' can't be established.
ECDSA key fingerprint is SHA256:P+rVlB3D4Ze1gcV4brcuZCbqcmTVAT3Ab+RSniz+fG4.
ECDSA key fingerprint is MD5:e4:ce:00:89:fa:10:5c:6c:4e:85:71:51:8a:65:cf:09.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1-priv.baikedb.com' (ECDSA) to the list of known hosts.
Mon Aug 31 08:26:03 CST 2020
Mon Aug 31 08:28:52 CST 2020
The authenticity of host 'node2.baikedb.com (43.98.49.148)' can't be established.
ECDSA key fingerprint is SHA256:Bu9YuKxM1dBmTzcxYMqYIYPyv2ilewzjolPVL6T90ho.
ECDSA key fingerprint is MD5:f4:5d:53:7a:28:dc:0d:13:f1:63:0c:a4:08:12:3d:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2.baikedb.com' (ECDSA) to the list of known hosts.
Mon Aug 31 08:28:53 CST 2020
The authenticity of host 'node2-priv (172.250.10.11)' can't be established.
ECDSA key fingerprint is SHA256:Bu9YuKxM1dBmTzcxYMqYIYPyv2ilewzjolPVL6T90ho.
ECDSA key fingerprint is MD5:f4:5d:53:7a:28:dc:0d:13:f1:63:0c:a4:08:12:3d:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2-priv,172.250.10.11' (ECDSA) to the list of known hosts.
Mon Aug 31 08:28:54 CST 2020
The authenticity of host 'node2-priv.baikedb.com (172.250.10.11)' can't be established.
ECDSA key fingerprint is SHA256:Bu9YuKxM1dBmTzcxYMqYIYPyv2ilewzjolPVL6T90ho.
ECDSA key fingerprint is MD5:f4:5d:53:7a:28:dc:0d:13:f1:63:0c:a4:08:12:3d:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2-priv.baikedb.com' (ECDSA) to the list of known hosts.
Mon Aug 31 08:28:55 CST 2020
[grid@node1 ~]$
 
第二次连接看是否正常:
[grid@node1 ~]$ ssh node1 date;ssh node1.baikedb.com date;ssh node1-priv date;ssh node1-priv.baikedb.com date;ssh node2 date;ssh node2.baikedb.com date;ssh node2-priv date;ssh node2-priv.baikedb.com date;
Mon Aug 31 08:30:11 CST 2020
Mon Aug 31 08:30:11 CST 2020
Mon Aug 31 08:30:11 CST 2020
Mon Aug 31 08:30:11 CST 2020
Mon Aug 31 08:30:11 CST 2020
Mon Aug 31 08:30:11 CST 2020
Mon Aug 31 08:30:11 CST 2020
Mon Aug 31 08:30:11 CST 2020
[grid@node1 ~]$
 
切换到oracle用户操作
su - oracle   #切换到oracle用户
[oracle@node1 ~]$ ssh-keygen     #输入命令后,一直按回车键
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Created directory '/home/oracle/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:OBC/rzYgHZTug2oRMVJjVKyRIWG81wqi1ScpwlOTOEU oracle@node1
The key's randomart image is:
+---[RSA 2048]----+
|+=XE+.           |
|oOo=+o           |
|o **+..          |
|o*+.*o.o         |
|oo==.++ S        |
|..o.=  o         |
| ... o  .        |
|..    o.         |
|.    ...         |
+----[SHA256]-----+
[oracle@node1 ~]$
 
[oracle@node1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub node1   #copy 公钥到node1
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"
The authenticity of host 'node1 (43.98.49.147)' can't be established.
ECDSA key fingerprint is SHA256:P+rVlB3D4Ze1gcV4brcuZCbqcmTVAT3Ab+RSniz+fG4.
ECDSA key fingerprint is MD5:e4:ce:00:89:fa:10:5c:6c:4e:85:71:51:8a:65:cf:09.
Are you sure you want to continue connecting (yes/no)? yes   #输入 yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
oracle@node1's password:   #输入oracle用户密码
 
Number of key(s) added: 1
 
Now try logging into the machine, with:   "ssh 'node1'"
and check to make sure that only the key(s) you wanted were added.
 
[oracle@node1 ~]$
 
[oracle@node1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub node2   #copy 公钥到node2
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"
The authenticity of host 'node2 (43.98.49.148)' can't be established.
ECDSA key fingerprint is SHA256:Bu9YuKxM1dBmTzcxYMqYIYPyv2ilewzjolPVL6T90ho.
ECDSA key fingerprint is MD5:f4:5d:53:7a:28:dc:0d:13:f1:63:0c:a4:08:12:3d:f0.
Are you sure you want to continue connecting (yes/no)? yes    #输入yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
oracle@node2's password:     #输入oracle 用户密码
 
Number of key(s) added: 1
 
Now try logging into the machine, with:   "ssh 'node2'"
and check to make sure that only the key(s) you wanted were added.
 
[oracle@node1 ~]$
 
验证连接
[oracle@node1 ~]$ ssh node1 date;ssh node1.baikedb.com date;ssh node1-priv date;ssh node1-priv.baikedb.com date;ssh node2 date;ssh node2.baikedb.com date;ssh node2-priv date;ssh node2-priv.baikedb.com date;    #输入命令后,节点第一次连接,会要求输入yes/no  输入yes 回车
Mon Aug 31 08:36:09 CST 2020
The authenticity of host 'node1.baikedb.com (43.98.49.147)' can't be established.
ECDSA key fingerprint is SHA256:P+rVlB3D4Ze1gcV4brcuZCbqcmTVAT3Ab+RSniz+fG4.
ECDSA key fingerprint is MD5:e4:ce:00:89:fa:10:5c:6c:4e:85:71:51:8a:65:cf:09.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1.baikedb.com' (ECDSA) to the list of known hosts.
Mon Aug 31 08:36:11 CST 2020
The authenticity of host 'node1-priv (172.250.10.10)' can't be established.
ECDSA key fingerprint is SHA256:P+rVlB3D4Ze1gcV4brcuZCbqcmTVAT3Ab+RSniz+fG4.
ECDSA key fingerprint is MD5:e4:ce:00:89:fa:10:5c:6c:4e:85:71:51:8a:65:cf:09.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1-priv,172.250.10.10' (ECDSA) to the list of known hosts.
Mon Aug 31 08:36:12 CST 2020
The authenticity of host 'node1-priv.baikedb.com (172.250.10.10)' can't be established.
ECDSA key fingerprint is SHA256:P+rVlB3D4Ze1gcV4brcuZCbqcmTVAT3Ab+RSniz+fG4.
ECDSA key fingerprint is MD5:e4:ce:00:89:fa:10:5c:6c:4e:85:71:51:8a:65:cf:09.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1-priv.baikedb.com' (ECDSA) to the list of known hosts.
Mon Aug 31 08:36:13 CST 2020
Mon Aug 31 08:36:13 CST 2020
The authenticity of host 'node2.baikedb.com (43.98.49.148)' can't be established.
ECDSA key fingerprint is SHA256:Bu9YuKxM1dBmTzcxYMqYIYPyv2ilewzjolPVL6T90ho.
ECDSA key fingerprint is MD5:f4:5d:53:7a:28:dc:0d:13:f1:63:0c:a4:08:12:3d:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2.baikedb.com' (ECDSA) to the list of known hosts.
Mon Aug 31 08:36:14 CST 2020
The authenticity of host 'node2-priv (172.250.10.11)' can't be established.
ECDSA key fingerprint is SHA256:Bu9YuKxM1dBmTzcxYMqYIYPyv2ilewzjolPVL6T90ho.
ECDSA key fingerprint is MD5:f4:5d:53:7a:28:dc:0d:13:f1:63:0c:a4:08:12:3d:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2-priv,172.250.10.11' (ECDSA) to the list of known hosts.
Mon Aug 31 08:36:15 CST 2020
The authenticity of host 'node2-priv.baikedb.com (172.250.10.11)' can't be established.
ECDSA key fingerprint is SHA256:Bu9YuKxM1dBmTzcxYMqYIYPyv2ilewzjolPVL6T90ho.
ECDSA key fingerprint is MD5:f4:5d:53:7a:28:dc:0d:13:f1:63:0c:a4:08:12:3d:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2-priv.baikedb.com' (ECDSA) to the list of known hosts.
Mon Aug 31 08:36:16 CST 2020
[oracle@node1 ~]$
 
第二次连接测试:
[oracle@node1 ~]$ ssh node1 date;ssh node1.baikedb.com date;ssh node1-priv date;ssh node1-priv.baikedb.com date;ssh node2 date;ssh node2.baikedb.com date;ssh node2-priv date;ssh node2-priv.baikedb.com date;
Mon Aug 31 08:37:26 CST 2020
Mon Aug 31 08:37:26 CST 2020
Mon Aug 31 08:37:26 CST 2020
Mon Aug 31 08:37:26 CST 2020
Mon Aug 31 08:37:26 CST 2020
Mon Aug 31 08:37:26 CST 2020
Mon Aug 31 08:37:26 CST 2020
Mon Aug 31 08:37:27 CST 2020
[oracle@node1 ~]$
 
node2 手动配置
按配置node1一样配置一遍即可        


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/70000068/viewspace-2776810/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
本人从事oracle、mysql、postgresql等数据库管理多年,具备丰富的实战经验,同时维护大型企业的Linux操作系统、vmware虚拟化、openstack云计算平台,具有部署、优化、故障处理等经验。

注册时间:2021-05-16

  • 博文量
    49
  • 访问量
    34186