[heading]Oracle安装前提[/heading]
以root用户登录系统虚机ol7-19-rac1,运行以下命令安装Oracle数据库19c依赖包$ yum install -y oracle-database-preinstall-19c
$ /sbin/sysctl -p
$ 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 racdba
$
$ useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,asmdba,asmoper,admadmin,racdba oracle
$ passwd oracle
# Public
10.0.1.101 ol7-19-rac1
10.0.1.102 ol7-19-rac2
# Private
192.168.1.101 ol7-19-rac1-priv
192.168.1.102 ol7-19-rac2-priv
# Virtual
10.0.1.103 ol7-19-rac1-vip
10.0.1.104 ol7-19-rac2-vip
# SCAN
10.0.1.105 ol7-19-scan
SELINUX=disabled
关闭防火墙,运行以下命令$ systemctl stop firewalld
$ systemctl disable firewalld
$ systemctl stop chronyd
$ systemctl disable chronyd
$ mkdir -p /u01/app/19/grid
$ mkdir -p /u01/app/oracle/product/19/db_1
$ chown -R oracle:oinstall /u01
$ chmod -R 775 /u01/
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=ol7-19-rac1
export ORACLE_UNQNAME=CDBRAC
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/app/19/grid
export DB_HOME=$ORACLE_BASE/product/19/db_1
export ORACLE_HOME=$DB_HOME
export ORACLE_SID=cdbrac1
export ORACLE_TERM=xterm
export BASE_PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$BASE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
alias grid_env=’. /home/oracle/grid_env’
alias db_env=’. /home/oracle/db_env’
export ORACLE_SID=+ASM1
export ORACLE_HOME=$GRID_HOME
export PATH=$ORACLE_HOME/bin:$BASE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export ORACLE_SID=cdbrac1
export ORACLE_HOME=$DB_HOME
export PATH=$ORACLE_HOME/bin:$BASE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
shutdown -r now
$ mkdir -p /data1/u04/ol7-19-rac
$ cd /data1/u04/ol7-19-rac
$
$ # Create the disks and associate them with VirtualBox as virtual media.
$ VBoxManage createhd --filename asm-ocr1.vdi --size 1024 --format VDI --variant Fixed
$ VBoxManage createhd --filename asm-ocr2.vdi --size 1024 --format VDI --variant Fixed
$ VBoxManage createhd --filename asm-ocr3.vdi --size 1024 --format VDI --variant Fixed
$ VBoxManage createhd --filename asm-data1.vdi --size 12288 --format VDI --variant Fixed
$ VBoxManage createhd --filename asm-data2.vdi --size 12288 --format VDI --variant Fixed
$ VBoxManage createhd --filename asm-data3.vdi --size 12288 --format VDI --variant Fixed
$
$ # Connect them to the VM.
$ VBoxManage storageattach ol7-19-rac1 --storagectl "SATA" --port 1 --device 0 --type hdd --medium asm-ocr1.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac1 --storagectl "SATA" --port 2 --device 0 --type hdd --medium asm-ocr2.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac1 --storagectl "SATA" --port 3 --device 0 --type hdd --medium asm-ocr3.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac1 --storagectl "SATA" --port 4 --device 0 --type hdd --medium asm-data1.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac1 --storagectl "SATA" --port 5 --device 0 --type hdd --medium asm-data2.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac1 --storagectl "SATA" --port 6 --device 0 --type hdd --medium asm-data3.vdi --mtype shareable
$
$ # Make shareable.
$ VBoxManage modifyhd asm-ocr1.vdi --type shareable
$ VBoxManage modifyhd asm-ocr2.vdi --type shareable
$ VBoxManage modifyhd asm-ocr3.vdi --type shareable
$ VBoxManage modifyhd asm-data1.vdi --type shareable
$ VBoxManage modifyhd asm-data2.vdi --type shareable
$ VBoxManage modifyhd asm-data3.vdi --type shareable
[root@ol7-19-rac1 ~]# cd /dev
[root@ol7-19-rac1 dev]# ls sd*
sda sda1 sda2 sdb sdc sdd sde sdf sdg
[root@ol7-19-rac1 dev]#
[root@ol7-19-rac1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x62be91cf.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won’t be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 1):
First cylinder (1-652, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):
Using default value 652
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@ol7-19-rac1 ~]#
[root@ol7-19-rac1 dev]# ls sd*
sda sda2 sdb1 sdc1 sdd1 sde1 sdf1 sdg1
sda1 sdb sdc sdd sde sdf sdg
[root@ol7-19-rac1 dev]#
options=-g
查看磁盘的SCSI ID[root@ol7-19-rac1 dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sdb
1ATA_VBOX_HARDDISK_VBb5781d10-5cdd8626
[root@ol7-19-rac1 dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sdc
1ATA_VBOX_HARDDISK_VBdaa6933f-45a7bbd7
[root@ol7-19-rac1 dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sdd
1ATA_VBOX_HARDDISK_VBff9e560e-3053c1ed
[root@ol7-19-rac1 dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sde
1ATA_VBOX_HARDDISK_VB0ce057db-89d80b0f
[root@ol7-19-rac1 dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sdf
1ATA_VBOX_HARDDISK_VB38c72c62-65c8b2ce
[root@ol7-19-rac1 dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sdg
1ATA_VBOX_HARDDISK_VB15992f0b-6cff3aca
[root@ol7-19-rac1 dev]#
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBb5781d10-5cdd8626", SYMLINK+="asm-ocr1", OWNER="oracle", GROUP="asm
admin", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBdaa6933f-45a7bbd7", SYMLINK+="asm-ocr2", OWNER="oracle", GROUP="asm
admin", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBff9e560e-3053c1ed", SYMLINK+="asm-ocr3", OWNER="oracle", GROUP="asm
admin", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB0ce057db-89d80b0f", SYMLINK+="asm-data1", OWNER="oracle", GROUP="as
madmin", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB38c72c62-65c8b2ce", SYMLINK+="asm-data2", OWNER="oracle", GROUP="as
madmin", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB15992f0b-6cff3aca", SYMLINK+="asm-data3", OWNER="oracle", GROUP="as
madmin", MODE="0660"
[root@ol7-19-rac1 dev]# /sbin/partprobe /dev/sdb1
[root@ol7-19-rac1 dev]# /sbin/partprobe /dev/sdc1
[root@ol7-19-rac1 dev]#/sbin/partprobe /dev/sdd1
[root@ol7-19-rac1 dev]# /sbin/partprobe /dev/sde1
[root@ol7-19-rac1 dev]# /sbin/partprobe /dev/sdf1
[root@ol7-19-rac1 dev]# /sbin/partprobe /dev/sdg1
[root@ol7-19-rac1 dev]# /sbin/udevadm test /block/sdb/sdb1
[root@ol7-19-rac1 dev]# /sbin/udevadm control --reload-rules
[root@ol7-19-rac1 dev]# ls -al /dev/asm*
lrwxrwxrwx 1 root root 4 Nov 9 20:50 /dev/asm-data1 -> sde1
lrwxrwxrwx 1 root root 4 Nov 9 20:55 /dev/asm-data2 -> sdf1
lrwxrwxrwx 1 root root 4 Nov 9 20:55 /dev/asm-data3 -> sdg1
lrwxrwxrwx 1 root root 4 Nov 9 20:55 /dev/asm-ocr1 -> sdb1
lrwxrwxrwx 1 root root 4 Nov 9 20:26 /dev/asm-ocr2 -> sdc1
lrwxrwxrwx 1 root root 4 Nov 9 20:25 /dev/asm-ocr3 -> sdd1
/dev/asm:
[root@ol7-19-rac1 dev]#
[root@ol7-19-rac1 dev]# shutdown -h now
$ VBoxManage storageattach ol7-19-rac2 --storagectl "SATA" --port 1 --device 0 --type hdd --medium asm-ocr1.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac2 --storagectl "SATA" --port 2 --device 0 --type hdd --medium asm-ocr2.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac2 --storagectl "SATA" --port 3 --device 0 --type hdd --medium asm-ocr3.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac2 --storagectl "SATA" --port 4 --device 0 --type hdd --medium asm-data1.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac2 --storagectl "SATA" --port 5 --device 0 --type hdd --medium asm-data2.vdi --mtype shareable
$ VBoxManage storageattach ol7-19-rac2 --storagectl "SATA" --port 6 --device 0 --type hdd --medium asm-data3.vdi --mtype shareable
- 主机名:ol7-19-rac2
- enp0s3: IP=10.0.1.102 Netmask=255.255.255.0
- enp0s8: IP=192.168.1.102 Netmask=255.255.255.0
$ zip PreGrid.zip *.vdi