900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > 在VMware Workstation中一步一步搭建Oracle 21c rac集群环境

在VMware Workstation中一步一步搭建Oracle 21c rac集群环境

时间:2020-05-19 07:02:12

相关推荐

在VMware Workstation中一步一步搭建Oracle 21c rac集群环境

目录一、rac安装规划1.1、所需软件介绍1.2、IP地址规划1.3、操作系统本地磁盘分区规划1.4、共享存储与ASM磁盘组规划二、操作系统配置2.1、准备OS2.2、添加网卡2.3、修改主机名2.4、配置静态IP地址2.4.1、修改mac地址2.4.2、配置静态IP地址2.5、关闭防火墙2.6、禁用selinux2.7、修改/etc/hosts文件2.8、添加组和用户2.9、创建安装目录2.9.1、挂载/u01目录2.9.2、创建目录2.10、配置grid和oracle用户的环境变量文件2.11、配置root用户的环境变量2.12、安装软件依赖包2.13、配置内核参数2.13.1、修改/etc/sysctl.conf文件2.13.2、修改/etc/security/limits.conf文件2.13.3、修改/etc/pam.d/login文件2.13.4、修改/etc/profile文件2.14、关闭NTP和chrony服务2.15、关闭avahi-daemon2.16、将NOZEROCONF=yes添加到/etc/sysconfig/network文件中2.17、禁用透明大页2.18、停止不用的服务2.19、提升开关机速度三、配置共享存储3.1、服务端配置3.1.1、创建LVM3.1.2、使用yum安装targetd和targetcli3.1.3、使用targetcli创建设备3.1.4、使用targetcli创建iqn和LUN3.1.5、使用targetcli创建acls3.1.6、配置target监听IP和端口3.1.7、保存配置3.2、客户端配置3.2.1、安装服务并启动3.2.2、使用iscsiadm发现可用存储设备并登陆连接3.2.3、创建并配置udev rules文件四、数据库软件包准备4.1、上传安装软件4.2、解压软件五、安装前预检查5.1、安装补丁包(cvuqdisk)5.2、配SSH互信,建立ssh等效性5.3、cluster硬件检测--安装前预检查配置信息六、图形界面安装集群和db6.1、安装grid6.2、安装db6.3、创建磁盘组6.4、创建数据库七、静默安装集群和db7.1、静默安装grid7.2、静默安装db软件7.3、创建DATA和FRA磁盘组7.4、静默创建数据库7.5、创建PDB数据库八、修改基本配置8.1、禁用crs和db的自启动8.2、修改SQL提示符参考

参考:/zaicentos7-8shanganzhuangoracle-jiqunrac-21cxiangxiwanzhengban.html

一、rac安装规划

官网安装过程:/en/database/oracle/oracle-database/21/rilin/index.html

1.1、所需软件介绍

Oracle RAC不支持异构平台。在同一个集群中,可以支持具有速度和规模不同的机器,但所有节点必须运行在相同的操作系统。Oracle RAC不支持具有不同的芯片架构的机器。

备注:

1、OS内存至少8G

2、安装OS和数据库前需要对下载好的安装包进行MD5值校验,检查其完整性

21c数据库软件下载可以参考:/dbbao76zaidockerzhongzhixu2bujikeyongyouoracle-21chuanjing.html

1.2、IP地址规划

从Oracle 11g开始,一共至少7个IP地址,2块网卡,其中public、vip和scan都在同一个网段,private在另一个网段,主机名不要包含下横线,如:RAC_01是不允许的;通过执行ifconfig -a检查2个节点的网卡名称必须一致。另外,在安装之前,公网、私网共4个IP可以ping通,其它3个不能ping通才是正常的。

从18c开始,scan建议至少3个。

1.3、操作系统本地磁盘分区规划

除了/boot分区外,其它分区均采用逻辑卷的方式,这样有利于文件系统的扩展。

1.4、共享存储与ASM磁盘组规划

二、操作系统配置

若无特殊说明,那么以下操作在2个节点均需要执行。

2.1、准备OS

安装步骤略,也可以下载小麦苗已经安装好的虚拟机环境:/ziliaofenxiang.html

安装一台虚拟机,然后复制改名,如下:

用虚拟机软件打开:

2.2、添加网卡

首先,需要添加网卡适配器:

VMnet2如下:

VMnet8如下:

网关为:192.168.59.2,如下所示:

先删除再添加,添加2块网卡,VMnet8为公有网卡,VMnet2为私有网卡,如下所示:

打开后,选择我已复制该虚拟机。

2.3、修改主机名

修改2个节点的主机名为raclhr-21c-n1和raclhr-21c-n2:

hostnamectl set-hostname raclhr-21c-n1hostnamectl set-hostname raclhr-21c-n2

2.4、配置静态IP地址

在2个节点上分别配置静态IP地址。

在节点2上配置IP的时候注意将IP地址(IPADDR)修改掉。需要确保2个节点上的网卡MAC地址不一样,否则节点间不能通信。

2.4.1、修改mac地址

使用ifconfigip link show查看mac地址,修改文件/etc/udev/rules.d/70-persistent-ipoib.rules

cat > /etc/udev/rules.d/70-persistent-ipoib.rules <<"EOF"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:25:83:db", ATTR{type}=="1", KERNEL=="eth*", NAME="ens33"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:25:83:e5", ATTR{type}=="1", KERNEL=="eth*", NAME="ens34"EOF

2.4.2、配置静态IP地址

注意修改IPADDR和HWADDR地址。

1、配置公网:/etc/sysconfig/network-scripts/ifcfg-ens33

cat > /etc/sysconfig/network-scripts/ifcfg-ens33 <<"EOF"DEVICE=ens33NAME=ens33IPADDR=192.168.59.62NETMASK=255.255.255.0GATEWAY=192.168.59.2ONBOOT=yesUSERCTL=noBOOTPROTO=staticHWADDR=00:0c:29:25:83:dbTYPE=EthernetIPV6INIT=noDNS1=114.114.114.114DNS2=8.8.8.8NM_CONTROLLED=noEOF

2、配置私网:/etc/sysconfig/network-scripts/ifcfg-ens34。注意第二块网卡不能配置网关,否则系统默认网关就变成了第二块网卡的网关,从而导致系统不能上外网。

cat > /etc/sysconfig/network-scripts/ifcfg-ens34 <<"EOF"DEVICE=ens34NAME=ens34IPADDR=192.168.2.62NETMASK=255.255.255.0ONBOOT=yesUSERCTL=noBOOTPROTO=staticHWADDR=00:0c:29:25:83:e5TYPE=EthernetIPV6INIT=noDNS1=114.114.114.114DNS2=8.8.8.8NM_CONTROLLED=noEOF

