fdisk -l |grep /dev/sd
# fdisk -l |grep /dev/sd
Disk /dev/sda: 53.7 GB, 53687091200 bytes
/dev/sda1 * 1 64 512000 83 Linux
/dev/sda2 64 6528 51915776 8e Linux LVM
Disk /dev/sdd: 1073 MB, 1073741824 bytes
Disk /dev/sdc: 1073 MB, 1073741824 bytes
Disk /dev/sde: 10.7 GB, 10737418240 bytes
Disk /dev/sdf: 10.7 GB, 10737418240 bytes
Disk /dev/sdb: 1073 MB, 1073741824 bytes
Disk /dev/sdg: 1073 MB, 1073741824 bytes
#
最后一块
/dev/sdg
是新加的1g磁盘,确认无误
pvscan
或 pvs
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_root lvm2 a--u 49.51g 0
#
目地是防止磁盘创建了pv被加到其他vg组中
df -h
或 df -l
# df -h
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root ext4 15G 5.3G 8.7G 38% /
tmpfs tmpfs 1.9G 159M 1.7G 9% /dev/shm
/dev/sda1 ext4 477M 84M 364M 19% /boot
/dev/mapper/vg_root-lv_home ext4 2.0G 4.6M 1.8G 1% /home
/dev/mapper/vg_root-lv_tmp ext4 976M 1.4M 908M 1% /tmp
/dev/mapper/vg_root-lv_data ext4 26G 19G 6.1G 76% /u01
/dev/mapper/vg_root-lv_var ext4 976M 95M 815M 11% /var
#
目地也是防止磁盘格式化后被直接挂载到了目录上
# /sbin/scsi_id -g -u -d /dev/sdg
36000c29f763f520fdf769677fff2a9b4
#
在UDEV规则文件中搜索此UUID确认该磁盘还未添加到其中,规则文件目录
/etc/udev/rules.d
ll /dev/asm*
# ll /dev/asm*
brw-rw---- 1 grid asmadmin 3 Jun 12 03:25 /dev/asm-arch-01
brw-rw---- 1 grid asmadmin 3 Jun 12 03:24 /dev/asm-grid-01
brw-rw---- 1 grid asmadmin 3 Jun 12 03:15 /dev/asm-grid-02
brw-rw---- 1 grid asmadmin 3 Jun 12 03:15 /dev/asm-grid-03
brw-rw---- 1 grid asmadmin 3 Jun 12 03:25 /dev/asm-data-01
下一块data盘应该命名为 “asm-data-02”
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/%k", RESULT=="36000c29f763f520fdf769677fff2a9b4", NAME="asm-data-02", OWNER="grid", GROUP="asmadmin", MODE="0660"
先查看原来
/etc/udev/rules.d
目录中的规则文件,复制其中一条并改写“UUID”
和asm磁盘的“NAME“
start_udev
此处需要特别注意,在集群某个节点重启udev可能会导致该节点的vip切换到其他节点上,所以在重新加载udev文件之后一定要查看好vip状态
(1)查看集群状态
# su - grid
$ crs_stat -t
-------------------------------------------------------------
[+ASM2][grid@dataresource-db2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DG_ARCH.dg ora....up.type ONLINE ONLINE data...-db1
ora.DG_DATA.dg ora....up.type ONLINE ONLINE data...-db1
ora.DG_GRID.dg ora....up.type ONLINE ONLINE data...-db1
ora....ER.lsnr ora....er.type ONLINE ONLINE data...-db1
ora....N1.lsnr ora....er.type ONLINE ONLINE data...-db2
ora.asm ora.asm.type ONLINE ONLINE data...-db1
ora.cvu ora.cvu.type ONLINE ONLINE data...-db2
ora....SM1.asm application ONLINE ONLINE data...-db1
ora....B1.lsnr application ONLINE ONLINE data...-db1
ora....db1.gsd application OFFLINE OFFLINE
ora....db1.ons application ONLINE ONLINE data...-db1
ora....db1.vip ora....t1.type ONLINE ONLINE data...-db1 #节点一vip正常
ora....SM2.asm application ONLINE ONLINE data...-db2
ora....B2.lsnr application ONLINE OFFLINE
ora....db2.gsd application OFFLINE OFFLINE
ora....db2.ons application ONLINE ONLINE data...-db2
ora....db2.vip ora....t1.type ONLINE ONLINE data...-db1 #节点二的vip在节点一的主机上
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE data...-db1
ora.oc4j ora.oc4j.type ONLINE ONLINE data...-db2
ora.ons ora.ons.type ONLINE ONLINE data...-db1
ora....ry.acfs ora....fs.type ONLINE ONLINE data...-db1
ora.scan1.vip ora....ip.type ONLINE ONLINE data...-db2
ora....jcdb.db ora....se.type ONLINE ONLINE data...-db1
ora....ccx.svc ora....ce.type ONLINE ONLINE data...-db1
ora.testdb.db ora....se.type ONLINE OFFLINE
[+ASM2][grid@dataresource-db2 ~]$
检查vip发现第二个节点的vip飘到了节点一上
(2)查看所有节点vip的全名(将vip切换回源节点需要)
[+ASM2][grid@dataresource-db2 ~]$ crs_stat|grep vip
NAME=ora.dataresource-db1.vip
TYPE=ora.cluster_vip_net1.type
NAME=ora.dataresource-db2.vip
TYPE=ora.cluster_vip_net1.type
NAME=ora.scan1.vip
TYPE=ora.scan_vip.type
[+ASM2][grid@dataresource-db2 ~]$
(3)将节点二vip切换到节点二主机
crs_relocate ora.hostname.vip
[+ASM2][grid@dataresource-db2 ~]$ crs_relocate ora.dataresource-db2.vip
Attempting to stop `ora.dataresource-db2.vip` on member `dataresource-db1`
Stop of `ora.dataresource-db2.vip` on member `dataresource-db1` succeeded.
Attempting to start `ora.dataresource-db2.vip` on member `dataresource-db2`
Start of `ora.dataresource-db2.vip` on member `dataresource-db2` succeeded.
Attempting to start `ora.LISTENER.lsnr` on member `dataresource-db2`
Start of `ora.LISTENER.lsnr` on member `dataresource-db2` succeeded.
再次查看集群状态:
[+ASM2][grid@dataresource-db2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DG_ARCH.dg ora....up.type ONLINE ONLINE data...-db1
ora.DG_DATA.dg ora....up.type ONLINE ONLINE data...-db1
ora.DG_GRID.dg ora....up.type ONLINE ONLINE data...-db1
ora....ER.lsnr ora....er.type ONLINE ONLINE data...-db1
ora....N1.lsnr ora....er.type ONLINE ONLINE data...-db2
ora.asm ora.asm.type ONLINE ONLINE data...-db1
ora.cvu ora.cvu.type ONLINE ONLINE data...-db2
ora....SM1.asm application ONLINE ONLINE data...-db1
ora....B1.lsnr application ONLINE ONLINE data...-db1
ora....db1.gsd application OFFLINE OFFLINE
ora....db1.ons application ONLINE ONLINE data...-db1
ora....db1.vip ora....t1.type ONLINE ONLINE data...-db1
ora....SM2.asm application ONLINE ONLINE data...-db2
ora....B2.lsnr application ONLINE ONLINE data...-db2
ora....db2.gsd application OFFLINE OFFLINE
ora....db2.ons application ONLINE ONLINE data...-db2
ora....db2.vip ora....t1.type ONLINE ONLINE data...-db2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE data...-db1
ora.oc4j ora.oc4j.type ONLINE ONLINE data...-db2
ora.ons ora.ons.type ONLINE ONLINE data...-db1
ora....ry.acfs ora....fs.type ONLINE ONLINE data...-db1
ora.scan1.vip ora....ip.type ONLINE ONLINE data...-db2
ora....jcdb.db ora....se.type ONLINE ONLINE data...-db1
ora....ccx.svc ora....ce.type ONLINE ONLINE data...-db1
ora.testdb.db ora....se.type ONLINE OFFLINE
[+ASM2][grid@dataresource-db2 ~]$
所有节点vip恢复正常
[root@ceshi1 ~]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 3 Jun 12 03:25 /dev/asm-arch-01
brw-rw---- 1 grid asmadmin 3 Jun 12 03:24 /dev/asm-grid-01
brw-rw---- 1 grid asmadmin 3 Jun 12 03:15 /dev/asm-grid-02
brw-rw---- 1 grid asmadmin 3 Jun 12 03:15 /dev/asm-grid-03
brw-rw---- 1 grid asmadmin 3 Jun 12 03:25 /dev/asm-data-01
brw-rw---- 1 grid asmadmin 8 Jun 12 03:56 /dev/asm-data-02
asm-data-02磁盘添加成功
注意,以上操作所有节点都要执行!!!
将asm磁盘加入asm磁盘组DATA的两种方式:
# su - grid
$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Sat Jun 12 04:02:54 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL>
set lines 200
col NAME for a15
col PATH for a50
select name,path,state,mount_status,header_status from v$asm_disk order by NAME;
#也可以在将共享存储添加到asm磁盘时添加重新平衡功率
alter session set asm_power_limit=11;
或
alter system set asm_power_limit=11;
平衡磁盘所用的平衡功率(默认值为1,最大为11,用大功率值平衡磁盘时十分消耗磁盘IO,,建议在服务器空闲时添加磁盘并进行再平衡)
SQL> ALTER DISKGROUP DATA ADD DISK '/dev/asm-data-02' rebalance power 11 wait;
Diskgroup altered.
SQL>
若想连续添加多块磁盘,如下,此时还可以给磁盘命名。
ALTER DISKGROUP data1 ADD DISK
'/dev/disk1' NAME disk1,
'/dev/disk2' NAME disk2,
'/dev/disk3' NAME disk3,
'/dev/disk4' NAME disk4;
WAIT
参数的作用和示例:
若有磁盘/dev/disk1至/dev/disk5,并将该5块磁盘添加到磁盘中data中,以11的重新平衡功率运行,
并且在重新平衡操作完成之前不会返回,加上“REBALANCE POWER 11 WAIT”字句即可。
如下:
ALTER DISKGROUP data ADD DISK
'/dev/disk*'
REBALANCE POWER 11 WAIT;
FORCE
参数的作用和示例:
如果/dev/disk4之前是已经不存在的磁盘组data4的成员,则可以使用FORCE选项将该磁盘添加为另一个磁盘组的成员。
例如,下面使用FORCE子句可以将/dev/disk4添加到data3,即使它是data4的当前成员,要使此语句成功,data4磁盘组不能挂载。
ALTER DISKGROUP data3 ADD DISK
'/dev/disk4' FORCE;
set lines 200
col ERROR_CODE for a30
select * from gv$asm_operation;
在磁盘组做完REBALANCE 之后该表为空
SHOW PARAMETER ASM_POWER_LIMIT
SQL> select group_number,name,total_mb,free_mb,state from v$asm_diskgroup;
GROUP_NUMBER NAME TOTAL_MB FREE_MB STATE
------------- ------- ---------- --------- --------------------------
0 ARCH 0 0 DISMOUNTED
2 DATA 11264 4698 MOUNTED
3 OCR 3072 2146 MOUNTED
SQL>
原来DATA磁盘组的总容量为10g,现在为11g,成功添加1g
至此结束,有什么问题欢迎留言,谢谢。