本文为19年12月份搭建的环境并亲自安装的整体过程日志,如有疑问,可留言共同探讨。 ORACLE19c--RAC集群安装
第一步:配置/etc/hosts 192.168.1.61 xiaosheng61 192.168.1.62 xiaosheng62 192.168.10.61 xiaosheng61prv 192.168.10.62 xiaosheng62prv 192.168.1.63 xiaosheng61vip 192.168.1.64 xiaosheng62vip 192.168.1.65 xiaoshengscan
第二步:关闭SELINIX、防火墙 echo "SELINUX=disabled" > /etc/selinux/config echo "#SELINUXTYPE=targeted " >> /etc/selinux/config setenforce 1 systemctl stop firewalld.service systemctl disable firewalld.service
禁止NTP systemctl stop ntpd systemctl disabled ntpd systemctl stop chronyd.service systemctl disable chronyd.service rm -f /etc/chrony.conf
第三步:配置yum环境 mkdir /mnt/linux mount /dev/cdrom /mnt/linux cd /etc/yum.repos.d mkdir bk mv *.repo bk/ echo "[EL]" >> /etc/yum.repos.d/itpux.repo echo "name =Linux 7.x DVD" >> /etc/yum.repos.d/itpux.repo echo "baseurl=file:///mnt/linux" >> /etc/yum.repos.d/itpux.repo echo "gpgcheck=0" >> /etc/yum.repos.d/itpux.repo echo "enabled=1" >> /etc/yum.repos.d/itpux.repo cat /etc/yum.repos.d/itpux.repo
准备预先安装的包 cd /mnt/hgfs/soft/ rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
根据提示安装所需要的包: yum -y install ksh libaio-devel
第四步:创建用户与组 userdel -r oracle userdel -r grid groupdel oinstall groupdel dba groupadd -g 5001 oinstall groupadd -g 5002 dba groupadd -g 5003 asmdba groupadd -g 5004 asmoper groupadd -g 5005 asmadmin useradd -u 6001 -g oinstall -G asmadmin,asmdba,asmoper grid useradd -u 6002 -g oinstall -G dba,asmadmin oracle passwd grid passwd oracle
手工创建目录并授权 mkdir /opt/oracle mkdir -p /opt/oracle/app/grid mkdir -p /opt/oracle/app/19c/grid chown -R grid:oinstall /opt/oracle mkdir -p /opt/oracle/app/oraInventory chown -R grid:oinstall /opt/oracle/app/oraInventory mkdir -p /opt/oracle/app/oracle/product/19c/dbhome_1 chown -R oracle:oinstall /opt/oracle/app/oracle chmod -R 775 /opt/oracle
第五步:环境变量配置 su - grid vi ~/.bash_profile umask 022 export ORACLE_SID=+ASM1 export ORACLE_BASE=/opt/oracle/app/grid export ORACLE_HOME=/opt/oracle/app/19c/grid export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin source ~/.bash_profile env |grep ORACLE
环境变量配置 su - oracle vi ~/.bash_profile umask 022 export ORACLE_BASE=/opt/oracle/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1 export ORACLE_UNQNAME=itpuxdb export ORACLE_SID=itpuxdb1 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin source ~/.bash_profile env |grep ORACLE
第六步:配置NFS共享存储IP为192.168.1.70 配置ASM目录 NFS Server配置 vi /etc/exports /asm *(rw,sync,no_wdelay,insecure,no_root_squash) systemctl restart nfs-server.service showmount -e exportfs -v echo "SELINUX=disabled" > /etc/selinux/config echo "#SELINUXTYPE=targeted " >> /etc/selinux/config setenforce 1 cat /etc/selinux/config systemctl stop firewalld.service systemctl disable firewalld.service
RAC主机配置 mkdir /asm vi /etc/fstab 192.168.1.70:/asm /asm nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0 mount -a chown -R grid:asmadmin /asm
ASM共享磁盘创建 mkdir -p /asm/oracleasm/disks dd if=/dev/zero of=/asm/oracleasm/disks/asm1 bs=8192k count=1280 dd if=/dev/zero of=/asm/oracleasm/disks/asm2 bs=8192k count=1280 dd if=/dev/zero of=/asm/oracleasm/disks/asm3 bs=8192k count=1280 dd if=/dev/zero of=/asm/oracleasm/disks/asm4 bs=8192k count=1280 dd if=/dev/zero of=/asm/oracleasm/disks/asm5 bs=8192k count=1280 dd if=/dev/zero of=/asm/oracleasm/disks/asm6 bs=8192k count=128 dd if=/dev/zero of=/asm/oracleasm/disks/asm7 bs=8192k count=128 chown grid:asmadmin /asm/oracleasm/disks/asm1 chown grid:asmadmin /asm/oracleasm/disks/asm2 chown grid:asmadmin /asm/oracleasm/disks/asm3 chown grid:asmadmin /asm/oracleasm/disks/asm4 chown grid:asmadmin /asm/oracleasm/disks/asm5 chown grid:asmadmin /asm/oracleasm/disks/asm6 chown grid:asmadmin /asm/oracleasm/disks/asm7 chmod 664 *
第七步:安装GRID集群软件grid用户 解压文件到grid_home目录 su - grid cd $ORACLE_HOME unzip /mnt/hgfs/soft/LINUX.X64_193000_grid_home.zip root(两台机都装): rpm -Uvh /opt/oracle/app/19c/grid/cv/rpm/cvuqdisk* 用虚拟机启动安装grid用户 cd $ORACLE_HOME ./gridSetup.sh
第八步:安装DB集群软件oracle用户 解压文件到oracle_home目录 su - oracle cd $ORACLE_HOME unzip /mnt/hgfs/soft/LINUX.X64_193000_db_home.zip 用虚拟机启动安装oracle用户 cd $ORACLE_HOME ./runInstaller
数据库创建oracle用户 dbca 集群的启动与关闭用root用户 /opt/oracle/app/19c/grid/bin/crsctl stop crs /opt/oracle/app/19c/grid/bin/crsctl start crs /opt/oracle/app/19c/grid/bin/crsctl check crs
第九步:Oracle 表空间创建 sqlplus "/as sysdba"; create tablespace xiaosheng datafile '+DATA' size 10m;
Oracle 用户创建 create user xiaosheng identified by xiaosheng123 default tablespace xiaosheng; grant dba to xiaosheng; conn xiaosheng/xiaosheng123; create table itpuxt1(id number(12) primary key, name varchar(20)) ;
Oracle 数据插入 insert into itpuxt1 values(1,'xiaosheng01'); insert into itpuxt1 values(2,'xiaosheng02'); commit;
Oracle 数据查询 select * from itpuxt1;