该部分内容做完后,可以重启一次OS。

2.5、关闭防火墙

systemctl disable firewalldsystemctl stop firewalldsystemctl status firewalldsystemctl list-unit-files | grep fire

2.6、禁用selinux

手工修改/etc/selinux/configSELINUX=disabled,或使用下面命令:

sed -i '/^SELINUX=.*/ s//SELINUX=disabled/' /etc/selinux/config

重启才能生效,校验:

[root@raclhr-21c-n1 ~]# getenforce Disabled

2.7、修改/etc/hosts文件

增加如下的内容:

#Public IP192.168.59.62 raclhr-21c-n1192.168.59.63 raclhr-21c-n2#Private IP192.168.2.62 raclhr-21c-n1-priv192.168.2.63 raclhr-21c-n2-priv#Virtual IP192.168.59.64 raclhr-21c-n1-vip192.168.59.65 raclhr-21c-n2-vip#Scan IP192.168.59.66 raclhr-21c-scan192.168.59.67 raclhr-21c-scan192.168.59.68 raclhr-21c-scan

注意:需要保留127.0.0.1 localhost这行。

2.8、添加组和用户

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 racdbauseradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle useradd -u 54322 -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba grid echo lhr | passwd --stdin oracleecho lhr | passwd --stdin grid

2.9、创建安装目录

2.9.1、挂载/u01目录

首先,在2个节点都各自添加一块200g大小的磁盘:

然后做卷组,200g磁盘大约分10个PE,每个PE大约20g:

内容太多,放不下,部分内容有所删减,全文可以参考:/zaicentos7-8shanganzhuangoracle-jiqunrac-21cxiangxiwanzhengban.html

分区完成后,开始创建逻辑卷,挂载分区等操作:

pvcreate /dev/sdc1 /dev/sdc2 /dev/sdc3 /dev/sdc5 /dev/sdc6 /dev/sdc7 /dev/sdc8 /dev/sdc9 /dev/sdc10 /dev/sdc11vgcreate vg_oracle /dev/sdc1 /dev/sdc2 /dev/sdc3 /dev/sdc5 /dev/sdc6 /dev/sdc7 /dev/sdc8 /dev/sdc9 /dev/sdc10 /dev/sdc11lvcreate -n lv_orasoft_u01 -L 60G vg_oraclemkfs.ext4 /dev/vg_oracle/lv_orasoft_u01mkdir /u01mount /dev/vg_oracle/lv_orasoft_u01 /u01echo "/dev/vg_oracle/lv_orasoft_u01 /u01 ext4 defaults 0 0" >> /etc/fstab

查询:

[root@raclhr-21c-n1 ~]# df -hFilesystem Size Used Avail Use% Mounted ondevtmpfs3.9G0 3.9G 0% /devtmpfs 3.9G0 3.9G 0% /dev/shmtmpfs 3.9G 13M 3.9G 1% /runtmpfs 3.9G0 3.9G 0% /sys/fs/cgroup/dev/mapper/centos_lhrdocker-root50G 5.0G 42G 11% //dev/sda1 976M 143M 767M 16% /boot/dev/mapper/centos_lhrdocker-home9.8G 41M 9.2G 1% /home/dev/mapper/vg_docker-lv_docker 788G 73M 748G 1% /var/lib/dockertmpfs 797M 12K 797M 1% /run/user/42tmpfs 797M0 797M 0% /run/user/0/dev/mapper/vg_oracle-lv_orasoft_u01 59G 53M 56G 1% /u01

2.9.2、创建目录

mkdir -p /u01/app/21.3.0/gridmkdir -p /u01/app/gridmkdir -p /u01/app/oraclemkdir -p /u01/app/oracle/product/21.3.0/dbhome_1chown -R grid:oinstall /u01chown -R oracle:oinstall /u01/app/oraclechmod -R 775 /u01/mkdir -p /u01/app/oraInventorychown -R grid:oinstall /u01/app/oraInventorychmod -R 775 /u01/app/oraInventory

2.10、配置grid和oracle用户的环境变量文件

oracle用户:

cat >> /home/oracle/.bash_profile <<"EOF"umask 022export ORACLE_SID=rac21c1export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/21.3.0/dbhome_1export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libexport NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"export TMP=/tmpexport TMPDIR=$TMPexport PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATHexport EDITOR=viexport TNS_ADMIN=$ORACLE_HOME/network/adminexport ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/adminexport SQLPATH=$ORACLE_HOME/sqlplus/admin#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK" --AL32UTF8 SELECT userenv('LANGUAGE') db_NLS_LANG FROM DUAL;export NLS_LANG="AMERICAN_CHINA.ZHS16GBK"alias sqlplus='rlwrap sqlplus'alias rman='rlwrap rman'alias asmcmd='rlwrap asmcmd'alias dgmgrl='rlwrap dgmgrl'alias sas='sqlplus / as sysdba'EOFcat >> /home/grid/.bash_profile <<"EOF"umask 022export ORACLE_SID=+ASM1export ORACLE_BASE=/u01/app/gridexport ORACLE_HOME=/u01/app/21.3.0/gridexport LD_LIBRARY_PATH=$ORACLE_HOME/libexport NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"export PATH=$ORACLE_HOME/bin:$PATHalias sqlplus='rlwrap sqlplus' alias asmcmd='rlwrap asmcmd'alias dgmgrl='rlwrap dgmgrl'alias sas='sqlplus / as sysdba'EOF

注意:另外一台数据库实例名须做相应修改:

Oracle:export ORACLE_SID=rac21c2grid:export ORACLE_SID=+ASM2

2.11、配置root用户的环境变量

cat >> /etc/profile <<"EOF"export ORACLE_BASE=/u01/app/gridexport ORACLE_HOME=/u01/app/21.3.0/gridexport GRID_BASE=$ORACLE_BASEexport GRID_HOME=$ORACLE_HOMEexport PATH=$PATH:$ORACLE_HOME/binEOF

2.12、安装软件依赖包

安装一些常用的包:

