Article From:https://www.cnblogs.com/yss669/p/9967795.html

oracle 11gR2 ASMAdd and delete disks

 

I. environment
oracle 11gR2 RAC + Oracle Linux Server release 5.9

Two, implementation
Note: For safety, stop database instance and ASM instance before operation
1、Node 1, 2 Disk Information
—Shared disk information
[root@11grac1 ~]# ls -l /dev/asm* –Format: / dev / asm-diskc
—New disk required
[root@11grac1 ~]# ls -l /dev/sd* –/dev/sdhNew disk

2、udevHow to configure the new disk as an ASM shared disk (nodes 1 and 2 must be executed)
[root@11grac1 rules.d]# pwd
/etc/udev/rules.d
[root@11grac1 rules.d]# for i in h; do echo “KERNEL==”sd“, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”scsi_id -g -u -s /block/sd$i“, NAME=”asm-disk$i”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″”; done
KERNEL==”sd
“, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s p”,RESULT==”SATA_VBOX_HARDDISK_VBfeab29eb-3b887e7b_”, NAME=”asm-diskh”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
[root@11grac1 rules.d]# vi 99-oracle-asmdevices.rules
KERNEL==”sd*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”SATA_VBOX_HARDDISK_VBfeab29eb-3b887e7b_”,NAME=”asmdiskh”,OWNER=”grid”,GROUP=”asmadmin”, MODE=”0660″

3、Restart udev service
[root@11grac1 rules.d]# start_udev
[root@11grac2 rules.d]# start_udev

4、Check whether / dev / SDH is an ASM disk in / dev / asm-diskh format
[root@11grac1 ~]# ls -l /dev/asm*

5、Add disk to ASM disk group (sysasm for grid users)
SQL> select GROUP_NUMBER,DISK_NUMBER, MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;
SQL> alter diskgroup data_dg add disk ‘/dev/asm-diskh’;
SQL> select GROUP_NUMBER,DISK_NUMBER, MODE_STATUS,HEADER_STATUS,MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;
After adding the disk, Oracle automatically rebalances, which can be viewed from a view.
SQL> select * from v$asm_operation;
SOFAR:That’s the number of AUs that have been moved so far.
EST_WORK:Estimated number of AUs to be moved
EST_RATE:Estimate the number of AUs moving per minute
EST_MINUTES:Estimate how many minutes to move
The process of rebalancing is the process of moving data from other disks to new disks. If the amount of data is large, it will take a long time. We can change the power value to accelerate the speed. The default power value is 1. We can set the value larger according to the storage performance (power value 0-11), data level.Restore the power value after balancing
SQL> show parameter asm_power_limit
SQL> alter diskgroup data_dg rebalance power 11;
Note: Power = 0 stops rebalance operation
The rebalance directive can also be added directly when adding the disk, as follows:
SQL> alter diskgroup data_dg add disk ‘/dev/asm-diskh’ rebalance power 8;
Note: If you add disk error (new disk is not new, old data is in it), you can use DD command to clear the disk head information.
dd if=/dev/zero of=/dev/sdd bs=4096 count=256 –The size of disk header information is generally 1M.

6、Delete ASM disk
SQL> select GROUP_NUMBER,DISK_NUMBER, MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;
SQL> alter diskgroup data_dg drop disk ‘DATA_DG_0002’; –Delete according to name.
Or: SQL> alter disk group data_dg drop disk’DATA_DG_0002’rebalance power 8;
SQL> select * from v$asm_operation;
SQL> select GROUP_NUMBER,DISK_NUMBER, MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;

Leave a Reply

Your email address will not be published. Required fields are marked *