1.确认安装组

下面为oracle推荐使用用户组

  1. $ id oracle
  2. uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),
  3. 54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54327(asmdba),54330(racdba)
  4. $ id grid
  5. uid=54331(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),
  6. 54327(asmdba),54328(asmoper),54329(asmadmin),54330(racdba)

1.1.使用oracle预配置添加组时需补充添加下列组

  1. /usr/sbin/groupadd -g 54327 asmdba
  2. /usr/sbin/groupadd -g 54328 asmoper
  3. /usr/sbin/groupadd -g 54329 asmadmin
  4. ---------------------------------------------------
  5. /usr/sbin/groupadd -g 54322 dba
  6. groupadd -g 54323 oper
  7. /usr/sbin/groupadd -g 54324 backupdba
  8. /usr/sbin/groupadd -g 54325 dgdba
  9. /usr/sbin/groupadd -g 54326 kmdba
  10. /usr/sbin/groupadd -g 54330 racdba

1.2.手动创建用户,如果存在则修改

  1. /usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba oracle
  2. 如果用户已存在,则usermod根据需要使用该命令进行修改
  3. /usr/sbin/usermod -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
  4. useradd -u 54322 -g oinstall -G asmadmin,asmdba,racdba,asmoper grid
  5. 如果用户已存在,则usermod根据需要使用该命令进行修改

1.3.示例安装准备

  1. # groupadd -g 54321 oinstall
  2. # groupadd -g 54322 dba1
  3. # groupadd -g 54332 dba2
  4. # groupadd -g 54323 oper1
  5. # groupadd -g 54333 oper2
  6. # groupadd -g 54324 backupdba1
  7. # groupadd -g 54334 backupdba2
  8. # groupadd -g 54325 dgdba1
  9. # groupadd -g 54335 dgdba2
  10. # groupadd -g 54326 kmdba1
  11. # groupadd -g 54336 kmdba2
  12. # groupadd -g 54327 asmdba
  13. # groupadd -g 54328 asmoper
  14. # groupadd -g 54329 asmadmin
  15. # groupadd -g 54330 racdba1
  16. # groupadd -g 54340 racdba2
  17. # useradd -u 54322 -g oinstall -G asmadmin,asmdba,racdba1,racdba2 grid
  18. # useradd -u 54321 -g oinstall -G dba1,backupdba1,dgdba1,kmdba1,asmdba,racdba1,asmoper oracle1
  19. # useradd -u 54323 -g oinstall -G dba2,backupdba2,dgdba2,kmdba2,asmdba,racdba2 oracle2
  20. # mkdir -p /u01/app/19.0.0/grid
  21. # mkdir -p /u01/app/grid
  22. # mkdir -p /u01/app/oracle1
  23. # mkdir -p u01/app/oracle2
  24. # chown -R grid:oinstall /u01
  25. # chmod -R 775 /u01/
  26. # chown oracle1:oinstall /u01/app/oracle1
  27. # chown oracle2:oinstall /u01/app/oracle2

2.对磁盘进行分区,创建磁盘组

