CentOS7.6搭建RAC 1.系統環境配置 1.1概述 搭建兩個節點的rac集群,其每個節點均有兩個網卡,public網卡和private網卡。兩個節點的主機名分別為rac1和rac2 1.2 參數設置(RAC1&RAC2) 編輯/etc/hosts文件 vim /etc/hosts 註釋掉 ...
CentOS7.6搭建RAC
1.系統環境配置
1.1概述
搭建兩個節點的rac集群,其每個節點均有兩個網卡,public網卡和private網卡。兩個節點的主機名分別為rac1和rac2
1.2 參數設置(RAC1&RAC2)
-
編輯/etc/hosts文件
vim /etc/hosts
註釋掉以下內容,
#127.0.0.1 localhost rac1 localhost4 localhost4.localdomain4 #::1 localhost rac1 localhost6 localhost6.localdomain6
註:如果沒有註釋上述內容,在安裝rac的先決條件檢查時,會報PRVG-13632錯誤。
追加以下內容
#RAC-PUBLIC-IP 192.168.100.101 rac1 192.168.100.102 rac2 #RAC-PRIVATE-IP 10.10.10.101 rac1-priv 10.10.10.102 rac2-priv #RAC-VIP 192.168.100.201 rac1-vip 192.168.100.202 rac2-vip #RAC-SCAN-IP 192.168.100.200 rac-scan
1.3 關閉防火牆
- 關閉防火牆服務
systemctl disable firewalld.service
-
selinux配置
vi /etc/selinux/config
把enforcing更改為disabled
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
-
掛載系統光碟
-
配置本地yum源
mkdir /yums cd /run/media/root/CentOS 7 x86_64/Packages cp * /yums rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm cd /yums createrepo . vi /etc/yum.repos.d/yum.local.repo
[local] name=yum local repo baseurl=file:///yums gpgcheck=0 enable=1
-
安裝 依賴包
yum install -y bc yum install -y compat-libcap1* yum install -y compat-libcap* yum install -y binutils yum install -y compat-libstdc++-33 yum install -y elfutils-libelf yum install -y elfutils-libelf-devel yum install -y gcc yum install -y gcc-c++ yum install -y glibc-2.5 yum install -y glibc-common yum install -y glibc-devel yum install -y glibc-headers yum install -y ksh libaio yum install -y libaio-devel yum install -y libgcc yum install -y libstdc++ yum install -y libstdc++-devel yum install -y make yum install -y sysstat yum install -y unixODBC yum install -y unixODBC-devel yum install -y binutils* yum install -y compat-libstdc* yum install -y elfutils-libelf* yum install -y gcc* yum install -y glibc* yum install -y ksh* yum install -y libaio* yum install -y libgcc* yum install -y libstdc* yum install -y make* yum install -y sysstat* yum install -y libXp* yum install -y glibc-kernheaders yum install -y net-tools-* yum install -y iscsi-initiator-utils yum install -y udev yum install -y xclock*
手動上傳以下依賴包並安裝
rpm -ivh cvuqdisk-1.0.10-1.rpm rpm -ivh rlwrap-0.37-1.el6.x86_64.rpm yum install -y compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm yum install -y kmod-20-21.el7.x86_64.rpm yum install -y kmod-libs-20-21.el7.x86_64.rpm
-
關閉透明大頁
cp /etc/default/grub /etc/default/grub.bak vi /etc/default/grub
追加一行
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never" GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet" GRUB_DISABLE_RECOVERY="true" GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never"
-
內核參數配置
vi /etc/sysctl.conf
kernel.shmmax = 2126008812 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 fs.file-max = 6815744 kernel.shmall = 393216 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.ip_local_port_range = 9000 65500 net.ipv4.tcp_tw_recycle = 0 net.ipv4.tcp_tw_reuse = 1 #net.core.somaxconn = 262144 net.core.netdev_max_backlog = 262144 net.ipv4.tcp_max_orphans = 262144 net.ipv4.tcp_max_syn_backlog = 262144 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_fin_timeout = 1 net.ipv4.tcp_keepalive_time = 30 net.ipv4.tcp_keepalive_probes = 6 net.ipv4.tcp_keepalive_intvl = 5 net.ipv4.tcp_timestamps = 0 fs.aio-max-nr = 1048576 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2
生成系統參數
sysctl -p
註:
kernel.shmmax:
用於定義單個共用記憶體段的最大值。設置應該足夠大,能在一個共用記憶體段下容納下整個的 SGA。32 位 linux 系統:可取最大值為 4GB ( 4294967296bytes ) -1byte;64 位 linux 系統:可取的最大值為物理記憶體值 -1byte.
建議值為多於物理記憶體的一半,一般取值大於 SGA_MAX_SIZE 即可,可以取物理記憶體 -1byte
kernel.shmall :
可以使用的共用記憶體的總頁數, Linux 共用記憶體頁大小為 4KB
-
修改pam.d/login
vim /etc/pam.d/login
session required /lib/security/pam_limits.so session required pam_limits.so
-
系統資源限制配置
vim /etc/security/limits.conf
oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 oracle hard memlock 134217728 oracle soft memlock 134217728 grid soft nofile 1024 grid hard nofile 65536 grid soft nproc 16384 grid hard nproc 16384 grid soft stack 10240 grid hard stack 32768 grid hard memlock 134217728 grid soft memlock 134217728
-
配置環境變數
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 fi
生成環境變數
source /etc/profile
-
添加用戶和用戶組、創建目錄
groupadd -g 601 oinstall groupadd -g 602 dba groupadd -g 603 oper groupadd -g 604 backupdba groupadd -g 605 dgdba groupadd -g 606 kmdba groupadd -g 607 asmdba groupadd -g 608 asmoper groupadd -g 609 asmadmin useradd -u 601 -g oinstall -G asmadmin,asmdba,dba,asmoper grid useradd -u 602 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin,oper,asmdba oracle
創建用戶密碼
passwd grid passwd oracle
創建Oracle Inventory目錄
mkdir -p /u01/app/oraInventory chown -R grid:oinstall /u01/app/oraInventory chmod -R 775 /u01/app/oraInventory
創建GI HOME目錄
mkdir -p /u01/app/grid mkdir -p /u01/app/19c/grid chown -R grid:oinstall /u01/app/grid chmod -R 775 /u01/app/grid chown -R grid:oinstall /u01/app/19c chmod -R 775 /u01/app/19c/
創建Oracle Base目錄
mkdir -p /u01/app/oracle mkdir /u01/app/oracle/cfgtoollogs chown -R oracle:oinstall /u01/app/oracle chmod -R 775 /u01/app/oracle
創建Oracle RDBMS Home目錄
mkdir -p /u01/app/oracle/product/19c/db_1 chown -R oracle:oinstall /u01/app/oracle/product/19c/db_1 chmod -R 775 /u01/app/oracle/product/19c/db_1
-
給grid用戶配置環境變數
切換到grid用戶
su - grid
編輯bash_profile配置文件
vim ~/.bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$' export PS1 umask 022 export TMP=/tmp export TMPDIR=$TMP export ORACLE_SID=+ASM1 export ORACLE_TERM=xterm; export ORACLE_BASE=/u01/app/grid export ORACLE_HOME=/u01/app/19c/grid export NLS_LANG="AMERICAN_AMERICA.AL32UTF8" export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS" export TNS_ADMIN=$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin export THREADS_FLAG=native 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 alias sqlplus='rlwrap sqlplus' alias rman='rlwrap asmcmd'
註:以下參數RAC1和RAC2的需設置不同參數
RAC1&RAC2:ORACLE_SID=+ASM1 / ASM2
生成環境變數
source ~/.bash_profile
-
給oracle配置環境變數
切換用戶
su - oracle
配置bash_profile文件
vim ~/.bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$' export PS1 export TMP=/tmp export TMPDIR=$TMP export ORACLE_HOSTNAME=rac1 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/19c/db_1 export ORACLE_SID=orcl1 export NLS_LANG="AMERICAN_AMERICA.AL32UTF8" export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS" export TNS_ADMIN=$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/19c/db_1/bin:$ORACLE_HOME/bin export THREADS_FLAG=native;export THREADS_FLAG 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 alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman'
註:以下參數RAC1和RAC2的需設置不同參數
ORACLE_HOSTNAME=rac1/rac2 ORACLE_SID=orcl1/orcl2
生成環境變數
source ~/.bash_profile
-
配置ISCSI掛載外部存儲
切換到root用戶
su - root
安裝ISCSI客戶端軟體
yum -y install iscsi-initiator-utils
設置開機自動啟動
chkconfig iscsid on
查找target
iscsiadm -m discovery -t sendtargets -p 192.168.100.103
手動登錄target
iscsiadm -m node -T iqn.2022.04.com.rac:iscsi.disk -p 192.168.100.103 -l
設置開機自動登錄target
iscsiadm -m node -T iqn.2022.04.com.rac:iscsi.disk --op update -n node.startup -v automatic
查看共用磁碟
cd /dev/disk/by-path ls -l /dev/disk/by-path/*iscsi* | awk '{FS=" "; print $9 " " $10 " " $11}'
/dev/disk/by-path/ip-192.168.100.103:3260-iscsi-iqn.2022.04.com.rac:iscsi.disk-lun-1 -> ../../sdb /dev/disk/by-path/ip-192.168.100.103:3260-iscsi-iqn.2022.04.com.rac:iscsi.disk-lun-2 -> ../../sdc /dev/disk/by-path/ip-192.168.100.103:3260-iscsi-iqn.2022.04.com.rac:iscsi.disk-lun-3 -> ../../sdd /dev/disk/by-path/ip-192.168.100.103:3260-iscsi-iqn.2022.04.com.rac:iscsi.disk-lun-4 -> ../../sde /dev/disk/by-path/ip-192.168.100.103:3260-iscsi-iqn.2022.04.com.rac:iscsi.disk-lun-5 -> ../../sdf /dev/disk/by-path/ip-192.168.100.103:3260-iscsi-iqn.2022.04.com.rac:iscsi.disk-lun-6 -> ../../sdg
查看磁碟wwid
[root@rac1 by-path]# for i in $(ls /dev/sd*|grep -v [0-9]|grep -v sda) > do > echo -ne "$(fdisk -l ${i}|grep ^Disk|grep ${i}|awk '{print $1,$2,$3,$4}') WWID:" > /lib/udev/scsi_id -g -u -d "${i}" > done|sort -nk3 -k5|column -t Disk /dev/sdb: 21.5 GB, WWID:360000000000000000e00000000010001 Disk /dev/sdc: 21.5 GB, WWID:360000000000000000e00000000010002 Disk /dev/sdd: 21.5 GB, WWID:360000000000000000e00000000010003 Disk /dev/sde: 21.5 GB, WWID:360000000000000000e00000000010004 Disk /dev/sdf: 21.5 GB, WWID:360000000000000000e00000000010005 Disk /dev/sdg: 21.5 GB, WWID:360000000000000000e00000000010006 [root@rac1 by-path]#
vi /etc/udev/rules.d/99-oracle-asmdevices.rules # 打開文件後填入以下內容 KERNEL=="sd*", ENV{ID_SERIAL}=="360000000000000000e00000000010001", SYMLINK+="asm_data", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", ENV{ID_SERIAL}=="360000000000000000e00000000010002", SYMLINK+="asm_bak", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", ENV{ID_SERIAL}=="360000000000000000e00000000010003", SYMLINK+="asm_fra", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", ENV{ID_SERIAL}=="360000000000000000e00000000010004", SYMLINK+="asm_ocr_1", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", ENV{ID_SERIAL}=="360000000000000000e00000000010005", SYMLINK+="asm_ocr_2", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", ENV{ID_SERIAL}=="360000000000000000e00000000010006", SYMLINK+="asm_ocr_3", OWNER="grid", GROUP="asmadmin", MODE="0660"
使udev生效
udevadm control --reload-rules udevadm trigger
-
avahi-daemon 配置
yum install -y avahi* systemctl stop avahi-daemon.socket systemctl stop avahi-daemon.service pgrep -f avahi-daemon | awk '{print "kill -9 "$2}' systemctl disable avahi-daemon.socket systemctl disable avahi-daemon.service cat <<EOF>>/etc/sysconfig/network NOZEROCONF=yes EOF
-
時間同步配置
禁用chronyd
yum install -y chrony timedatectl set-timezone Asia/Shanghai systemctl stop chronyd.service systemctl disable chronyd.service
配置時間同步定時任務
yum install -y ntpdate ##192.168.100.150為時間伺服器IP,每天12點同步系統時間 vim /var/spool/cron/root
00 12 * * * /usr/sbin/ntpdate -u 192.168.100.150 && /usr/sbin/hwclock -w
##手動執行 /usr/sbin/ntpdate -u 192.168.100.150 && /usr/sbin/hwclock -w
2.RAC安裝(RAC1)
2.1節點互信
-
節點互信
上傳sshUserSetup.sh腳本到/root
註:這個腳本是Oracle提供的,可以解壓Oracle壓縮包或者Grid壓縮包,查找該腳本上傳到rac1即可
sh sshUserSetup.sh -user root -hosts "rac1 rac2" -advanced -noPromptPassphrase sh sshUserSetup.sh -user grid -hosts "rac1 rac2" -advanced -noPromptPassphrase sh sshUserSetup.sh -user oracle -hosts "rac1 rac2" -advanced -noPromptPassphrase
2.2 Grid安裝
-
上傳Grid文件
把LINUX.X64_193000_grid_home.zip上傳到/u01/app/19c/grid
cd /u01/app/19c/grid chown -R grid:oinstall LINUX.X64_193000_grid_home.zip
-
切換grid用戶解壓
su - grid cd $ORACLE_HOME unzip LINUX.X64_193000_grid_home.zip
等待解壓完畢
-
配置DISPLAY變數
export DISPLAY=192.168.100.103:0.0 ./gridSetup.sh
註:IP寫自己宿主機的IP地址
-
安裝過程
這裡的SCAN NAME一定要和你/etc/hosts文件里的那個RAC-SCAN-IP的名稱保持一致而不是和IP保持一致。
點擊Add
如果密碼設置過於簡單,會警告密碼設置過於簡單,點擊Yes,繼續
是否註冊EMCC,不使用,不配置
有兩個檢查狀態是失敗的,主要是由於沒有使用到DNS服務,所以報錯,可以忽略。
點擊“Yes”
註:以root用戶,按rac1,rac2的順序先後執行這兩個腳本,例如orainstRoot在rac1執行完畢後,然後在rac2執行
[root@rac1 ~]# /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 ~]# /u01/app/19c/grid/root.sh
Performing root user operation.
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/19c/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.
Relinking oracle with rac_on option
Using configuration parameter file: /u01/app/19c/grid/crs/install/crsconfig_params
The log of current session can be found at:
/u01/app/grid/crsdata/rac1/crsconfig/rootcrs_rac1_2022-04-22_10-50-07PM.log
2022/04/22 22:50:30 CLSRSC-594: Executing installation step 1 of 19: 'SetupTFA'.
2022/04/22 22:50:31 CLSRSC-594: Executing installation step 2 of 19: 'ValidateEnv'.
2022/04/22 22:50:31 CLSRSC-363: User ignored prerequisites during installation
2022/04/22 22:50:31 CLSRSC-594: Executing installation step 3 of 19: 'CheckFirstNode'.
2022/04/22 22:50:34 CLSRSC-594: Executing installation step 4 of 19: 'GenSiteGUIDs'.
2022/04/22 22:50:35 CLSRSC-594: Executing installation step 5 of 19: 'SetupOSD'.
2022/04/22 22:50:35 CLSRSC-594: Executing installation step 6 of 19: 'CheckCRSConfig'.
2022/04/22 22:50:35 CLSRSC-594: Executing installation step 7 of 19: 'SetupLocalGPNP'.
2022/04/22 22:51:14 CLSRSC-594: Executing installation step 8 of 19: 'CreateRootCert'.
2022/04/22 22:51:19 CLSRSC-594: Executing installation step 9 of 19: 'ConfigOLR'.
2022/04/22 22:51:31 CLSRSC-594: Executing installation step 10 of 19: 'ConfigCHMOS'.
2022/04/22 22:51:31 CLSRSC-594: Executing installation step 11 of 19: 'CreateOHASD'.
2022/04/22 22:52:01 CLSRSC-594: Executing installation step 12 of 19: 'ConfigOHASD'.
2022/04/22 22:52:13 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2022/04/22 22:52:17 CLSRSC-4002: Successfully installed Oracle Trace File Analyzer (TFA) Collector.
2022/04/22 22:53:09 CLSRSC-594: Executing installation step 13 of 19: 'InstallAFD'.
2022/04/22 22:53:13 CLSRSC-594: Executing installation step 14 of 19: 'InstallACFS'.
2022/04/22 22:53:18 CLSRSC-594: Executing installation step 15 of 19: 'InstallKA'.
2022/04/22 22:53:23 CLSRSC-594: Executing installation step 16 of 19: 'InitConfig'.
ASM has been created and started successfully.
[DBT-30001] Disk groups created successfully. Check /u01/app/grid/cfgtoollogs/asmca/asmca-220422PM105407.log for details.
2022/04/22 22:55:46 CLSRSC-482: Running command: '/u01/app/19c/grid/bin/ocrconfig -upgrade grid oinstall'
CRS-4256: Updating the profile
Successful addition of voting disk b1f361bac9144f9cbfa05a20dc3e1a67.
Successfully replaced voting disk group with +CSDG.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE b1f361bac9144f9cbfa05a20dc3e1a67 (/dev/sde) [CSDG]
Located 1 voting disk(s).
2022/04/22 22:57:46 CLSRSC-594: Executing installation step 17 of 19: 'StartCluster'.
2022/04/22 22:59:37 CLSRSC-343: Successfully started Oracle Clusterware stack
2022/04/22 22:59:38 CLSRSC-594: Executing installation step 18 of 19: 'ConfigNode'.
2022/04/22 23:02:49 CLSRSC-594: Executing installation step 19 of 19: 'PostConfig'.
2022/04/22 23:04:30 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded
[root@rac1 ~]#
點擊“OK”
報錯,主要還是DNS問題,因為我們不使用DNS,所以可以忽略,點擊OK
點擊“next”,安裝完畢
點擊“Yes”
點擊“close”,安裝完畢
-
查看集群狀態
[grid@rac1:/home/grid]$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.CSDG.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 --------------------------------------------------------------------------------
- 查看rac1的IP地址
[grid@rac1:/home/grid]$ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:6c:2b:40 brd ff:ff:ff:ff:ff:ff inet 192.168.100.101/24 brd 192.168.100.255 scope global noprefixroute ens33 valid_lft forever preferred_lft forever inet 192.168.100.200/24 brd 192.168.100.255 scope global secondary ens33:1 valid_lft forever preferred_lft forever inet 192.168.100.201/24 brd 192.168.100.255 scope global secondary ens33:2 valid_lft forever preferred_lft forever inet6 fe80::effb:10f8:9580:34e/64 scope link noprefixroute valid_lft forever preferred_lft forever 3: ens36: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:6c:2b:4a brd ff:ff:ff:ff:ff:ff inet 10.10.10.101/24 brd 10.10.10.255 scope global noprefixroute ens36 valid_lft forever preferred_lft forever inet 169.254.6.205/19 brd 169.254.31.255 scope global ens36:1 valid_lft forever preferred_lft forever inet6 fe80::e654:5dde:a383:d4cf/64 scope link noprefixroute valid_lft forever preferred_lft forever 4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000 link/ether 52:54:00:04:9d:96 brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 valid_lft forever preferred_lft forever 5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000 link/ether 52:54:00:04:9d:96 brd ff:ff:ff:ff:ff:ff
3.資料庫安裝(RAC1)
3.1上傳安裝包
-
以root用戶上傳LINUX.X64_193000_db_home.zip到/u01/app/oracle/product/19c/db_1下
-
更改所屬用戶,所屬組
[root@rac1 ~]# cd /u01/app/oracle/product/19c/db_1 [root@rac1 db_1]# chown -R oracle:oinstall LINUX.X64_193000_db_home.zip
3.2 解壓縮
-
切換用戶
[root@rac1 db_1]# su - oracle Last login: Tue Apr 19 09:24:47 CST 2022 on pts/0
-
切換目錄
[oracle@rac1:/home/oracle]$cd $ORACLE_HOME [oracle@rac1:/u01/app/oracle/product/19c/db_1]$cd /u01/app/oracle/product/19c/db_1
-
解壓
unzip LINUX.X64_193000_db_home.zip
3.3 安裝資料庫
-
設置DISPLAY變數
[oracle@rac1:/u01/app/oracle/product/19c/db_1] export DISPLAY=192.168.100.66:0.0
-
運行安裝程式
[oracle@rac1:/u01/app/oracle/product/19c/db_1] ./runInstaller
註:
1.要投影安裝界面的主機(192.168.100.66)的防火牆要關閉,否則會報類似以下錯誤,
2.如果使用Xshell連接的伺服器或者虛擬機的話,投影的機器或者宿主機要安裝xMananger。
[oracle@rac1:/u01/app/oracle/product/19c/db_1]$./runInstaller ERROR: Unable to verify the graphical display setup. This application requires X display. Make sure that xdpyinfo exist under PATH variable. Can't connect to X11 window server using '192.168.100.66:0.0' as the value of the DISPLAY variable.
-
安裝過程
註:只安裝資料庫軟體,安裝資料庫軟體成功後,再創建實例。
主要是DNS的問題, 直接忽略即可。
點擊“Yes”
分別以root用戶在rac1和rac2上運行該腳本
點擊“Close”,安裝完成
4.建庫(RAC1)
4.1 調取安裝界面
切換到grid用戶,調取安裝界面創建資料庫
[root@rac1 ~]# su - grid
Last login: Thu Apr 28 20:19:54 CST 2022
[grid@rac1:/home/grid]$export DISPLAY=192.168.100.66:0.0
[grid@rac1:/home/grid]$asmca
4.2 創建ASM的DG
關閉對話框
4.2 創建資料庫
-
切換到oracle用戶並調用安裝界面
[grid@rac1:/home/grid]$su - oracle Password: Last login: Mon Apr 25 21:42:45 CST 2022 [oracle@rac1:/home/oracle]$export DISPLAY=192.168.100.66:0.0 [oracle@rac1:/home/oracle]$dbca
-
創建過程
註:可以不創建容器資料庫,直接創建資料庫,也可以根據需求創建容器資料庫後,創建可插拔資料庫。
註:根據需求,決定是否開啟歸檔,也可以在創建資料庫後,開啟歸檔,這裡暫時不開啟歸檔。
註:選擇字元AL32UTF8字元集
註:根據需求選擇是共用伺服器模式還是獨占伺服器模式
直接忽略
到此結束
本文來自博客園,作者:何以卿卿,轉載請註明原文鏈接:https://www.cnblogs.com/shiqiang-lee/p/16216873.html