(I) management principles of ASM disk groups ① impact of disk addition or deletion
When a disk is added or deleted from a disk group, ASM can automatically balance the disk.
For normal delete operations (without the force option), the deleted disk will not be released immediately before the data on the disk is effectively processed.
Similarly, when a new disk is added, the disk will not carry the I/O load before the re-allocation is completed.
② How does ASM handle disk faults?
There are roughly two ASM disk groups: common group and fault group. The latter is associated with the redundancy mode of ASM.
A common disk group is a standard storage unit. ASM can read and write data to the accessible disk group. The failure disk Group aims to improve the high availability of data.
The Disk redundancy policy in ASM is very simple. It can be divided into three types: External redundancy, standard redundancy, and high redundancy. The external redundancy is irrelevant to the failure group.
If standard redundancy or high redundancy is set, the disk group must have a fault group.
For standard redundancy, ASM requires that the disk group have at least two failure disk groups, that is, double image protection. For the same data, there will be two master-slave images.
In addition, ASM uses algorithms to automatically ensure that the master and slave images do not exist in the same failure disk group. This ensures that even if the entire failure disk group is damaged, data will not be lost.
In ASM, the image unit is neither a disk nor a block, but an AU unit. The default size is 1 MB.
As for high redundancy, it requires at least three failure disk groups, that is, an AU image with a master and multiple slaves, which is theoretically more secure.
If the disk is external redundant, it belongs to the disk group. If the disk is internal redundant, it also belongs to and belongs only to a failure disk group.
If the disk is damaged, the damaged disk is automatically offlice and dropped by default. However, the disk is still in the Mount state.
If the group has images, the application will not be affected, and the image disk will be automatically taken over-as long as not all failure disk groups are damaged,
Otherwise, the disk is automatically dismounted.
For example, a standard redundant failure group has six disks (corresponding to six bare devices). If a disk is broken at this time, it doesn't matter. The operation continues, the block will be automatically dropped,
The remaining five disks can still perform normal read/write operations.
(Ii) operations on a disk group (1) Add a disk group
Syntax:
CREATE DISKGROUP diskgroup_name [ { HIGH | NORMAL | EXTERNAL } REDUNDANCY ] [ FAILGROUP failgroup_name ] DISK [ NAME disk_name ] [ SIZE size_clause ] [ FORCE | NOFORCE ]
Note:
● The disk group name (diskgroup_name) must be specified first );
● Specify redundancy. Three options are available: high (high redundancy> three paths), normal (Standard redundancy-dual path), and external (External Storage redundancy );
● Select whether to specify the failgroup (this parameter must be specified if non-External is selected );
● Specify the members (corresponding Luns) in the disk group. When specifying the members, ASM can automatically detect the disk capacity. However, if DBA is based on some considerations,
If you want to restrict the space used by ASM, you can also specify the size (as long as the specified size does not exceed the actual disk capacity) during the specified member process. When adding members,
ASM will also automatically check the disk header to determine whether the disk is added to another disk group. If it is found that the disk has been added to another disk group, you can use the force option to forcibly modify the disk's disk.
Example:
idle> create diskgroup dg1 normal redundancy 2 failgroup f1 disk '/dev/raw/raw4' 3 failgroup f2 disk '/dev/raw/raw5';
(2) Modify disk group I to add a disk
idle> alter diskgroup DATA add disk '/dev/raw/raw7' name data007;Diskgroup altered.
In fact, when you add a disk to alter diskgroup, you can also use wildcards. For example, to add all devices starting with raw_a0, run the following statement:
Alter diskgroup asmdisk1 add disk '/dev/raw/raw_a0*' ;
For example, to add raw_a5, raw_a6, and raw_a7, you can run the following statement:
Alter diskgroup asmdisk1 add disk '/dev/raw/raw_a[567]' ;
However, ASM needs to automatically average the data in the disk group, which requires a certain amount of time (depending on the amount of data). By default, the alter diskgroup statement does not return control until all work is completed.
If you want the alter diskgroup statement to complete all the work before returning the result, you can attach the rebalance wait clause during execution so that the statement will wait for the automatic balancing operation until all operations are completed and the result will be returned.
Of course, if you have changed your mind and do not want to wait, CTRL + C will be interrupted to gain control, while the balance operation will not be affected and will continue in the background.
Ii. delete a disk
The deletion operation is a little different from adding a disk, that is, when the ASM finds that the balance cannot be reached (for example, when the remaining disk space is insufficient to store all data), the deletion operation will also fail.
In this case, either the data is deleted first or the deletion operation is canceled.
idle> alter diskgroup DATA drop disk data007;Diskgroup altered.idle> alter diskgroup data undrop disks;Diskgroup altered.
As long as the deletion operation has not been completed, any operation will be canceled. Otherwise, the disk can only be re-added to the disk through the add statement.
Ⅲ modify disk size
The disk size in ASM can be expanded or reduced,
To expand, make sure that the raw volume corresponding to the disk does have enough space to expand.
Otherwise, make sure that the remaining space is still stored on the current disk.
idle> alter diskgroup data resize disk data007 size 95m;Diskgroup altered.
(3) manually balance the disk group
Generally, ASM automatically balances the disk groups under it. However, Oracle also provides a way to manually balance the disk groups.
As mentioned above, the degree of balance of the disk group is between 0 and 11. The default value is the value set in the asm_power_limit initialization parameter,
For manual balancing, the configured degree of balance may be different from that in the initialization parameters. For example, you can set the disk degree of balance to 5.
idle> alter diskgroup data rebalance power 5;Diskgroup altered.
When executing this statement, the DBA must pay attention to the impact of this operation on Io performance.
In addition, I stress that the above statement will soon return the diskgroup altered prompt, but this does not mean that the operation is actually completed. It is just a feedback statement submission.
To view operations on the disk background, you can use the V $ asm_operator view or add the wait clause when executing the statement. In this way, ASM will not return the prompt information until the operation is completed.
(4) Mount/unmount disk group
Only the mounted disk groups can be used by the database and perform disk operations such as Add/drop. The disk groups in ASM are automatically loaded when the ASM instance is started by default, of course, you can also manually run the command line statement to mount/unmount the disk group.
You can view the disk groups created in the ASM instance in the V $ asm_diskgroup View:
idle> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB------------ ------ --------------------------------- ---------- ---------- 1 DATA MOUNTED 701 540
The current two disk groups are in the Mount status. To set them to unmount, run the following statement:
idle> alter diskgroup data dismount;Diskgroup altered.idle> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB------------ ------ --------------------------------- ---------- ---------- 0 DATA DISMOUNTED 0 0
The unmount disk must be operated with caution. Make sure that the database corresponding to the files stored in the unmount disk is not started, and this operation will directly cause the database to shut down.
idle> alter diskgroup data dismount;Diskgroup altered.idle> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB------------ ------ --------------------------------- ---------- ---------- 1 DATA MOUNTED 701 540
⑸ Delete a disk group
Syntax: Drop diskgroup gpname
If the deleted diskgroup is not empty, an error is returned when you directly execute the preceding statement.
In this case, you can add the including contents clause to automatically delete the files contained in the disk.
Deleting a disk group automatically modifies the value of the asm_diskgroups initialization parameter in spfile (if spfile is used)