1.确认安装组
下面为oracle推荐使用用户组
$ id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),
54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54327(asmdba),54330(racdba)
$ id grid
uid=54331(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),
54327(asmdba),54328(asmoper),54329(asmadmin),54330(racdba)
1.1.使用oracle预配置添加组时需补充添加下列组
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
---------------------------------------------------
/usr/sbin/groupadd -g 54322 dba
groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/groupadd -g 54330 racdba
1.2.手动创建用户,如果存在则修改
/usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba oracle
如果用户已存在,则usermod根据需要使用该命令进行修改
/usr/sbin/usermod -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
useradd -u 54322 -g oinstall -G asmadmin,asmdba,racdba,asmoper grid
如果用户已存在,则usermod根据需要使用该命令进行修改
1.3.示例安装准备
# groupadd -g 54321 oinstall
# groupadd -g 54322 dba1
# groupadd -g 54332 dba2
# groupadd -g 54323 oper1
# groupadd -g 54333 oper2
# groupadd -g 54324 backupdba1
# groupadd -g 54334 backupdba2
# groupadd -g 54325 dgdba1
# groupadd -g 54335 dgdba2
# groupadd -g 54326 kmdba1
# groupadd -g 54336 kmdba2
# groupadd -g 54327 asmdba
# groupadd -g 54328 asmoper
# groupadd -g 54329 asmadmin
# groupadd -g 54330 racdba1
# groupadd -g 54340 racdba2
# useradd -u 54322 -g oinstall -G asmadmin,asmdba,racdba1,racdba2 grid
# useradd -u 54321 -g oinstall -G dba1,backupdba1,dgdba1,kmdba1,asmdba,racdba1,asmoper oracle1
# useradd -u 54323 -g oinstall -G dba2,backupdba2,dgdba2,kmdba2,asmdba,racdba2 oracle2
# mkdir -p /u01/app/19.0.0/grid
# mkdir -p /u01/app/grid
# mkdir -p /u01/app/oracle1
# mkdir -p u01/app/oracle2
# chown -R grid:oinstall /u01
# chmod -R 775 /u01/
# chown oracle1:oinstall /u01/app/oracle1
# chown oracle2:oinstall /u01/app/oracle2
2.对磁盘进行分区,创建磁盘组
2.1对磁盘进行分区
su - root
[root@localhost ~]# cat /proc/partitions
major minor #blocks name
259 0 136314880 nvme0n1
259 1 1048576 nvme0n1p1
259 2 135265280 nvme0n1p2
11 0 1048575 sr0
253 0 20971520 dm-0
253 1 8257536 dm-1
253 2 11653120 dm-2
253 3 41943040 dm-3
253 4 41943040 dm-4
253 5 10485760 dm-5
8 0 94371840 sda
[root@localhost ~]# fdisk -l
Disk /dev/nvme0n1: 139.6 GB, 139586437120 bytes, 272629760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ebb37
。。。。。。。。。。。。。
Disk /dev/sda: 96.6 GB, 96636764160 bytes, 188743680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@localhost ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xbcfd5886.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-188743679, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-188743679, default 188743679): +30G
Partition 1 of type Linux and of size 30 GiB is set
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (62916608-188743679, default 62916608):
Using default value 62916608
Last sector, +sectors or +size{K,M,G} (62916608-188743679, default 188743679): +30G
Partition 2 of type Linux and of size 30 GiB is set
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3):
First sector (125831168-188743679, default 125831168):
Using default value 125831168
Last sector, +sectors or +size{K,M,G} (125831168-188743679, default 188743679): +30G
Value out of range.
Last sector, +sectors or +size{K,M,G} (125831168-188743679, default 188743679):
Using default value 188743679
Partition 3 of type Linux and of size 30 GiB is set
-------------------------------
Disk /dev/sda: 102.0 GB, 102005473280 bytes, 199229440 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xbcfd5886
Device Boot Start End Blocks Id System
/dev/sda1 2048 62916607 31457280 83 Linux
/dev/sda2 62916608 125831167 31457280 83 Linux
/dev/sda3 125831168 188745727 31457280 83 Linux
/dev/sda4 188745728 199229439 5241856 83 Linux
-----------------------------------------------------------------------
[root@localhost ~]# cat /proc/partitions
major minor #blocks name
259 0 136314880 nvme0n1
259 1 1048576 nvme0n1p1
259 2 135265280 nvme0n1p2
11 0 1048575 sr0
253 0 20971520 dm-0
253 1 8257536 dm-1
8 0 99614720 sda
8 1 31457280 sda1
8 2 31457280 sda2
8 3 31457280 sda3
8 4 5241856 sda4
253 2 11653120 dm-2
253 3 41943040 dm-3
253 4 41943040 dm-4
253 5 10485760 dm-5
2.2安装asm 软件
[root@localhost ~]# yum install oracleasm-support.x86_64
[root@localhost ~]# yum install kmod-oracleasm.x86_64
wget -O oracleasmlib-2.0.12-1.el7.x86_64.rpm https://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.12-1.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm
2.3.配置asm
[root@localhost ~]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: asmdba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
2.4asm初始化
[root@localhost ~]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm
2.5asm添加磁盘
[root@localhost ~]# oracleasm createdisk DATA /dev/sda1
Writing disk header: done
Instantiating disk: done
[root@localhost ~]# oracleasm createdisk DATA /dev/sda2
Disk "DATA" already exists
[root@localhost ~]# oracleasm createdisk DATA1 /dev/sda2
Writing disk header: done
Instantiating disk: done
[root@localhost ~]# oracleasm createdisk DATA2 /dev/sda3
Writing disk header: done
Instantiating disk: done
[root@localhost ~]# ls -l /dev/oracleasm/disks
total 0
brw-rw----. 1 oracle dba 8, 1 Sep 7 19:33 DATA
brw-rw----. 1 oracle dba 8, 2 Sep 7 19:34 DATA1
brw-rw----. 1 oracle dba 8, 3 Sep 7 19:34 DATA2
2.6检查oracle和grid所属组,oracle及grid bin目录oracle文件权限,设置oracleasm磁盘权限
cd /dev/oracleasm/disks/
chmod 766 ./*
----------------------------
[root@localhost disks]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54
330(racdba),54327(asmdba)
[root@localhost disks]# id grid
uid=54322(grid) gid=54321(oinstall) groups=54321(oinstall),54330(racdba),54329(asmadmin),54327(asmdba)
------------------------------------------------------------------------------
node1:
cd $GRID_HOME/bin
ls -l oracle
-rwsr-s--x 1 grid oinstall 209914519 9月 7 14:40 oracle 文件权限正确
node2:
ls -lrt oralce
-rwxr-x--x 1 grid oinstall 209914519 9月 7 14:42 oracle 文件权限错误
oracle用户:
cd $ORACLE_HOME/bin
ls -l oracle
node1:
-rwsr-s--x 1 oracle asmadmin 239626689 9月 7 15:56 oracle 正确
node2:
-rwsr-s--x 1 oracle asmadmin 239626689 9月 7 16:04 oracle 正确
在node2的,GRID_HOME/bin目录下,oracle文件权限错误
修改:
chmod +s oracle
安装检查提示cvuqdisk缺失,此文件在grid安装目录下
@bogon grid_base]# find /app/grid/ -name '*cvuqdisk*'
/app/grid/.patch_storage/28090553_Jul_11_2018_19_20_31/files/cv/remenv/cvuqdisk-1.0.10-1.rpm
/app/grid/.patch_storage/28090553_Jul_11_2018_19_20_31/files/cv/rpm/cvuqdisk-1.0.10-1.rpm
/app/grid/cv/remenv/cvuqdisk-1.0.10-1.rpm
/app/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm
[root@bogon grid_base]# cd /app/grid/cv/
admin/ cvdata/ cvutl/ remenv/ rpm/
[root@bogon grid_base]# rpm -ivh /app/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm
Preparing... ################################# [100%]
Updating / installing...
1:cvuqdisk-1.0.10-1 ################################# [100%]
关闭+ASM实例
su - grid
sqlplus / as sysasm
shutdown immediate;
grid安装完后创建pfile和spfile
sqlplus / as sysasm
create pfile from memory;
shutdown immediate;
create spfile from pfile;
ORA-15110: no diskgroups mounted
SQL> alter system set asm_diskgroups=DATA scope=both;