oracle 12c rac 詳細部署教程(二)

dba_sam發表於2021-06-20

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     #輸入命令後,一直按Enter鍵完成。
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     #輸入命令後,一直按Enter鍵
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章