asmlib创建的磁盘在线扩容

说明

本环境的asm磁盘是通过asmlib创建的,不适用于scsi的磁盘。

新增磁盘为/dev/xvdd

操作过程

分区

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[root@srm-db ~]# fdisk /dev/xvdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x36af11d0.
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): 1
First cylinder (1-65270, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270):
Using default value 65270
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@srm-db ~]#

查看现有ASM磁盘

1
2
3
[root@srm-db ~]# oracleasm listdisks
DATA
DATA2

添加新的asm磁盘

1
2
3
4
5
6
7
8
[root@srm-db ~]# oracleasm createdisk DATA3 /dev/xvdd1
Writing disk header: done
Instantiating disk: done
[root@srm-db ~]# oracleasm listdisks
DATA
DATA2
DATA3
[root@srm-db ~]#

查看数据库中记录的asm磁盘

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[root@srm-db ~]# su - grid
[grid@srm-db ~]$ sqlplus / as sysasm
SQL*Plus: Release 12.2.0.1.0 Production on Thu Jan 11 19:42:07 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select name, path, mode_status, state, disk_number,failgroup from v$asm_disk;
NAME
------------------------------
PATH
--------------------------------------------------------------------------------
MODE_ST STATE DISK_NUMBER FAILGROUP
------- -------- ----------- ------------------------------
/dev/oracleasm/disks/DATA3
ONLINE NORMAL 0
DATA_0000
/dev/oracleasm/disks/DATA
ONLINE NORMAL 0 DATA_0000
NAME
------------------------------
PATH
--------------------------------------------------------------------------------
MODE_ST STATE DISK_NUMBER FAILGROUP
------- -------- ----------- ------------------------------
DATA_0001
/dev/oracleasm/disks/DATA2
ONLINE NORMAL 1 DATA_0001
SQL>

新增的asm磁盘为/dev/oracleasm/disks/DATA3

查看磁盘组名称

1
2
3
4
5
6
7
8
SQL> select group_number,name,TOTAL_MB, FREE_MB from v$asm_diskgroup
2 ;
GROUP_NUMBER NAME TOTAL_MB FREE_MB
------------ ------------------------------ ---------- ----------
1 DATA 1023988 36588
SQL>

DATA磁盘组就是要扩容的磁盘组

扩容DATA磁盘组

1
2
3
4
5
6
SQL> alter diskgroup DATA add disk '/dev/oracleasm/disks/DATA3' rebalance power 10;
Diskgroup altered.
SQL>

观察reblance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA PASS STAT POWER ACTUAL SOFAR EST_WORK
------------ ----- --------- ---- ---------- ---------- ---------- ----------
EST_RATE EST_MINUTES ERROR_CODE CON_ID
---------- ----------- -------------------------------------------- ----------
1 REBAL COMPACT WAIT 10 10 0 0
0 0 0
1 REBAL REBALANCE RUN 10 10 5531 82304
2268 33 0
1 REBAL REBUILD DONE 10 10 0 0
0 0 0
SQL>

当没有输出时,则表明reblance完成

修改reblance power

1
ALTER DISKGROUP DATA REBALANCE POWER 1;