back to notes

ASM Add disk to diskgroup

# Comprobamos cuántos discos hay 'marcados' a nivel de sistema operativo como discos de uso para la instancia ASM:

[root@data900pd0 dev]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...

[root@data900pd0 dev]# oracleasm listdisks
ARCH1
ARCH2
DATOS1
DATOS2
DATOS3
DATOS4
DATOS5
DATOS6
DATOS7
DATOS8
DATOS9

# Hay que identificar el nuevo disco de 100G que han añadido y que NO está particionado:

[root@data900pd0 dev]# cat /proc/partitions | grep sd
8 0 116391936 sda
8 1 104391 sda1
8 2 116286502 sda2
8 16 104857600 sdb
8 17 104856223 sdb1
8 32 104857600 sdc
8 33 104856223 sdc1
8 48 104857600 sdd
8 49 104856223 sdd1
8 64 104857600 sde
8 65 104856223 sde1
8 96 104857600 sdg
8 97 104856223 sdg1
8 80 104857600 sdf
8 81 104856223 sdf1
8 112 104857600 sdh
8 113 104856223 sdh1
8 128 104857600 sdi
8 129 104856223 sdi1
8 160 71303168 sdk
8 161 71296438 sdk1
8 144 104857600 sdj
8 145 104856223 sdj1
8 176 71303168 sdl
8 177 71296438 sdl1
8 192 104857600 sdm

# Una vez identificado lo particionamos:

[root@data900pd0 dev]# fdisk /dev/sdm
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 13054.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054):
Using default value 13054

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@data900pd0 dev]# fdisk -l /dev/sdm

Disk /dev/sdm: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdm1 1 13054 104856223+ 83 Linux


# Comprobamos el particionado:

[root@data900pd0 dev]# cat /proc/partitions | grep sdm
8 192 104857600 sdm
8 193 104856223 sdm1

# Marcamos el disco como utilizable por ASM:

[root@data900pd0 dev]# oracleasm createdisk DATOS10 /dev/sdm1
Writing disk header: done
Instantiating disk: done

[root@data900pd0 dev]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...

[root@data900pd0 dev]# oracleasm listdisks
ARCH1
ARCH2
DATOS1
DATOS10
DATOS2
DATOS3
DATOS4
DATOS5
DATOS6
DATOS7
DATOS8
DATOS9

# Comprobamos el espacio en los diskgroups ASM ANTES:

[oracle@data900pd0 ~]$ su - grid
Password:
[grid@data900pd0 ~]$ . ./entorno_GRID.sh
[grid@data900pd0 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Thu May 11 10:30:33 2017

Copyright (c) 1982, 2011, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL>
SET LINESIZE 145
SET PAGESIZE 9999
SET VERIFY off
COLUMN group_name FORMAT a20 HEAD 'Disk Group|Name'
COLUMN sector_size FORMAT 99,999 HEAD 'Sector|Size'
COLUMN block_size FORMAT 99,999 HEAD 'Block|Size'
COLUMN allocation_unit_size FORMAT 999,999,999 HEAD 'Allocation|Unit Size'
COLUMN state FORMAT a11 HEAD 'State'
COLUMN type FORMAT a6 HEAD 'Type'
COLUMN total_mb FORMAT 999,999,999 HEAD 'Total Size (MB)'
COLUMN used_mb FORMAT 999,999,999 HEAD 'Used Size (MB)'
COLUMN pct_used FORMAT 999.99 HEAD 'Pct. Used'
break on report on disk_group_name skipcompute sum label "Grand Total: " of total_mb used_mb on report
SQL> SQL>

SELECT
2 name group_name
3 , sector_size sector_size
4 , block_size block_size
5 , allocation_unit_size allocation_unit_size
6 , state state
7 , type type
8 , total_mb total_mb
9 , (total_mb - free_mb) used_mb
10 , ROUND((1- (free_mb / total_mb))*100, 2) pct_used
11 FROM
v$asm_diskgroup
ORDER BY
12 13 14 name
15 /

Disk Group Sector Block Allocation
Name Size Size Unit Size State Type Total Size (MB) Used Size (MB) Pct. Used
-------------------- ------- ------- ------------ ----------- ------ --------------- -------------- ---------
ARCH 512 4,096 1,048,576 MOUNTED EXTERN 139,250 3,832 2.75
DATOS 512 4,096 1,048,576 MOUNTED EXTERN 921,582 885,427 96.08
--------------- --------------
Grand Total: 1,060,832 889,259

#Comprobamos los discos asignados a cada diskgroup en ASM:

SQL> SELECT a.name, b.path, b.name, b.failgroup disk_file_fail_group FROM v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number) ORDER BY a.name;

