Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of ASM disk Management

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "ASM disk Management Analysis". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1.ASM disk group

In addition to ASM instances, the largest component of ASM storage management is the ASM disk group. An ASM disk group consists of too many ASM disks.

Multiple data files can be stored in a disk group, and a data file can only be located in one disk group, not across disk groups.

Multiple databases can share the same or more disk groups.

The redundancy types of disk groups can be divided into three categories: standard redundancy, high redundancy, and external redundancy.

You cannot change the redundancy level of a disk group that has been created, and if you want to change it, you need to delete the disk group and then recreate it.

2.ASM disk

ASM disks are accessed through the standard OS interface, read and written by Oracle users, and can be accessed at all nodes in the cluster.

ASM disks can have different names on different nodes.

ASM disks enable network file systems.

Objects on ASM disks are protected by redundancy.

The first block of each ASM disk is used to define the header information of the disk, the ASM disk name number, the created timestamp, and so on.

ASM files are evenly distributed across disks in an ASM group.

3.ASM fault group

A disk group can consist of two or more failure groups.

A failure group consists of one or more ASM disks.

Fault groups provide redundancy to share the same resources, and we can understand standard redundancy in this way.

Suppose you have a disk group DG1 and two failure groups have been created.

Fgroup1,fgroup2, each failure group consists of 2 ASM disks, then for standard redundancy, the two failure groups are mirrored to each other.

Failgroup1-- > asmdiskA, asmdiskB

Failgroup2-- > asmdiskC, asmdiskD

Assuming that the file datafileA size is 4MB, the four extent are evenly distributed to the asmdiskA,asmdiskB, and the asmdiskC,asmdiskD also contains 1 to 4 extent of the file.

That is, as long as there is an extent in the fault group fgroup1, there must be a mirrored extent in the fgroup2, and vice versa, the two extent are mirrors to each other.

When a disk in a failure group is damaged, assuming asmdiskA, the originally saved extent in asmdiskA will be copied from failgroup2 to asmdiskB.

In summary, the fault group failgroup1 and failgroup2 must have the same copy of extent.

Standard redundancy requires at least 2 failure groups, and high redundancy requires at least 3 fault groups. In fact, in cases where fault groups are not explicitly specified, a standard redundancy requires at least 2.

Asm disks, while a high degree of redundancy requires at least 3 asm disks.

4. Allocation unit

The minimum granularity of ASM disk is the allocation unit, and the default size is 1m, or it can be set to 128K for fine-grained access.

Support coarse-grained and fine-grained allocation units for reading and writing to achieve load balance and reduce latency.

The ASM file consists of a collection of allocation units.

5.ASM file

For Oracle itself, it is actually not much different from a standard file.

ASM files are typically located in a subdirectory created within a disk group, which begins with a plus sign and is equivalent to the root directory of the Linux system.

Such as + DG1/oradb/datafile/system.258.346542

ASM can be used for control files, data files, online log files, parameter files, archive logs, backups, etc.

Do not support trace files, executable files, OCR,Votingdisk, etc. Note: Oracle 11g R2 can support.

Use extent maps to record file-to-disk mapping.

6.I/O distribution

You can use striping and mirroring to protect data.

Files are evenly distributed across all disks in a group.

When disks are added and deleted, ASM automatically reassigns AU, so there is no fragmentation problem.

Assigning Icano to different disk controllers improves read and write data.

7.Rebalance

ASM files are evenly distributed across all disks in a disk group.

When a disk is added, some of the shared extent on all disks loaded by the current disk group will be migrated to the new disk until the redistribution is completed.

When a disk is deleted or fails, the extent of the deleted disk or failed disk will be evenly distributed among the remaining disks.

The force keyword drop disk operation is not used, and all data on the disk is released after rebalance has been completed. That is, when the disk is offline, set the disk header status to former.

In short, any change in the nature of storage (disk addition, deletion, failure) will result in rebalance, which is automatically completed by asm without human intervention, and a disk is usually locked in a period of time.

Management of 8.ASM disk groups

It is generally recommended to create two disk groups, one to save data files and one to save flashbacks for backup and recovery.

The size of the Flash Recovery Area depends on how long the flashback content needs to be retained.

Whenever possible, use different physical channels between the data area and the flashback area.

