domingo, 26 de outubro de 2014

Adicionando disco a um ASM Diskgroup

Esta sendo demonstrado neste post como adicionar um disco ao Disk Group do Oracle ASM.

Primeiramente a instancia do ASM deve ser capaz de enxergar o disco como canditado.

Formatar Unidade


Formatar os discos candidatos no SO, no caso temos dois novos discos sem nenhuma partição valida, /dev/sdo e /dev/sdp, Abaixo demonstra de maneira rapida como formatar o dsico com fdisk, porém ha um post um pouco mais detalhado a respeito em Formatando disco no Linux.

fdisk -l 
.......

Disk /dev/sdo: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdo doesn't contain a valid partition table

Disk /dev/sdp: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
......

[root@ol5-112-rac1 ~]# fdisk /dev/sdo
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.

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-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):
Using default value 652

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

Calling ioctl() to re-read partition table.
Syncing disks.



Criar o Label do disco Através do ASMLIB


1 Validar se o disco não possui nenhum label atrelado:

[root@ol5-112-rac2 ~]# oracleasm querydisk /dev/sdo1
Device "/dev/sdo1" is not marked as an ASM disk

2 Criar novo label para o disco

[root@ol5-112-rac2 ~]# oracleasm createdisk DISK_DATA05 /dev/sdo1
Writing disk header: done
Instantiating disk: done

3 Validar se o disco se encontra acessivel em ambos os nodes (Caso de Cluster)

[root@ol5-112-rac1 ~]#  oracleasm querydisk /dev/sdo1
Device "/dev/sdo1" is marked an ASM disk with the label "DISK_DATA05"

[root@ol5-112-rac2 ~]# oracleasm querydisk /dev/sdo1
Device "/dev/sdo1" is marked an ASM disk with the label "DISK_DATA05"

4 Identificar o label do ASMLIB em ambos os nodes com

[root@ol5-112-rac1 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "DISK_DATA05"
Instantiating disk "DISK_DATA06"

[root@ol5-112-rac2 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...


Validar se os dicos aparecem como candidatos ou PROVISIONED em ambos os nodes do RAC

SQL> column path format a20
set lines 132
set pages 50

select path, group_number group_#, disk_number disk_#, mount_status,
       header_status, state, total_mb, free_mb
from v$asm_disk
order by group_number;SQL> SQL> SQL> SQL>   2    3    4

PATH                    GROUP_#     DISK_# MOUNT_S HEADER_STATU STATE      TOTAL_MB    FREE_MB
-------------------- ---------- ---------- ------- ------------ -------- ---------- ----------
ORCL:DISK_DATA05              0          0 CLOSED  PROVISIONED  NORMAL            0          0
ORCL:DISK_DATA06              0          1 CLOSED  PROVISIONED  NORMAL            0          0
ORCL:DISK_CRS_01              1          0 CACHED  MEMBER       NORMAL         1019        709
ORCL:DISK_CRS_02              1          1 CACHED  MEMBER       NORMAL         1019        711
ORCL:DISK_CRS_03              1          2 CACHED  MEMBER       NORMAL         1019        711
ORCL:DISK_DATA01              2          0 CACHED  MEMBER       NORMAL         5114       4178
ORCL:DISK_DATA02              2          1 CACHED  MEMBER       NORMAL         5114       4180
ORCL:DISK_DATA04              2          3 CACHED  MEMBER       NORMAL         5114       4170
ORCL:DISK_DATA03              2          2 CACHED  MEMBER       NORMAL         5114       4183
ORCL:DISK_FRA01               3          0 CACHED  MEMBER       NORMAL         5114       4521
ORCL:DISK_FRA03               3          2 CACHED  MEMBER       NORMAL         5114       4519
ORCL:DISK_FRA02               3          1 CACHED  MEMBER       NORMAL         5114       4521
ORCL:DISK_FRA04               3          3 CACHED  MEMBER       NORMAL         5114       4517

13 rows selected.


Portanto agora podemos adicionar os discos no DG desejado, pois esta visivel em ambos servidores.

Adicionando o disco ao ASM Group


1 Validar valor do parametro asm_power_limit

SQL> show parameter power

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_power_limit                      integer     1
SQL>

2 Adicionando o disco ao DG, esta operacao pode ser feita ainda com diversos parametros, como fazer com um power limit maior que o da instancia, configurar o failgroup e o nome doo disco:

SQL> ALTER DISKGROUP DG_DATA ADD DISK
     'ORCL:DISK_DATA05',
     'ORCL:DISK_DATA06';
SQL>   2    3

Diskgroup altered.

3 Após o disco ser considerado como adicionado ao DG, o tempo de rebalance pode ser medido atraves da consulta:

SQL>  select INST_ID, OPERATION, STATE, POWER, SOFAR, EST_WORK, EST_RATE, EST_MINUTES from GV$ASM_OPERATION where GROUP_NUMBER=2;


   INST_ID OPERA STAT      POWER      SOFAR   EST_WORK   EST_RATE EST_MINUTES
---------- ----- ---- ---------- ---------- ---------- ---------- -----------
         2 REBAL WAIT          1
         1 REBAL RUN           1       1175       1644        389           1

SQL>

4 Verificar se o disco já faz parte do Diskgroup

SQL> SQL> column path format a20
set lines 132
set pages 50
SP2-0734:
unknown command beginning "SQL> colum..." - rest of line ignored.
select path, group_number group_#, disk_number disk_#, mount_status,
       header_status, state, total_mb, free_mb
SQL> from v$asm_disk
order by group_number;SQL> SQL> SQL> SQL>   2    3    4

PATH                    GROUP_#     DISK_# MOUNT_S HEADER_STATU STATE      TOTAL_MB    FREE_MB
-------------------- ---------- ---------- ------- ------------ -------- ---------- ----------
ORCL:DISK_CRS_03              1          2 CACHED  MEMBER       NORMAL         1019        711
ORCL:DISK_CRS_02              1          1 CACHED  MEMBER       NORMAL         1019        711
ORCL:DISK_CRS_01              1          0 CACHED  MEMBER       NORMAL         1019        709
ORCL:DISK_DATA03              2          2 CACHED  MEMBER       NORMAL         5114       4481
ORCL:DISK_DATA02              2          1 CACHED  MEMBER       NORMAL         5114       4482
ORCL:DISK_DATA01              2          0 CACHED  MEMBER       NORMAL         5114       4484
ORCL:DISK_DATA04              2          3 CACHED  MEMBER       NORMAL         5114       4481
ORCL:DISK_DATA06              2          5 CACHED  MEMBER       NORMAL         5114       4505
ORCL:DISK_DATA05              2          4 CACHED  MEMBER       NORMAL         5114       4502
ORCL:DISK_FRA01               3          0 CACHED  MEMBER       NORMAL         5114       4500
ORCL:DISK_FRA03               3          2 CACHED  MEMBER       NORMAL         5114       4497
ORCL:DISK_FRA02               3          1 CACHED  MEMBER       NORMAL         5114       4500
ORCL:DISK_FRA04               3          3 CACHED  MEMBER       NORMAL         5114       4496

13 rows selected.

SQL>