2.1对磁盘进行分区

  1. su - root
  2. [root@localhost ~]# cat /proc/partitions
  3. major minor #blocks name
  4. 259 0 136314880 nvme0n1
  5. 259 1 1048576 nvme0n1p1
  6. 259 2 135265280 nvme0n1p2
  7. 11 0 1048575 sr0
  8. 253 0 20971520 dm-0
  9. 253 1 8257536 dm-1
  10. 253 2 11653120 dm-2
  11. 253 3 41943040 dm-3
  12. 253 4 41943040 dm-4
  13. 253 5 10485760 dm-5
  14. 8 0 94371840 sda
  15. [root@localhost ~]# fdisk -l
  16. Disk /dev/nvme0n1: 139.6 GB, 139586437120 bytes, 272629760 sectors
  17. Units = sectors of 1 * 512 = 512 bytes
  18. Sector size (logical/physical): 512 bytes / 512 bytes
  19. I/O size (minimum/optimal): 512 bytes / 512 bytes
  20. Disk label type: dos
  21. Disk identifier: 0x000ebb37
  22. 。。。。。。。。。。。。。
  23. Disk /dev/sda: 96.6 GB, 96636764160 bytes, 188743680 sectors
  24. Units = sectors of 1 * 512 = 512 bytes
  25. Sector size (logical/physical): 512 bytes / 512 bytes
  26. I/O size (minimum/optimal): 512 bytes / 512 bytes
  27. [root@localhost ~]# fdisk /dev/sda
  28. Welcome to fdisk (util-linux 2.23.2).
  29. Changes will remain in memory only, until you decide to write them.
  30. Be careful before using the write command.
  31. Device does not contain a recognized partition table
  32. Building a new DOS disklabel with disk identifier 0xbcfd5886.
  33. Command (m for help): n
  34. Partition type:
  35. p primary (0 primary, 0 extended, 4 free)
  36. e extended
  37. Select (default p): p
  38. Partition number (1-4, default 1): 1
  39. First sector (2048-188743679, default 2048):
  40. Using default value 2048
  41. Last sector, +sectors or +size{K,M,G} (2048-188743679, default 188743679): +30G
  42. Partition 1 of type Linux and of size 30 GiB is set
  43. Command (m for help): n
  44. Partition type:
  45. p primary (1 primary, 0 extended, 3 free)
  46. e extended
  47. Select (default p): p
  48. Partition number (2-4, default 2): 2
  49. First sector (62916608-188743679, default 62916608):
  50. Using default value 62916608
  51. Last sector, +sectors or +size{K,M,G} (62916608-188743679, default 188743679): +30G
  52. Partition 2 of type Linux and of size 30 GiB is set
  53. Command (m for help): n
  54. Partition type:
  55. p primary (2 primary, 0 extended, 2 free)
  56. e extended
  57. Select (default p): p
  58. Partition number (3,4, default 3):
  59. First sector (125831168-188743679, default 125831168):
  60. Using default value 125831168
  61. Last sector, +sectors or +size{K,M,G} (125831168-188743679, default 188743679): +30G
  62. Value out of range.
  63. Last sector, +sectors or +size{K,M,G} (125831168-188743679, default 188743679):
  64. Using default value 188743679
  65. Partition 3 of type Linux and of size 30 GiB is set
  66. -------------------------------
  67. Disk /dev/sda: 102.0 GB, 102005473280 bytes, 199229440 sectors
  68. Units = sectors of 1 * 512 = 512 bytes
  69. Sector size (logical/physical): 512 bytes / 512 bytes
  70. I/O size (minimum/optimal): 512 bytes / 512 bytes
  71. Disk label type: dos
  72. Disk identifier: 0xbcfd5886
  73. Device Boot Start End Blocks Id System
  74. /dev/sda1 2048 62916607 31457280 83 Linux
  75. /dev/sda2 62916608 125831167 31457280 83 Linux
  76. /dev/sda3 125831168 188745727 31457280 83 Linux
  77. /dev/sda4 188745728 199229439 5241856 83 Linux
  78. -----------------------------------------------------------------------
  79. [root@localhost ~]# cat /proc/partitions
  80. major minor #blocks name
  81. 259 0 136314880 nvme0n1
  82. 259 1 1048576 nvme0n1p1
  83. 259 2 135265280 nvme0n1p2
  84. 11 0 1048575 sr0
  85. 253 0 20971520 dm-0
  86. 253 1 8257536 dm-1
  87. 8 0 99614720 sda
  88. 8 1 31457280 sda1
  89. 8 2 31457280 sda2
  90. 8 3 31457280 sda3
  91. 8 4 5241856 sda4
  92. 253 2 11653120 dm-2
  93. 253 3 41943040 dm-3
  94. 253 4 41943040 dm-4
  95. 253 5 10485760 dm-5

2.2安装asm 软件

  1. [root@localhost ~]# yum install oracleasm-support.x86_64
  2. [root@localhost ~]# yum install kmod-oracleasm.x86_64
  3. 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
  4. [root@localhost ~]# rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm

2.3.配置asm

  1. [root@localhost ~]# oracleasm configure -i
  2. Configuring the Oracle ASM library driver.
  3. This will configure the on-boot properties of the Oracle ASM library
  4. driver. The following questions will determine whether the driver is
  5. loaded on boot and what permissions it will have. The current values
  6. will be shown in brackets ('[]'). Hitting <ENTER> without typing an
  7. answer will keep that current value. Ctrl-C will abort.
  8. Default user to own the driver interface []: oracle
  9. Default group to own the driver interface []: asmdba
  10. Start Oracle ASM library driver on boot (y/n) [n]: y
  11. Scan for Oracle ASM disks on boot (y/n) [y]: y
  12. Writing Oracle ASM library driver configuration: done

