mercredi 15 mai 2019

Manually Rebalancing Disk Groups







How to manually Rebalancing Disk Groups

You can manually rebalance the files in a disk group using the REBALANCE clause of the ALTER DISKGROUP statement. This would normally not be required, because Oracle ASM automatically rebalances disk groups when their configuration changes. You might want to do a manual rebalance operation to control the speed of what would otherwise be an automatic rebalance operation.
So, when a disk is dropped, the disk group is supposed to rebalance by moving all of the file extents from the dropped disk to other disks in the disk group. A drop disk operation might fail if not enough space is available on the other disks. The best approach is to perform both the add and drop operation with the same ALTER DISKGROUP statement. This has the benefit of rebalancing data extents only one time and ensuring that there is enough space for the rebalance operation to succeed.

Practice:

We have an existing DATA_DG disk group and we need to rebalance all the data from original ASM disks to the new one and then, drop the former ASM disks.
1.       To know the name and path to new ASM disk, you can use the following query:

SELECT name, path from v$asm_disk
WHERE header_status='FORMER';
Depending of ASM_DISKSTRING parameter, you can have different outputs:

NAME                              PATH
------------------------           ----------------------------------------------------
NEW_DATA_DG_DISK01         /dev/oracleasm/disks/DATADG_DISK01
NEW_DATA_DG_DISK02         /dev/oracleasm/disks/DATADG_DISK02

In this case ASM_DISKTRING parameter is set as /dev/oracleasm/disks/*

Or

NAME                              PATH
------------------------           ----------------------------------------------------
NEW_DATA_DG_DISK01         ORCL:DATADG_DISK01
NEW_DATA_DG_DISK02         ORCL:DATADG_DISK02
In this case ASM_DISKTRING parameter is set as ORCL:*


2.       Now, you have to retrieve the name of ASM disks for the existing disk group.

SELECT a.name from v$asm_disk a, v$asm_diskgroup b
WHERE a.group_number=b.group_number
AND b.name='DATA_DG';
The output can be:

NAME                              
------------------------           
DATA_DG_01         
DATA_DG_02  
DATA_DG_03        
     

Note: You must that the total size of the new ASM disks is equal or greater than the old one.

3.       The syntax to ADD and DROP of disks using ALTER DISKGROUP command is as below :

ALTER diskgroup DATA_DG add disk '/dev/oracleasm/disks/DATADG_DISK01' '/dev/oracleasm/disks/DATADG_DISK02' drop disk DATA_DG_01, DATA_DG_02, DATA_DG_03 rebalance power 10;

Diskgroup altered.

Or

ALTER diskgroup DATA_DG add disk 'ORCL:DATADG_DISK01' 'ORCL:DATADG_DISK02' drop disk DATA_DG_01, DATA_DG_02, DATA_DG_03 rebalance power 10;

Diskgroup altered.

This operation can take time depending of the total size of data to move. You can monitor your activity by querying v$asm_operation view.


SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA PASS STAT  POWER   ACTUAL  SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE    CON_ID
------------    ----- --------- ---- ---------- ---------- ---------- ---------- ---------- ----------- -------------------------------------------- ----------
3 REBAL COMPACT   WAIT         10         10          0          0          0           0                                                       0
3 REBAL REBALANCE RUN          10         10       3799    1629533      18397          88                                                       0
3 REBAL REBUILD   DONE         10         10          0          0          0           0                                                       0

When the operation is completed, the v$asm_operation view is empty and you can check in ASM alert.log file :

NOTE: F1X0 on disk 1 (fmt 1) relocated at fcn 0.716238: AU 0 -> AU 2
NOTE: 05/14/19 17:22:49 DATA_DG.F1X0 copy 1 relocating from 0:2 to 1:2 at FCN 0.716238
2019-05-14T18:19:53.112880+01:00
NOTE: stopping process ARB0
NOTE: stopping process ARBA
NOTE: Starting expel slave for group 2/0x2b706c92 (DATA_DG)
2019-05-14T18:19:53.168804+01:00
NOTE: Group Block outside rolling migration privileged region
NOTE: requesting all-instance membership refresh for group=2
2019-05-14T18:19:53.214540+01:00
SUCCESS: rebalance completed for group 2/0x2b706c92 (DATA_DG)
2019-05-14T18:19:54.277827+01:00
GMON updating for reconfiguration, group 2 at 39 for pid 49, osid 18501
2019-05-14T18:19:54.280704+01:00

Aucun commentaire:

Enregistrer un commentaire

How to fix errors : -         ORA-38760: This database instance failed to turn on flashback database -         ORA-38780: Restore poin...