Mount all the disks you need at once as much as possible.

It is recommended to use disks with similar performance and disk size. Assuming that each of the two failure group FG1,FG2 uses a disk, the disk in the FG1 should remain the same size as the disk in the FG2, otherwise the minimum disk space will be used as the available space.

How 9.ASM disk groups are managed

SQLPlus

OEM

DBCA

ASMCMD

ASM disk creation and management

-

1. View ASM configuration disk search information

SQL > show parameter instance_type

NAME TYPE VALUE

-

Instance_type string ASM

SQL > show parameter asm_diskst

NAME TYPE VALUE

-

Asm_diskstring string / dev/oracleasm/disks/VOL*

two。 Create a disk using oracleasm

[root@zhouwanchun] # / etc/init.d/oracleasm createdisk VOL1 / dev/sdd1

Marking disk "VOL1" as an ASM disk: [OK]

[root@zhouwanchun] # / etc/init.d/oracleasm createdisk VOL2 / dev/sdd2

Marking disk "VOL2" as an ASM disk: [OK]

[root@zhouwanchun] # / etc/init.d/oracleasm createdisk VOL3 / dev/sde1

Marking disk "VOL3" as an ASM disk: [OK]

[root@zhouwanchun] # / etc/init.d/oracleasm createdisk VOL4 / dev/sde2

Marking disk "VOL4" as an ASM disk: [OK]

[root@zhouwanchun ~] # / etc/init.d/oracleasm listdisks

VOL1

VOL2

VOL3

VOL4

3. Create diskgroup syntax

CREATE DISKGROUP diskgroup_name

[{HIGH | NORMAL | EXTERNAL} REDUNDANCY]

[FAILGROUP failgroup_name]

DISK [NAME disk_name] [SIZE size_clause] [FORCE | NOFORCE]...

4. Create a disk group

SQL > create diskgroup DG1 normal redundancy disk'/ dev/oracleasm/disks/VOL1' name VOL1

Create diskgroup DG1 normal redundancy disk'/ dev/oracleasm/disks/VOL1' name VOL1

*

ERROR at line 1:

ORA-15018: diskgroup cannot be created-Standard redundancy requires at least two disks

ORA-15072: command requires at least 2 failure groups, discovered only 1

SQL > create diskgroup DG1 normal redundancy

2 disk'/ dev/oracleasm/disks/VOL1' name DG1_VOL1,'/ dev/oracleasm/disks/VOL2' name DG1_VOL2

SQL > create diskgroup DG2 normal redundancy-- create a disk group DG2 using standard redundancy

2 failgroup FG1 disk'/ dev/oracleasm/disks/VOL3' name DG2_FG1_VOL3

3 failgroup FG2 disk'/ dev/oracleasm/disks/VOL4' name DG2_FG2_VOL4

SQL > create diskgroup DG_ext external redundancy disk'/ dev/oracleasm/disks/VOL10' name DG_ext_VOL10;-external redundancy

SQL > select group_number gno,name,state,type,total_mb,free_mb,-- View the disk group created

2 required_mirror_free_mb rmfmb,usable_file_mb ufmb

3 from v$asm_diskgroup

GNO NAME STATE TYPE TOTAL_MB FREE_MB RMFMB UFMB

--

1 DG1 MOUNTED NORMAL 3066 2964 0 1482

2 DG2 MOUNTED NORMAL 3066 2964 0 1482

3 DG_EXT MOUNTED EXTERN 100 50 0 50

SQL > select group_number gno,name,failgroup fgno,state,total_mb,free_mb,header_status from v$asm_disk

GNO NAME FGNO STATE TOTAL_MB FREE_MB HEADER_STATU

2 DG2_FG2_VOL4 FG2 NORMAL 1537 1486 MEMBER

2 DG2_FG1_VOL3 FG1 NORMAL 1529 1478 MEMBER

1 DG1_VOL2 DG1_VOL2 NORMAL 1537 1486 MEMBER

1 DG1_VOL1 DG1_VOL1 NORMAL 1529 1478 MEMBER

3 DG_EXT_VOL10 DG_EXT_VOL10 NORMAL 100 50 MEMBER

5. Disk groups add fault groups and members

-- add members to a non-failure group

