环境:
OS:Centos 7
db:12CR2
1.主机层面加盘
虚拟机加盘需要停掉数据库和主句,生产环境之间划分lun给到主机,不需要重启.
multipath -ll 找到新加磁盘的UUID
2.配置多路径
每个节点上都要操作
[root@rac02 ~]# more /etc/multipath.conf blacklist { devnode "^sda" } defaults { user_friendly_names yes path_grouping_policy multibus failback immediate no_path_retry fail } multipaths { multipath { wwid VBOX_HARDDISK_VB00234d6f-80cec2bf alias ocrdisk01 path_grouping_policy multibus } multipath { wwid VBOX_HARDDISK_VBbad719ae-a07de7a5 alias datadisk01 path_grouping_policy multibus } multipath { wwid VBOX_HARDDISK_VB76f10276-8a519e24 alias redodisk01 path_grouping_policy multibus } multipath { wwid VBOX_HARDDISK_VBbee132b8-6b532b27 alias datadisk02 path_grouping_policy multibus } multipath { wwid VBOX_HARDDISK_VB20c3a1a6-36f1c22d alias redodisk02 path_grouping_policy multibus } }
3.多路径重新加载
[root@rac01 ~]# multipath -r
[root@rac02 ~]# multipath -r
4.修改设备权限
修改文件/etc/udev/rules.d/99-oracle-asmdevices.rules
2个节点都需要操作
[root@rac01 rules.d]# more 99-oracle-asmdevices.rules ENV{DM_NAME}=="ocrdisk01", OWNER:="grid", GROUP:="asmadmin", MODE:="660" ENV{DM_NAME}=="datadisk01", OWNER:="grid", GROUP:="asmadmin", MODE:="660" ENV{DM_NAME}=="redodisk01", OWNER:="grid", GROUP:="asmadmin", MODE:="660" ENV{DM_NAME}=="datadisk02", OWNER:="grid", GROUP:="asmadmin", MODE:="660" ENV{DM_NAME}=="redodisk02", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
重新加载规则文件(磁盘权限修改为grid)
2个节点都需要操作
[root@rac01 rules.d]# ls -al /dev/dm* brw-rw---- 1 root disk 253, 0 Apr 23 17:40 /dev/dm-0 brw-rw---- 1 grid asmadmin 253, 1 Apr 23 18:21 /dev/dm-1 brw-rw---- 1 root disk 253, 2 Apr 23 18:17 /dev/dm-2 brw-rw---- 1 grid asmadmin 253, 3 Apr 23 18:21 /dev/dm-3 brw-rw---- 1 grid asmadmin 253, 4 Apr 23 18:21 /dev/dm-4 brw-rw---- 1 root disk 253, 5 Apr 23 18:17 /dev/dm-5
[root@rac01 rules.d]# udevadm trigger
若该命令不管用,可以执行如下命令
[root@localhost ~]#/sbin/udevadm control --reload
[root@localhost ~]# /sbin/udevadm trigger --type=devices --action=change
[root@localhost bin]# udevadm trigger
5.加盘
在其中一个节点操作即可,必须使用sysasm方式登录,如下步骤相同
su - grid connect / as sysasm set linesize 1000; column group_number format 99; column name format a16; column path format a32; column total_mb format 999999999; column free_mb format 999999999; column mount_status format a16; column header_status format a16; column mode_status format a16; SQL> select group_number,name,path,total_mb,free_mb,mount_status,header_status,mode_status from v$asm_disk order by group_number desc; GROUP_NUMBER NAME PATH TOTAL_MB FREE_MB MOUNT_STATUS HEADER_STATUS MODE_STATUS ------------ ---------------- -------------------------------- ---------- ---------- ---------------- ---------------- ---------------- 3 REDO_0000 /dev/mapper/redodisk01 10240 9348 CACHED MEMBER ONLINE 2 OCR_0000 /dev/mapper/ocrdisk01 40960 6420 CACHED MEMBER ONLINE 1 DATA_0000 /dev/mapper/datadisk01 10240 2980 CACHED MEMBER ONLINE 0 /dev/mapper/redodisk02 0 0 CLOSED CANDIDATE ONLINE 0 /dev/mapper/datadisk02 0 0 CLOSED CANDIDATE ONLINE SQL> select group_number,name,state,type,total_mb,free_mb from v$asm_diskgroup; GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB ------------ ---------------- ---------------------- ------------ ---------- ---------- 1 DATA MOUNTED EXTERN 10240 2980 2 OCR MOUNTED EXTERN 40960 6420 3 REDO MOUNTED EXTERN 10240 9348 SQL> alter diskgroup DATA add disk '/dev/mapper/datadisk02'; Diskgroup altered. SQL> alter diskgroup REDO add disk '/dev/mapper/redodisk02'; Diskgroup altered.
6.磁盘均衡(rebalance)
只在一个节点上操作
SQL>alter diskgroup DATA rebalance power 4; SQL>alter diskgroup REDO rebalance power 4; 查看进度: SQL> select * from v$asm_operation; no rows selected
7.剔除旧磁盘
只在一个节点上操作
SQL> alter diskgroup DATA drop disk 'DATA_0000'; Diskgroup altered. SQL> alter diskgroup REDO drop disk 'REDO_0000'; Diskgroup altered.
剔除后查看磁盘状态,需要等待一会MOUNT_STATUS状态才会变成closed
SQL> select group_number,name,path,total_mb,free_mb,mount_status,header_status,mode_status from v$asm_disk order by group_number desc; GROUP_NUMBER NAME PATH TOTAL_MB FREE_MB MOUNT_STATUS HEADER_STATUS MODE_STATUS ------------ ---------------- -------------------------------- ---------- ---------- ---------------- ---------------- ---------------- 3 REDO_0001 /dev/mapper/redodisk02 10240 9348 CACHED MEMBER ONLINE 2 OCR_0000 /dev/mapper/ocrdisk01 40960 6420 CACHED MEMBER ONLINE 1 DATA_0001 /dev/mapper/datadisk02 10240 2980 CACHED MEMBER ONLINE 0 /dev/mapper/datadisk01 0 0 CLOSED FORMER ONLINE 0 /dev/mapper/redodisk01 0 0 CLOSED FORMER ONLINE
8.回收磁盘
修改多路径配置并reload和修改udev权限规则文件,把剔除的盘去掉.
9.说明
建议添加的磁盘大小与原有的大小保持一致,不过比原来磁盘大或是小一些(空间大小能能存储原有数据的情况下)也是可以的.
标签:mapper,RAC,dev,grid,SQL,oracle,path,加盘,root From: https://www.cnblogs.com/hxlasky/p/18153269