2.4asm初始化

  1. [root@localhost ~]# oracleasm init
  2. Creating /dev/oracleasm mount point: /dev/oracleasm
  3. Loading module "oracleasm": oracleasm
  4. Configuring "oracleasm" to use device physical block size
  5. Mounting ASMlib driver filesystem: /dev/oracleasm

2.5asm添加磁盘

  1. [root@localhost ~]# oracleasm createdisk DATA /dev/sda1
  2. Writing disk header: done
  3. Instantiating disk: done
  4. [root@localhost ~]# oracleasm createdisk DATA /dev/sda2
  5. Disk "DATA" already exists
  6. [root@localhost ~]# oracleasm createdisk DATA1 /dev/sda2
  7. Writing disk header: done
  8. Instantiating disk: done
  9. [root@localhost ~]# oracleasm createdisk DATA2 /dev/sda3
  10. Writing disk header: done
  11. Instantiating disk: done
  12. [root@localhost ~]# ls -l /dev/oracleasm/disks
  13. total 0
  14. brw-rw----. 1 oracle dba 8, 1 Sep 7 19:33 DATA
  15. brw-rw----. 1 oracle dba 8, 2 Sep 7 19:34 DATA1
  16. brw-rw----. 1 oracle dba 8, 3 Sep 7 19:34 DATA2

2.6检查oracle和grid所属组,oracle及grid bin目录oracle文件权限,设置oracleasm磁盘权限

  1. cd /dev/oracleasm/disks/
  2. chmod 766 ./*
  3. ----------------------------
  4. [root@localhost disks]# id oracle
  5. uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54
  6. 330(racdba),54327(asmdba)
  7. [root@localhost disks]# id grid
  8. uid=54322(grid) gid=54321(oinstall) groups=54321(oinstall),54330(racdba),54329(asmadmin),54327(asmdba)
  9. ------------------------------------------------------------------------------
  10. node1:
  11. cd $GRID_HOME/bin
  12. ls -l oracle
  13. -rwsr-s--x 1 grid oinstall 209914519 9月 7 14:40 oracle 文件权限正确
  14. node2:
  15. ls -lrt oralce
  16. -rwxr-x--x 1 grid oinstall 209914519 9月 7 14:42 oracle 文件权限错误
  17. oracle用户:
  18. cd $ORACLE_HOME/bin
  19. ls -l oracle
  20. node1:
  21. -rwsr-s--x 1 oracle asmadmin 239626689 9月 7 15:56 oracle 正确
  22. node2:
  23. -rwsr-s--x 1 oracle asmadmin 239626689 9月 7 16:04 oracle 正确
  24. 在node2的,GRID_HOME/bin目录下,oracle文件权限错误
  25. 修改:
  26. chmod +s oracle

安装检查提示cvuqdisk缺失,此文件在grid安装目录下

  1. @bogon grid_base]# find /app/grid/ -name '*cvuqdisk*'
  2. /app/grid/.patch_storage/28090553_Jul_11_2018_19_20_31/files/cv/remenv/cvuqdisk-1.0.10-1.rpm
  3. /app/grid/.patch_storage/28090553_Jul_11_2018_19_20_31/files/cv/rpm/cvuqdisk-1.0.10-1.rpm
  4. /app/grid/cv/remenv/cvuqdisk-1.0.10-1.rpm
  5. /app/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm
  6. [root@bogon grid_base]# cd /app/grid/cv/
  7. admin/ cvdata/ cvutl/ remenv/ rpm/
  8. [root@bogon grid_base]# rpm -ivh /app/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm
  9. Preparing... ################################# [100%]
  10. Updating / installing...
  11. 1:cvuqdisk-1.0.10-1 ################################# [100%]

关闭+ASM实例

  1. su - grid
  2. sqlplus / as sysasm
  3. shutdown immediate;

grid安装完后创建pfile和spfile

  1. sqlplus / as sysasm
  2. create pfile from memory;
  3. shutdown immediate;
  4. create spfile from pfile;

ORA-15110: no diskgroups mounted

  1. SQL> alter system set asm_diskgroups=DATA scope=both;