NAME PATH NAME DISK_FILE_FAIL_GROUP
------------------------------ ---------------------------------------- ------------------------------ ------------------------------
ARCH /dev/oracleasm/disks/ARCH1 ARCH_0000 ARCH_0000
ARCH /dev/oracleasm/disks/ARCH2 ARCH_0001 ARCH_0001
DATOS /dev/oracleasm/disks/DATOS1 DATOS_0000 DATOS_0000
DATOS /dev/oracleasm/disks/DATOS2 DATOS_0001 DATOS_0001
DATOS /dev/oracleasm/disks/DATOS3 DATOS_0002 DATOS_0002
DATOS /dev/oracleasm/disks/DATOS4 DATOS_0003 DATOS_0003
DATOS /dev/oracleasm/disks/DATOS5 DATOS_0004 DATOS_0004
DATOS /dev/oracleasm/disks/DATOS6 DATOS_0005 DATOS_0005
DATOS /dev/oracleasm/disks/DATOS7 DATOS_0006 DATOS_0006
DATOS /dev/oracleasm/disks/DATOS8 DATOS_0007 DATOS_0007
DATOS /dev/oracleasm/disks/DATOS9 DATOS_0008 DATOS_0008
/dev/oracleasm/disks/DATOS10

#Asignamos el disco nuevo al diskgroup DATOS:

SQL> alter diskgroup DATOS ADD DISK '/dev/oracleasm/disks/DATOS10';

SQL> SELECT a.name, b.path, b.name, b.failgroup disk_file_fail_group FROM v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number) ORDER BY a.name, b.name;

NAME PATH NAME DISK_FILE_FAIL_GROUP
------------------------------ ---------------------------------------- ------------------------------ ------------------------------
ARCH /dev/oracleasm/disks/ARCH1 ARCH_0000 ARCH_0000
ARCH /dev/oracleasm/disks/ARCH2 ARCH_0001 ARCH_0001
DATOS /dev/oracleasm/disks/DATOS1 DATOS_0000 DATOS_0000
DATOS /dev/oracleasm/disks/DATOS2 DATOS_0001 DATOS_0001
DATOS /dev/oracleasm/disks/DATOS3 DATOS_0002 DATOS_0002
DATOS /dev/oracleasm/disks/DATOS4 DATOS_0003 DATOS_0003
DATOS /dev/oracleasm/disks/DATOS5 DATOS_0004 DATOS_0004
DATOS /dev/oracleasm/disks/DATOS6 DATOS_0005 DATOS_0005
DATOS /dev/oracleasm/disks/DATOS7 DATOS_0006 DATOS_0006
DATOS /dev/oracleasm/disks/DATOS8 DATOS_0007 DATOS_0007
DATOS /dev/oracleasm/disks/DATOS9 DATOS_0008 DATOS_0008
DATOS /dev/oracleasm/disks/DATOS10 DATOS_0009 DATOS_0009

# En este momento comienza automáticamente el rebalanceo de los datos del diskgroup entre todos los discos disponibles. Comprobamos el nuevo espacio:

SQL> SET LINESIZE 145
SQL> SET PAGESIZE 9999
SQL> SET VERIFY off
COLUMN group_name FORMAT a20 HEAD 'Disk Group|Name'
SQL> SQL> COLUMN sector_size FORMAT 99,999 HEAD 'Sector|Size'
SQL> COLUMN block_size FORMAT 99,999 HEAD 'Block|Size'
SQL> COLUMN allocation_unit_size FORMAT 999,999,999 HEAD 'Allocation|Unit Size'
COLUMN state FORMAT a11 HEAD 'State'
SQL> SQL> COLUMN type FORMAT a6 HEAD 'Type'
SQL> COLUMN total_mb FORMAT 999,999,999 HEAD 'Total Size (MB)'
COLUMN used_mb FORMAT 999,999,999 HEAD 'Used Size (MB)'
SQL> SQL> COLUMN pct_used FORMAT 999.99 HEAD 'Pct. Used'
SQL>
SQL>
SQL>
break on report on disk_group_name skip 1
SQL> SQL> compute sum label "Grand Total: " of total_mb used_mb on report
SQL>
SQL>
SQL> SELECT
2 name group_name
3 , sector_size sector_size
, block_size block_size
4 5 , allocation_unit_size allocation_unit_size
6 , state state
7 , type type
, total_mb total_mb
8 9 , (total_mb - free_mb) used_mb
10 , ROUND((1- (free_mb / total_mb))*100, 2) pct_used
11 FROM
12 v$asm_diskgroup
ORDER BY
13 14 name
15 /

Disk Group Sector Block Allocation
Name Size Size Unit Size State Type Total Size (MB) Used Size (MB) Pct. Used
-------------------- ------- ------- ------------ ----------- ------ --------------- -------------- ---------
ARCH 512 4,096 1,048,576 MOUNTED EXTERN 139,250 4,107 2.95
DATOS 512 4,096 1,048,576 MOUNTED EXTERN 1,023,980 885,429 86.47
--------------- --------------
Grand Total: 1,163,230 889,536


last updated july 2018