yum install -y openssh-clients openssh-server initscripts net-tools telnet which wget \passwd e4fsprogs lrzsz sudo unzip lvm2 tree traceroute lsof file tar systemd \bridge-utils mlocate mailx strace less mmv stressyum install -y dos2unix rlwrap xdpyinfo xorg-x11-apps nmap numactl numactl-devel \iproute rsyslog bash-completion tmux sysbench vim redhat-lsb smartmontools xinetd \gcc make sysstat ksh binutils socat cmake automake autoconf bzr bison libtool deltarpm \rsync libev pv subversion nload gnuplot jq oniguruma yum-fastestmirror net-snmp net-snmp-utils \nfs-utils rpcbind postfix dovecot bind-utils bind bind-chroot dnsmasq haproxy keepalived bzr \fio bzip2 ntp flex lftpyum install -y ncurses-devel libgcrypt-devel libaio libaio-devel \perl perl-Env perl-devel perl-Time-HiRes perl-DBD-MySQL perl-ExtUtils-MakeMaker perl-TermReadKey \perl-Config-Tiny perl-Email-Date-Format perl-Log-Dispatch perl-Mail-Sender perl-Mail-Sendmail \perl-MIME-Lite perl-Parallel-ForkManager perl-Digest-MD5 perl-ExtUtils-CBuilder perl-IO-Socket-SSL \perl-JSON openssl-devel libverto-devel libsepol-devel libselinux-devel libkadm5 keyutils-libs-devel \krb5-devel libcom_err-devel cyrus-sasl* perl-DBD-Pg perf slang perl-DBI perl-CPAN \perl-ExtUtils-eBuilder cpan perl-testsyum install -y compat-libstdc++-33 gcc-c++ glibc glibc-common glibc.i686 glibc-devel glibc-devel.i686 \libgcc libgcc.i686 libstdc++ libstdc++-devel libaio.i686 libaio-devel.i686 \libXext libXext.i686 libXtst libXtst.i686 libX11 libX11.i686 libXau libXau.i686 \libxcb libxcb.i686 libXi libXi.i686 unixODBC unixODBC-devel zlib-devel zlib-devel.i686 \compat-libcap1 libXp libXp-devel libXp.i686 elfutils-libelf elfutils-libelf-devel compat-db \gnome-libs pdksh xscreensaver fontconfig-devel libXrender-develyum remove PackageKit -y

检查:

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \compat-libcap1 \compat-libstdc++-33 \gcc \gcc-c++ \glibc \glibc-devel \ksh \libgcc \libstdc++ \libstdc++-devel \libaio \libaio-devel \libXext \libXtst \libX11 \libXau \libxcb \libXi \make \elfutils-libelf-devel \sysstat | grep "not installed"

2.13、配置内核参数

2.13.1、修改/etc/sysctl.conf文件

cat >> /etc/sysctl.conf <<"EOF"vm.swappiness = 1vm.dirty_background_ratio = 3vm.dirty_ratio = 80vm.dirty_expire_centisecs = 500vm.dirty_writeback_centisecs = 100kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.panic_on_oops = 1kernel.watchdog_thresh=30EOF

生效:

/sbin/sysctl -p

2.13.2、修改/etc/security/limits.conf文件

echo "grid soft nofile 1024grid hard nofile 65536grid soft stack 10240grid hard stack 32768grid soft nproc 2047grid hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240oracle hard stack 32768oracle soft nproc 2047oracle hard nproc 16384oracle hard memlock 8145728oracle soft memlock 8145728root soft nproc 2047 " >> /etc/security/limits.conf

2.13.3、修改/etc/pam.d/login文件

echo "session requiredpam_limits.so" >> /etc/pam.d/login

2.13.4、修改/etc/profile文件