SQL > alter diskgroup DG1 add disk'/ dev/oracleasm/disks/VOL5' name DG1_VOL5

-- add a fault group FG3 and members to DG2

SQL > alter diskgroup DG2

2 add failgroup FG3 disk'/ dev/oracleasm/disks/VOL6' name DG2_FG3_VOL6;-add fault groups and members

-- add a member to each fault group of DG2

SQL > alter diskgroup DG2

2 add failgroup FG1 disk'/ dev/oracleasm/disks/VOL7'

3 add failgroup FG2 disk'/ dev/oracleasm/disks/VOL8'

4 add failgroup FG3 disk'/ dev/oracleasm/disks/VOL9'

6. Delete disks from a disk group, members of a failure group, disk group

SQL > alter diskgroup DG1 drop disk DG1_VOL5;-- Delete disk VOL5 from disk group DG1

SQL > alter diskgroup DG2 drop disk DG2_0003;-- deletes a single member of the failure group

SQL > alter diskgroup DG2 drop disks in failgroup FG3;-Delete the fault group and all its members. Note that it is in the plural form of drop disks.

SQL > alter diskgroup DG1 drop disk DG1_VOL4-deletes the disks in the disk group while adding the fault group FG3

Add failgroup FG3 disk'/ dev/oracleasm/disks/VOL9' name DG1_VOL11

SQL > drop diskgroup DG1;-- Delete a disk group

7. Adjust the capacity of a disk group

-the capacity of the fault group FG3 will be adjusted to G, and the adjustment will fail if there is insufficient disk space.

SQL > alter diskgroup DG2 resize disks in failgroup FG3 size 10G

8. Manual Rebalance

SQL > alter diskgroup DG2 rebalance power 3 wait

9. Loading and unloading of disk group and internal consistency check

SQL > alter diskgroup all dismount

SQL > alter diskgroup DG2 mount

SQL > alter diskgroup DG2 check all

10. View the partner of a disk group

SQL > select name,state,type from v$asm_diskgroup where group_number=3;-- View diskgroup DG3 information

NAME STATE TYPE

DG3 MOUNTED NORMAL

SQL > select grp,disk,number_kfdpartner from x$kfdpartner where grp=3

GRP DISK NUMBER_KFDPARTNER

3 01-disk group DG3 uses 3 disks with standard redundancy

3 0 2-partner of disk group 0 is disk group 1

3 1 0-the partner of disk group 1 is disk group 0

3 1 2

3 20-the partner of disk group 2 is disk group 0pl

3 2 1

Management of directories and files in ASM disk group

-

1. Add a directory to the disk group

SQL > alter diskgroup DG2 add directory'+ DG2/datafile'

-- add directories to the disk group

SQL > alter diskgroup DG2 rename directory'+ DG2/datafile' to'+ DG2/dtfile';-rename directory

SQL > alter diskgroup DG2 drop directory'+ DG2/dtfile';-Delete the directory

SQL > alter diskgroup DG2 add directory'+ DG2/asmdb/datafile';-- add directories to disk groups

Alter diskgroup DG2 add directory'+ DG2/asmdb/datafile'

*

ERROR at line 1:

ORA-15032: not all alterations performed

ORA-15173: entry 'asmdb' does not exist in directory' /'- received an error. The asmdb directory does not exist and must be created first.

SQL > alter diskgroup DG2 add directory'+ DG2/asmdb/';-add asmdb first

SQL > alter diskgroup DG2 add directory'+ DG2/asmdb/datafile';-added directory successfully again

two。 Add aliases to files, rename aliases

SQL > alter diskgroup DG1 add alias'+ DG1/asmdb/datafile/users.dbf'-add an alias

2 for'+ DG1/asmdb/datafile/users.263.734885485'

SQL > select name,group_number,file_number,alias_index,alias_directory,system_created

2 from v$asm_alias where file_number=263

NAME GROUP_NUMBER FILE_NUMBER ALIAS_INDEX AS

--

USERS.263.734885485 1 263 215 N Y

Users.dbf 1 263 216 N N

SQL > alter diskgroup DG1 rename alias'+ DG1/asmdb/datafile/users.dbf'-rename an alias

2 to'+ DG1/asmdb/datafile/users01.dbf'