cat >> /etc/profile << "EOF"if [ $USER = "oracle" ] || [ $USER = "grid" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fiumask 022fiEOF

2.14、关闭NTP和chrony服务

可以采用操作系统的NTP服务,也可以使用Oracle自带的服务ctss,如果ntp没有启用,那么Oracle会自动启用自己的ctssd进程。

从oracle 11gR2 RAC开始使用Cluster Time Synchronization Service(CTSS)同步各节点的时间,当安装程序发现NTP协议处于非活动状态时,安装集群时间同步服务将以活动模式(active)自动进行安装并同步所有节点的时间。如果发现配置了NTP,则以观察者模式(observer mode)启动集群时间同步服务,Oracle Clusterware不会在集群中进行活动的时间同步。

systemctl stop ntpd systemctl disable ntpd.servicemv /etc/ntp.conf /etc/ntp.conf.bak

Chrony是一个开源的自由软件,它能帮助你保持系统时钟与时钟服务器(NTP)同步,因此让你的时间保持精确。它由两个程序组成,分别是chronyd和chronyc。chronyd是一个后台运行的守护进程,用于调整内核中运行的系统时钟和时钟服务器同步。它确定计算机增减时间的比率,并对此进行补偿。chronyc提供了一个用户界面,用于监控性能并进行多样化的配置。它可以在chronyd实例控制的计算机上工作,也可以在一台不同的远程计算机上工作。

systemctl disable chronydsystemctl stop chronydmv /etc/chrony.conf /etc/chrony.conf_bak

2.15、关闭avahi-daemon

systemctl stop avahi-daemon systemctl disable avahi-daemon

Avahi允许程序在不需要进行手动网络配置的情况 下,在一个本地网络中发布和获知各种服务和主机。例如,当某用户把他的计算机接入到某个局域网时,如果他的机器运行有Avahi服务,则Avahi程式自动广播,从而发现网络中可用的打印机、共享文件和可相互聊天的其他用户。这有点象他正在接收局域网中的各种网络广告一样。

Linux下系统实际启动的进程名,是avahi-daemon。

2.16、将NOZEROCONF=yes添加到/etc/sysconfig/network文件中

echo 'NOZEROCONF=yes' >> /etc/sysconfig/network

2.17、禁用透明大页

参考:/linux-biaozhundayehetoumingdaye.html

cat >> /etc/rc.local <<"EOF"if test -f /sys/kernel/mm/transparent_hugepage/enabled; thenecho never > /sys/kernel/mm/transparent_hugepage/enabledfiif test -f /sys/kernel/mm/transparent_hugepage/defrag; thenecho never > /sys/kernel/mm/transparent_hugepage/defragfiEOFchmod +x /etc/rc.d/rc.localsh /etc/rc.localcat /sys/kernel/mm/transparent_hugepage/defragcat /sys/kernel/mm/transparent_hugepage/enabled

建议配置大页功能,参考:/oracleshujukupeizhidaye.html

2.18、停止不用的服务

systemctl list-unit-files | grep enablesystemctl stop autofssystemctl stop nfslocksystemctl stop rpcidmapdsystemctl stop rpcgssdsystemctl stop ntpdsystemctl stop bluetooth.servicesystemctl stop cups.path systemctl stop cups.socketsystemctl stop postfix.servicesystemctl stop rpcbind.servicesystemctl stop rpcbind.socketsystemctl stop NetworkManager-dispatcher.servicesystemctl stop dbus-workManager.servicesystemctl stop abrt-ccpp.servicesystemctl stop cups.servicesystemctl stop libvirtdsystemctl disable autofssystemctl disable nfslocksystemctl disable rpcidmapdsystemctl disable rpcgssdsystemctl disable ntpdsystemctl disable bluetooth.servicesystemctl disable cups.path systemctl disable cups.socketsystemctl disable postfix.servicesystemctl disable rpcbind.servicesystemctl disable rpcbind.socketsystemctl disable NetworkManager-dispatcher.servicesystemctl disable dbus-workManager.servicesystemctl disable abrt-ccpp.servicesystemctl disable cups.servicesystemctl disable libvirtd

2.19、提升开关机速度

在centos在关机或开机时一直等待,等待时间久,卡住时间久,提示A stop job is running for ……

解决:

cat >> /etc/systemd/system.conf << "EOF"DefaultTimeoutStartSec=5sDefaultTimeoutStopSec=5sEOFsystemctl daemon-reload

三、配置共享存储

参考:/zaicentos7-8shanganzhuangoracle-jiqunrac-21cxiangxiwanzhengban.html/3

3.1、服务端配置

3.1.1、创建LVM

3.1.2、使用yum安装targetd和targetcli

3.1.3、使用targetcli创建设备

3.1.4、使用targetcli创建iqn和LUN

3.1.5、使用targetcli创建acls

3.1.6、配置target监听IP和端口

3.1.7、保存配置

3.2、客户端配置

3.2.1、安装服务并启动

3.2.2、使用iscsiadm发现可用存储设备并登陆连接

3.2.3、创建并配置udev rules文件

四、数据库软件包准备

4.1、上传安装软件

打开SecureFX软件:

复制粘贴数据库文件到/soft目录下并等待上传完成。

注意,对安装包需要进行MD5值校验:

[root@raclhr-21c-n1 ~]# cd /soft[root@raclhr-21c-n1 soft]# lltotal 5401812-rw-r--r-- 1 root root 3109225519 Aug 16 09:58 LINUX.X64_213000_db_home.zip-rw-r--r-- 1 root root 2422217613 Aug 16 09:57 LINUX.X64_213000_grid_home.zip[root@raclhr-21c-n1 soft]# md5sum LINUX.X64_213000_grid_home.zip b3fbdb7621ad82cbd4f40943effdd1be LINUX.X64_213000_grid_home.zip[root@raclhr-21c-n1 soft]# md5sum LINUX.X64_213000_db_home.zip 8ac915a800800ddf16a382506d3953db LINUX.X64_213000_db_home.zip

4.2、解压软件

grid用户:

unzip LINUX.X64_213000_grid_home.zip -d /u01/app/21.3.0/grid

oracle用户:

unzip LINUX.X64_213000_db_home.zip -d /u01/app/oracle/product/21.3.0/dbhome_1

只在节点1上进行解压即可。

👉 注意:

1、不要同时进行解压2个文件,否则可能有未预料到的错误

2、需要搜索一下解压是否有报错的地方,搜索关键词“error”

注意:18c解压后的文件所在目录就是grid home。所以解压的时候,就要把文件解压到之前定的GRID_HOME下。在12c R2之前是安装的时候,软件会自动复制过去。

Starting with Oracle Database 18c, the Oracle Database software is available as an image file for download and installation. Extract the image software into the directory where you want your Oracle home to be located, and then run the runInstaller script to start the Oracle Database installation.

Starting with Oracle Database 18c, installation and configuration of Oracle Database software is simplified withImage-Based installation.

五、安装前预检查

5.1、安装补丁包(cvuqdisk)

在安装RAC之前,经常会需要运行集群验证工具CVU(Cluster Verification Utility),该工具执行系统检查,确认当前的配置是否满足要求。

首先判断是否安装了cvuqdisk包:

rpm -qa cvuqdisk

如果没有安装,那么在2个节点上都执行如下命令进行安装该包:

export CVUQDISK_GRP=oinstallcd /u01/app/21.3.0/grid/cv/rpmrpm -ivh cvuqdisk-1.0.10-1.rpm

传输到第2个节点上进行安装:

scp cvuqdisk-1.0.10-1.rpm root@raclhr-21c-n2:/soft-- 节点2安装cvuqdisk包export CVUQDISK_GRP=oinstallrpm -ivh /soft/cvuqdisk-1.0.10-1.rpm

5.2、配SSH互信,建立ssh等效性

sshUserSetup.sh在GI安装介质解压缩后的sshsetup目录下。下面两条命令在节点1上执行即可,在root用户下执行:

/u01/app/21.3.0/grid/oui/prov/resources/scripts/sshUserSetup.sh -user grid -hosts "raclhr-21c-n1 raclhr-21c-n2" -advanced exverify -confirm/u01/app/21.3.0/grid/oui/prov/resources/scripts/sshUserSetup.sh -user oracle -hosts "raclhr-21c-n1 raclhr-21c-n2" -advanced exverify -confirm

输入yes及密码一路回车即可。

以oracle和grid用户在2个节点上都测试两节点连通性:

ssh raclhr-21c-n1 datessh raclhr-21c-n2 datessh raclhr-21c-n1-priv datessh raclhr-21c-n2-priv date

第二次执行时不再提示输入口令,并且可以成功执行命令,则表示SSH对等性配置成功。

5.3、cluster硬件检测--安装前预检查配置信息

Use Cluster Verification Utility (cvu)

Before installing Oracle Clusterware, use CVU to ensure that your cluster is prepared for an installation:

Oracle provides CVU to perform system checks in preparation for an installation, patch updates, or other system changes. In addition, CVU can generate fixup scripts that can change many kernel parameters to at lease the minimum settings required for a successful installation.

Using CVU can help system administrators, storage administrators, and DBA to ensure that everyone has completed the system configuration and preinstallation steps.

./runcluvfy.sh -help

./runcluvfy.sh stage -pre crsinst -n rac1,rac2 –fixup -verbose

Install the operating system package cvuqdisk to both Oracle RAC nodes. Without cvuqdisk, Cluster Verification Utility cannot discover shared disks, and you will receive the error message "Package cvuqdisk not installed" when the Cluster Verification Utility is run (either manually or at the end of the Oracle grid infrastructure installation). Use the cvuqdisk RPM for your hardware architecture (for example, x86_64 or i386). The cvuqdisk RPM can be found on the Oracle grid infrastructure installation media in the rpm directory. For the purpose of this article, the Oracle grid infrastructure media was extracted to the /home/grid/software/oracle/grid directory on racnode1 as the grid user.

在安装GRID之前,建议先利用CVU(Cluster Verification Utility)检查CRS的安装前环境。以grid用户运行:

su - gridexport CVUQDISK_GRP=oinstallexport CV_NODE_ALL=raclhr-21c-n1,raclhr-21c-n2/u01/app/21.3.0/grid/runcluvfy.sh stage -pre crsinst -allnodes -fixup -verbose -method root

grid安装完成后还可以进行如下校验:

$ORACLE_HOME/bin/cluvfy stage -pre crsinst -n all -verbose -fixup

未检测通过的显示为failed,有的failed可以根据提供的脚本进行修复。有的需要根据情况进行修复,有的failed也可以忽略。

报错一:

/dev/shm mounted as temporary file system ...FAILEDraclhr-21c-n2: PRVE-0421 : No entry exists in /etc/fstab for mounting /dev/shmraclhr-21c-n1: PRVE-0421 : No entry exists in /etc/fstab for mounting /dev/shm

参考:/26736162/viewspace-2214381

CentOS7和RHEL7在 /etc/fstab中不包含/dev/shm ,可以手动加进去,或者忽略都可以。

报错二:

Systemd login manager IPC parameter ...FAILEDraclhr-21c-n2: PRVE-10233 : Systemd login manager parameter 'RemoveIPC' entrydoes not exist or is commented out in the configuration file"/etc/systemd/logind.conf" on node "raclhr-21c-n2".[Expected="no"]raclhr-21c-n1: PRVE-10233 : Systemd login manager parameter 'RemoveIPC' entrydoes not exist or is commented out in the configuration file"/etc/systemd/logind.conf" on node "raclhr-21c-n1".[Expected="no"]

参考:/29371470/viewspace-2125673/

解决:

echo "RemoveIPC=no" >> /etc/systemd/logind.confsystemctl daemon-reloadsystemctl restart systemd-logind

报错三:

Network Time Protocol (NTP) ...FAILEDraclhr-21c-n2: PRVG-1017 : NTP configuration file "/etc/ntp.conf" is present onnodes "raclhr-21c-n2,raclhr-21c-n1" on which NTP daemon orservice was not runningraclhr-21c-n1: PRVG-1017 : NTP configuration file "/etc/ntp.conf" is present onnodes "raclhr-21c-n2,raclhr-21c-n1" on which NTP daemon orservice was not running

我们使用ctssd来同步集群的时间,所以ntp必须关闭。

六、图形界面安装集群和db

安装之前重启一次OS,并检查网络和共享盘是否正确。

首先,打开Xmanager - Passive,如下:

6.1、安装grid

注意:以grid用户登录,然后运行下面这个脚本,和之前版本的grid安装有所不同:

[grid@raclhr-21c-n1 ~]$ export DISPLAY=192.168.59.1:0.0[grid@raclhr-21c-n1 ~]$ /u01/app/21.3.0/grid/gridSetup.shLaunching Oracle Grid Infrastructure Setup Wizard...

点击add添加节点2后,点击next

默认选中了不安装GIMR,我们也暂时不安装MIMR库:

修改磁盘路径为“/dev/asm*”就可以找到ASM磁盘了。

忽悠所有错误继续安装

分别在节点1和节点2上执行:

/u01/app/oraInventory/orainstRoot.sh/u01/app/21.3.0/grid/root.sh

节点1运行:

[root@raclhr-21c-n1 ~]# /u01/app/oraInventory/orainstRoot.shChanging 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@raclhr-21c-n1 ~]# /u01/app/21.3.0/grid/root.shPerforming root user operation.The following environment variables are set as:ORACLE_OWNER= gridORACLE_HOME= /u01/app/21.3.0/gridEnter 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 byDatabase Configuration Assistant when a database is createdFinished running generic part of root script.Now product-specific root actions will be performed.Relinking oracle with rac_on optionUsing configuration parameter file: /u01/app/21.3.0/grid/crs/install/crsconfig_params-08-20 08:38:46: Got permissions of file /u01/app/grid/crsdata/raclhr-21c-n1/crsconfig: 0775-08-20 08:38:46: Got permissions of file /u01/app/grid/crsdata: 0775-08-20 08:38:46: Got permissions of file /u01/app/grid/crsdata/raclhr-21c-n1: 0775The log of current session can be found at:/u01/app/grid/crsdata/raclhr-21c-n1/crsconfig/rootcrs_raclhr-21c-n1_-08-20_08-38-46AM.log/08/20 08:38:56 CLSRSC-594: Executing installation step 1 of 19: 'SetupTFA'./08/20 08:38:56 CLSRSC-594: Executing installation step 2 of 19: 'ValidateEnv'./08/20 08:38:56 CLSRSC-594: Executing installation step 3 of 19: 'CheckFirstNode'./08/20 08:38:58 CLSRSC-594: Executing installation step 4 of 19: 'GenSiteGUIDs'./08/20 08:39:00 CLSRSC-594: Executing installation step 5 of 19: 'SetupOSD'.Redirecting to /bin/systemctl restart rsyslog.service/08/20 08:39:00 CLSRSC-594: Executing installation step 6 of 19: 'CheckCRSConfig'./08/20 08:39:00 CLSRSC-594: Executing installation step 7 of 19: 'SetupLocalGPNP'./08/20 08:39:13 CLSRSC-594: Executing installation step 8 of 19: 'CreateRootCert'./08/20 08:39:17 CLSRSC-594: Executing installation step 9 of 19: 'ConfigOLR'./08/20 08:39:35 CLSRSC-594: Executing installation step 10 of 19: 'ConfigCHMOS'./08/20 08:39:35 CLSRSC-594: Executing installation step 11 of 19: 'CreateOHASD'./08/20 08:39:40 CLSRSC-594: Executing installation step 12 of 19: 'ConfigOHASD'./08/20 08:39:41 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'/08/20 08:39:58 CLSRSC-4002: Successfully installed Oracle Autonomous Health Framework (AHF)./08/20 08:40:14 CLSRSC-594: Executing installation step 13 of 19: 'InstallAFD'./08/20 08:40:14 CLSRSC-594: Executing installation step 14 of 19: 'InstallACFS'./08/20 08:40:19 CLSRSC-594: Executing installation step 15 of 19: 'InstallKA'./08/20 08:40:24 CLSRSC-594: Executing installation step 16 of 19: 'InitConfig'./08/20 08:41:52 CLSRSC-482: Running command: '/u01/app/21.3.0/grid/bin/ocrconfig -upgrade grid oinstall'CRS-4256: Updating the profileSuccessful addition of voting disk e4f4713a678d4f04bf0cce6c0c14692d.Successful addition of voting disk 7f85f487c7e34f42bff66f6c7cfc6032.Successful addition of voting disk 408b301b47c84f97bfc109558258b289.Successfully replaced voting disk group with +OCR.CRS-4256: Updating the profileCRS-4266: Voting file(s) successfully replaced## STATE File Universal IdFile Name Disk group-- ----- -------------------------- ---------1. ONLINE e4f4713a678d4f04bf0cce6c0c14692d (/dev/asm-diskd) [OCR]2. ONLINE 7f85f487c7e34f42bff66f6c7cfc6032 (/dev/asm-diske) [OCR]3. ONLINE 408b301b47c84f97bfc109558258b289 (/dev/asm-diskf) [OCR]Located 3 voting disk(s)./08/20 08:43:30 CLSRSC-594: Executing installation step 17 of 19: 'StartCluster'./08/20 08:44:43 CLSRSC-343: Successfully started Oracle Clusterware stack/08/20 08:44:43 CLSRSC-594: Executing installation step 18 of 19: 'ConfigNode'./08/20 08:47:14 CLSRSC-594: Executing installation step 19 of 19: 'PostConfig'./08/20 08:47:36 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded

最后输出Configure Oracle Grid Infrastructure for a Cluster ... succeeded表示成功,跑完后,检查一下:

[root@raclhr-21c-n1 ~]# crsctl stat res -t--------------------------------------------------------------------------------Name Target State Server State details --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.LISTENER.lsnrONLINE ONLINE raclhr-21c-n1 STABLEora.chadONLINE ONLINE raclhr-21c-n1 workONLINE ONLINE raclhr-21c-n1 STABLEora.onsONLINE ONLINE raclhr-21c-n1 STABLE--------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 OFFLINE OFFLINE STABLEora.LISTENER_SCAN1.lsnr1 ONLINE ONLINE raclhr-21c-n1 STABLEora.LISTENER_SCAN2.lsnr1 ONLINE ONLINE raclhr-21c-n1 STABLEora.LISTENER_SCAN3.lsnr1 ONLINE ONLINE raclhr-21c-n1 STABLEora.OCR.dg(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 OFFLINE OFFLINE STABLEora.asm(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 OFFLINE OFFLINE STABLEora.asmnet1.asmnetwork(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 OFFLINE OFFLINE STABLEora.cdp1.cdp1 ONLINE ONLINE raclhr-21c-n1 STABLEora.cdp2.cdp1 ONLINE ONLINE raclhr-21c-n1 STABLEora.cdp3.cdp1 ONLINE ONLINE raclhr-21c-n1 STABLEora.cvu1 ONLINE ONLINE raclhr-21c-n1 STABLEora.qosmserver1 ONLINE ONLINE raclhr-21c-n1 STABLEora.raclhr-21c-n1.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.scan1.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.scan2.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.scan3.vip1 ONLINE ONLINE raclhr-21c-n1 STABLE--------------------------------------------------------------------------------

节点2:

[root@raclhr-21c-n2 ~]# /u01/app/21.3.0/grid/root.shPerforming root user operation.The following environment variables are set as:ORACLE_OWNER= gridORACLE_HOME= /u01/app/21.3.0/gridEnter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite.The contents of "oraenv" have not changed. No need to overwrite.The contents of "coraenv" have not changed. No need to overwrite.Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root script.Now product-specific root actions will be performed.Relinking oracle with rac_on optionUsing configuration parameter file: /u01/app/21.3.0/grid/crs/install/crsconfig_paramsThe log of current session can be found at:/u01/app/grid/crsdata/raclhr-21c-n2/crsconfig/rootcrs_raclhr-21c-n2_-08-20_08-51-42AM.log/08/20 08:51:48 CLSRSC-594: Executing installation step 1 of 19: 'SetupTFA'./08/20 08:51:48 CLSRSC-594: Executing installation step 2 of 19: 'ValidateEnv'./08/20 08:51:48 CLSRSC-594: Executing installation step 3 of 19: 'CheckFirstNode'./08/20 08:51:50 CLSRSC-594: Executing installation step 4 of 19: 'GenSiteGUIDs'./08/20 08:51:50 CLSRSC-594: Executing installation step 5 of 19: 'SetupOSD'./08/20 08:51:50 CLSRSC-594: Executing installation step 6 of 19: 'CheckCRSConfig'./08/20 08:51:51 CLSRSC-594: Executing installation step 7 of 19: 'SetupLocalGPNP'./08/20 08:51:52 CLSRSC-594: Executing installation step 8 of 19: 'CreateRootCert'./08/20 08:51:52 CLSRSC-594: Executing installation step 9 of 19: 'ConfigOLR'./08/20 08:51:52 CLSRSC-594: Executing installation step 10 of 19: 'ConfigCHMOS'./08/20 08:52:23 CLSRSC-594: Executing installation step 11 of 19: 'CreateOHASD'./08/20 08:52:24 CLSRSC-594: Executing installation step 12 of 19: 'ConfigOHASD'./08/20 08:52:25 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'/08/20 08:52:55 CLSRSC-594: Executing installation step 13 of 19: 'InstallAFD'./08/20 08:52:55 CLSRSC-594: Executing installation step 14 of 19: 'InstallACFS'./08/20 08:52:57 CLSRSC-594: Executing installation step 15 of 19: 'InstallKA'./08/20 08:52:58 CLSRSC-594: Executing installation step 16 of 19: 'InitConfig'./08/20 08:53:04 CLSRSC-4002: Successfully installed Oracle Autonomous Health Framework (AHF)./08/20 08:53:08 CLSRSC-594: Executing installation step 17 of 19: 'StartCluster'./08/20 08:54:09 CLSRSC-343: Successfully started Oracle Clusterware stack/08/20 08:54:09 CLSRSC-594: Executing installation step 18 of 19: 'ConfigNode'./08/20 08:54:28 CLSRSC-594: Executing installation step 19 of 19: 'PostConfig'./08/20 08:54:38 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded

最后输出Configure Oracle Grid Infrastructure for a Cluster ... succeeded表示成功,查看:

[root@raclhr-21c-n1 ~]# crsctl stat res -t--------------------------------------------------------------------------------Name Target State Server State details --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.LISTENER.lsnrONLINE ONLINE raclhr-21c-n1 STABLEONLINE ONLINE raclhr-21c-n2 STABLEora.chadONLINE ONLINE raclhr-21c-n1 STABLEONLINE ONLINE raclhr-21c-n2 workONLINE ONLINE raclhr-21c-n1 STABLEONLINE ONLINE raclhr-21c-n2 STABLEora.onsONLINE ONLINE raclhr-21c-n1 STABLEONLINE ONLINE raclhr-21c-n2 STABLE--------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLEora.LISTENER_SCAN1.lsnr1 ONLINE ONLINE raclhr-21c-n1 STABLEora.LISTENER_SCAN2.lsnr1 ONLINE ONLINE raclhr-21c-n1 STABLEora.LISTENER_SCAN3.lsnr1 ONLINE ONLINE raclhr-21c-n2 STABLEora.OCR.dg(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLEora.asm(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 Started,STABLEora.asmnet1.asmnetwork(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLEora.cdp1.cdp1 ONLINE ONLINE raclhr-21c-n1 STABLEora.cdp2.cdp1 ONLINE ONLINE raclhr-21c-n1 STABLEora.cdp3.cdp1 ONLINE ONLINE raclhr-21c-n2 STABLEora.cvu1 ONLINE ONLINE raclhr-21c-n1 STABLEora.qosmserver1 ONLINE ONLINE raclhr-21c-n1 STABLEora.raclhr-21c-n1.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.raclhr-21c-n2.vip1 ONLINE ONLINE raclhr-21c-n2 STABLEora.scan1.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.scan2.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.scan3.vip1 ONLINE ONLINE raclhr-21c-n2 STABLE--------------------------------------------------------------------------------

此时回到界面点击OK,继续运行:

最后集群校验报错,看了一下是dns和ntp的问题,可以忽略,继续安装:

6.2、安装db

[root@raclhr-21c-n1 ~]# su - oracleLast login: Thu Aug 19 15:26:38 CST on pts/0[oracle@raclhr-21c-n1 ~]$ cd $ORACLE_HOME[oracle@raclhr-21c-n1 dbhome_1]$ export DISPLAY=192.168.59.1:0.0[oracle@raclhr-21c-n1 dbhome_1]$ ./runInstaller

节点1和节点2分别执行:

[root@raclhr-21c-n1 ~]# /u01/app/oracle/product/21.3.0/dbhome_1/root.shPerforming root user operation.The following environment variables are set as:ORACLE_OWNER= oracleORACLE_HOME= /u01/app/oracle/product/21.3.0/dbhome_1Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite.The contents of "oraenv" have not changed. No need to overwrite.The contents of "coraenv" have not changed. No need to overwrite.Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root script.Now product-specific root actions will be performed.

执行完后,点击OK:

6.3、创建磁盘组

以 grid 用户执行 asmca 命令,创建DATA和FRA两个磁盘组。:

[root@raclhr-21c-n1 ~]# su - gridLast login: Fri Aug 20 09:59:53 CST [grid@raclhr-21c-n1 ~]$ export DISPLAY=192.168.59.1:0.0[grid@raclhr-21c-n1 ~]$ asmca

查看:

[grid@raclhr-21c-n1 ~]$ $ORACLE_HOME/bin/kfod disks=all st=true ds=true--------------------------------------------------------------------------------DiskSize Header PathDisk Group UserGroup ================================================================================1: 1024 MB MEMBER /dev/asm-diskd OCRgridasmadmin2: 1024 MB MEMBER /dev/asm-diske OCRgridasmadmin3: 1024 MB MEMBER /dev/asm-diskf OCRgridasmadmin4:10240 MB CANDIDATE /dev/asm-diskg # gridasmadmin5:10240 MB CANDIDATE /dev/asm-diskh # gridasmadmin6:10240 MB CANDIDATE /dev/asm-diski # gridasmadmin7:15360 MB MEMBER /dev/asm-diskj DATA gridasmadmin8:15360 MB MEMBER /dev/asm-diskk DATA gridasmadmin9:15360 MB MEMBER /dev/asm-diskl DATA gridasmadmin10:10240 MB MEMBER /dev/asm-diskm FRAgridasmadmin11:10240 MB MEMBER /dev/asm-diskn FRAgridasmadmin12:10240 MB MEMBER /dev/asm-disko FRAgridasmadmin--------------------------------------------------------------------------------ORACLE_SID ORACLE_HOME ================================================================================

6.4、创建数据库

[oracle@raclhr-21c-n1 ~]$ export DISPLAY=192.168.59.1:0.0[oracle@raclhr-21c-n1 ~]$ dbca

七、静默安装集群和db

安装之前重启一次OS,并检查网络和共享盘是否正确。

参考:/zaicentos7-8shanganzhuangoracle-jiqunrac-21cxiangxiwanzhengban.html/7

7.1、静默安装grid

参考:/zaicentos7-8shanganzhuangoracle-jiqunrac-21cxiangxiwanzhengban.html/7

7.2、静默安装db软件

参考:/zaicentos7-8shanganzhuangoracle-jiqunrac-21cxiangxiwanzhengban.html/7

7.3、创建DATA和FRA磁盘组

参考:/zaicentos7-8shanganzhuangoracle-jiqunrac-21cxiangxiwanzhengban.html/7

7.4、静默创建数据库

-- rac数据库dbca -silent -ignorePreReqs -ignorePrereqFailure -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \-gdbname rac21c -sid rac21c \-createAsContainerDatabase TRUE \-sysPassword lhr -systemPassword lhr -dbsnmpPassword lhr \-datafileDestination '+DATA' -recoveryAreaDestination '+FRA' \-storageType ASM \-characterset AL32UTF8 \-totalMemory 1024 \-databaseType OLTP \-emConfiguration none \-nodeinfo raclhr-21c-n1,raclhr-21c-n2-- 单实例dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \-gdbname LHRCDB -sid LHRCDB \-createAsContainerDatabase TRUE \-numberOfPDBs 1 \-pdbName pdbxmm \-pdbAdminPassword lhr \-sysPassword lhr -systemPassword lhr \-datafileDestination '/u01/app/oracle/oradata' \-recoveryAreaDestination '/u01/app/oracle/flash_recovery_area' \-redoLogFileSize 50 \-storageType FS \-characterset AL32UTF8 -nationalCharacterSet AL16UTF16 \-totalMemory 1024 \-databaseType OLTP \-emConfiguration NONE

创建过程:

[oracle@raclhr-21c-n1 ~]$ dbca -silent -ignorePreReqs -ignorePrereqFailure -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \> -gdbname rac21c -sid rac21c \> -createAsContainerDatabase TRUE \> -sysPassword lhr -systemPassword lhr -dbsnmpPassword lhr \> -datafileDestination '+DATA' -recoveryAreaDestination '+FRA' \> -storageType ASM \> -characterset AL32UTF8 \> -totalMemory 1024 \> -databaseType OLTP \> -emConfiguration none \> -nodeinfo raclhr-21c-n1,raclhr-21c-n2[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.CAUSE: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].b.The password entered is a keyword that Oracle does not recommend to be used as passwordACTION: Specify a strong password. If required refer Oracle documentation for guidelines.[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.CAUSE: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].b.The password entered is a keyword that Oracle does not recommend to be used as passwordACTION: Specify a strong password. If required refer Oracle documentation for guidelines.[WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards.CAUSE: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].b.The password entered is a keyword that Oracle does not recommend to be used as passwordACTION: Specify a strong password. If required refer Oracle documentation for guidelines.Prepare for db operation7% completeCopying database files27% completeCreating and starting Oracle instance28% complete31% complete35% complete37% complete40% completeCreating cluster database views41% complete53% completeCompleting Database Creation57% complete59% complete60% complete80% completeExecuting Post Configuration Actions100% completeDatabase creation complete. For details check the logfiles at:/u01/app/oracle/cfgtoollogs/dbca/rac21c.Database Information:Global Database Name:rac21cSystem Identifier(SID) Prefix:rac21cLook at the log file "/u01/app/oracle/cfgtoollogs/dbca/rac21c/rac21c.log" for further details.[oracle@raclhr-21c-n1 ~]$ crsctl stat res -t--------------------------------------------------------------------------------Name Target State Server State details --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.LISTENER.lsnrONLINE ONLINE raclhr-21c-n1 STABLEONLINE ONLINE raclhr-21c-n2 STABLEora.chadONLINE ONLINE raclhr-21c-n1 STABLEONLINE ONLINE raclhr-21c-n2 workONLINE ONLINE raclhr-21c-n1 STABLEONLINE ONLINE raclhr-21c-n2 STABLEora.onsONLINE ONLINE raclhr-21c-n1 STABLEONLINE ONLINE raclhr-21c-n2 STABLE--------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLEora.DATA.dg(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLEora.FRA.dg(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLEora.LISTENER_SCAN1.lsnr1 ONLINE ONLINE raclhr-21c-n1 STABLEora.LISTENER_SCAN2.lsnr1 ONLINE ONLINE raclhr-21c-n1 STABLEora.LISTENER_SCAN3.lsnr1 ONLINE ONLINE raclhr-21c-n2 STABLEora.OCR.dg(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLEora.asm(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 Started,STABLE2 ONLINE ONLINE raclhr-21c-n2 Started,STABLEora.asmnet1.asmnetwork(ora.asmgroup)1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLEora.cdp1.cdp1 ONLINE ONLINE raclhr-21c-n1 STABLEora.cdp2.cdp1 ONLINE ONLINE raclhr-21c-n1 STABLEora.cdp3.cdp1 ONLINE ONLINE raclhr-21c-n2 STABLEora.cvu1 ONLINE ONLINE raclhr-21c-n1 STABLEora.qosmserver1 ONLINE ONLINE raclhr-21c-n1 STABLEora.rac21c.db1 ONLINE ONLINE raclhr-21c-n1 Open,HOME=/u01/app/oracle/product/21.3.0/dbhome_1,STABLE2 ONLINE ONLINE raclhr-21c-n2 Open,HOME=/u01/app/oracle/product/21.3.0/dbhome_1,STABLEora.raclhr-21c-n1.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.raclhr-21c-n2.vip1 ONLINE ONLINE raclhr-21c-n2 STABLEora.scan1.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.scan2.vip1 ONLINE ONLINE raclhr-21c-n1 STABLEora.scan3.vip1 ONLINE ONLINE raclhr-21c-n2 STABLE--------------------------------------------------------------------------------[oracle@raclhr-21c-n1 ~]$ sasSQL*Plus: Release 21.0.0.0.0 - Production on Mon Aug 23 10:32:50 Version 21.3.0.0.0Copyright (c) 1982, , Oracle. All rights reserved.Connected to:Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - ProductionVersion 21.3.0.0.0SYS@rac21c1> show pdbsCON_ID CON_NAME OPEN MODE RESTRICTED---------- ------------------------------ ---------- ----------2 PDB$SEED READ ONLY NO

7.5、创建PDB数据库

SYS@rac21c1> show parameter db_create_file_destNAME TYPE VALUE------------------------------------ ---------------------- ------------------------------db_create_file_dest string +DATASYS@rac21c1> create pluggable database PDBLHR1 admin user lhr identified by lhr;Pluggable database created.SYS@rac21c1> show pdbsCON_ID CON_NAME OPEN MODE RESTRICTED---------- ------------------------------ ---------- ----------2 PDB$SEED READ ONLY NO3 PDBLHR1 MOUNTEDSYS@rac21c1> alter pluggable database pdblhr1 open;Pluggable database altered.SYS@rac21c1> show pdbsCON_ID CON_NAME OPEN MODE RESTRICTED---------- ------------------------------ ---------- ----------2 PDB$SEED READ ONLY NO3 PDBLHR1 READ WRITE NOSYS@rac21c1> alter pluggable database all save state;Pluggable database altered.[oracle@raclhr-21c-n1 ~]$ export ORACLE_PDB_SID=PDBLHR1[oracle@raclhr-21c-n1 ~]$ sasSQL*Plus: Release 21.0.0.0.0 - Production on Mon Aug 23 10:45:11 Version 21.3.0.0.0Copyright (c) 1982, , Oracle. All rights reserved.Connected to:Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - ProductionVersion 21.3.0.0.0SYS@rac21c1> show pdbsCON_ID CON_NAME OPEN MODE RESTRICTED---------- ------------------------------ ---------- ----------3 PDBLHR1 READ WRITE NOSYS@rac21c1> show con_nameCON_NAME------------------------------PDBLHR1[root@raclhr-21c-n1 ~]# crsctl status resource -w "TYPE = ora.database.type" -t--------------------------------------------------------------------------------Name Target State Server State details --------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.rac21c.db1 ONLINE ONLINE raclhr-21c-n1 Open,HOME=/u01/app/oracle/product/21.3.0/dbhome_1,STABLE2 ONLINE ONLINE raclhr-21c-n2 Open,HOME=/u01/app/oracle/product/21.3.0/dbhome_1,STABLE--------------------------------------------------------------------------------[root@raclhr-21c-n1 ~]# crsctl status resource -w "TYPE = ora.pdb.type" -t --------------------------------------------------------------------------------Name Target State Server State details --------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.rac21c.pdblhr1.pdb1 ONLINE ONLINE raclhr-21c-n1 STABLE2 ONLINE ONLINE raclhr-21c-n2 STABLE--------------------------------------------------------------------------------

八、修改基本配置

8.1、禁用crs和db的自启动

-- 禁用crs自启动crsctl disable has-- 禁用db自启动crsctl modify resource ora.rac21c.db -attr AUTO_START=never -unsupportedcrsctl stat res ora.rac21c.db -p | grep AUTO_START

8.2、修改SQL提示符

oracle和grid均修改:

cat >> $ORACLE_HOME/sqlplus/admin/glogin.sql <<"EOF"set linesize 9999 pagesize 9999set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "EOF

参考

内容太多,放不下,部分内容有所删减,全文可以参考:/zaicentos7-8shanganzhuangoracle-jiqunrac-21cxiangxiwanzhengban.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。