SQL > select name,group_number,file_number,alias_index,alias_directory,system_created

2 from v$asm_alias where file_number=263

NAME GROUP_NUMBER FILE_NUMBER ALIAS_INDEX AS

--

USERS.263.734885485 1 263 215 N Y

Users01.dbf 1 263 216 N N

3. Delete aliases for files

SQL > alter diskgroup DG1 drop alias'+ DG1/asmdb/datafile/users01.dbf'

ASM disk group, management of TEMPLATE

-

TEMPLATE is a template that defines the default allocation unit size and redundancy level for new files in the database. Different AUs and different redundancy are used for different types of files. For example, the control files are highly redundant, the stripes use fine stripes (128kb), while the parameter files and data files use standard redundancy, coarse level stripes (1MB). This feature is precisely the difference between Oracle asm management and external redundancy, that is, different levels of redundancy and striped allocation units of different sizes can be used based on different attributes of the file. Of course, we can modify the template according to different requirements so that its redundancy and stripe features are applied as needed when creating new files. The system administrator can change the default template of the system, but cannot delete it, and the administrator can add his own template and then create a data file on the template.

1. Default striping and its redundancy level

SQL > select * from v$asm_template where group_number=1

GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME

1 0 MIRROR COARSE Y PARAMETERFILE

1 1 MIRROR COARSE Y DUMPSET

1 2 HIGH FINE Y CONTROLFILE

1 3 MIRROR COARSE Y ARCHIVELOG

1 4 MIRROR FINE Y ONLINELOG

1 5 MIRROR COARSE Y DATAFILE

1 6 MIRROR COARSE Y TEMPFILE

1 7 MIRROR COARSE Y BACKUPSET

1 8 MIRROR COARSE Y AUTOBACKUP

1 9 MIRROR COARSE Y XTRANSPORT

1 10 MIRROR COARSE Y CHANGETRACKING

1 11 MIRROR FINE Y FLASHBACK

1 12 MIRROR COARSE Y DATAGUARDCONFIG

two。 Syntax for creating TEMPLATE

ALTER DISKGROUP disk_group_name ADD TEMPLATE template_name

ATTRIBUTES ([{MIRROR | HIGH | UNPROTECTED}] [{FINE | COARSE}])

3. Add TEMPLATE

SQL > alter diskgroup DG1 add template template_one attributes (high fine)

SQL > alter diskgroup DG1 add template template_two attributes (unprotected)

4. Modify an existing TEMPLATE

SQL > alter diskgroup DG1 alter template template_one attributes (coarse)

5. Delete TEMPLATE

SQL > alter diskgroup DG1 drop template template_two

6. Create data files based on templates

SQL > create tablespace test datafile'+ DG1/asmdb/datafile/test.dbf (template_one) 'size 10m

7. View the templates used by files in the current system

SQL > select name,redundancy,striped

2 from v$asm_alias a join v$asm_file b

3 on a.file_number=b.file_number

4 and a.group_number=b.group_number

5 order by name

NAME REDUND STRIPE

Current.256.734885363 HIGH FINE

SYSAUX.260.736463679 MIRROR COARSE

TBS_RMAN.265.735409761 MIRROR COARSE

TEMP.262.734885475 MIRROR COARSE

SYSTEM.259.734885389 MIRROR COARSE

ASM authentication and password file

-

1.ASM certification

The ORACLE ASM instance does not have a data dictionary, so you can only connect to the ASM instance with the following three system permissions: SYSASM,SYSDBA,SYSOPER.

two。 Connect the ASM instance

1. Use OS authentication directly on the operating system.

two。 Use password file authentication on the operating system.

3. Connect remotely through Oracle Net Service remote + password file.

3.ASM password file

How do I create a password file for an ASM instance?

If you use ASMCA to create an instance of ASM, a password file is created, and the default users for the password file are SYS and ASMSNMP.

If you want to add other users to the password file, you need to use the create user and grant commands to add them.

If it is not created using ASMCA, you need to create a password file manually and give SYSASM permissions to the SYS user.

The ASM password file creation is the same as the oracle instance:

$orapwd file=$ORACLE_HOME/dbs/orapw+ASM password=oracle

This is the end of "ASM disk Management Analysis". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report