ASM学习之概述


Oracle ASM(Oracle Automatic Storage Management)
Oracle ASM is a volume manager and a file system for Oracle database files that supports single-instance Oracle Database
and Oracle Real Application Clusters (Oracle RAC) configurations. Oracle ASM is Oracle's recommended storage management solution
that provides an alternative to conventional volume managers, file systems, and raw devices.
ORACLE ASM是一个卷管理器,Oracle数据库文件的一个文件系统,ASM支持单实例和集群配置,它是oracle推荐的存储方案,为传统卷管理器,文件系统,裸设备提供一个选择。
 
Oracle ASM uses disk groups to store data files; an Oracle ASM disk group is a collection of disks that Oracle ASM manages as a unit.
Within a disk group, Oracle ASM exposes a file system interface for Oracle database files. The content of files that are stored in a disk group is evenly distributed
to eliminate hot spots and to provide uniform performance across the disks. The performance is comparable to the performance of raw devices.
Oracle ASM使用磁盘组存储数据文件,磁盘组是是磁盘的集合,ASM以AU(allocate unit分配单元,默认是1M,但是可以修改)来管理磁盘的,在磁盘中,ASM给数据库文件提供了一个系统接口,存储在磁盘组的文件内容被均匀的分布以避免热点,为方位磁盘提供均衡的性能。ASM性能跟裸设备的性能是相当的。

You can add or remove disks from a disk group while a database continues to access files from the disk group. When you add or remove disks from a disk group,
Oracle ASM automatically redistributes the file contents and eliminates the need for downtime when redistributing the content.
可以在磁盘组使用的情况下添加和删除磁盘,而且ASM会自动重新分布文件内容,同时在重分布期间会减少停机时间。

Oracle ASM also uses the Oracle Managed Files (OMF) feature to simplify database file management. OMF automatically creates files in designated locations.
OMF also names files and removes them while relinquishing space when tablespaces or files are deleted.
ASM也是用OMF来简化数据库文件管理,OMF在指定的位置自动创建文件,当表空间或文件被删除时,在释放空间的同事,OMF也可以命名文件,删除文件。

Oracle ASM reduces the administrative overhead for managing database storage by consolidating data storage into a small number of disk groups.
The smaller number of disk groups consolidates the storage for multiple databases and provides for improved I/O performance.
ASM通过合并数据存储到少量的磁盘组来减少管理费用,少量的磁盘组整合多数据库的存储,并提供更高的I/O性能。
Oracle ASM files can coexist with other storage management options such as raw disks and third-party file systems.
This capability simplifies the integration of Oracle ASM into pre-existing environments.
ASM实例文件能与其他的存储管理设备(裸设备,第三方文件系统)并存。容量可以简化ASM到已存在环境的整合。

Oracle Automatic Storage Management Cluster File System (Oracle ACFS) is a multi-platform, scalable file system, and storage management technology
that extends Oracle ASM functionality to support customer files maintained outside of Oracle Database.
The Oracle ASM Dynamic Volume Manager (Oracle ADVM) provides volume management services and a standard disk device driver interface to clients
ACFS是一个多平台,可扩展性的文件系统,存储管理技术,扩展ASM功能以支持维护Oracle数据库外面的客户文件。ADVM为客户端提供卷管理服务和标准的磁盘设备驱动接口

Oracle Enterprise Manager includes a wizard that enables you to migrate non-Oracle ASM database files to Oracle ASM.
Oracle ASM also has easy to use management interfaces such as SQL*Plus, the Oracle ASM Command Line Utility (ASMCMD) command-line interface,
Oracle ASM Configuration Assistant, and Oracle Enterprise Manager
EM中的向导可以帮助你迁移非ASM数据库文件到ASM,也可以使用SQLPLUS,ASMCMD,ASMCA,OEM.

ASM实例
An Oracle ASM instance has a System Global Area (SGA) and background processes that are similar to those of Oracle Database. However,
because Oracle ASM performs fewer tasks than a database, an Oracle ASM SGA is much smaller than a database SGA. In addition,
Oracle ASM has a minimal performance effect on a server. Oracle ASM instances mount disk groups to make Oracle ASM files available to database instances;
Oracle ASM instances do not mount databases
ASM instance包括SGA和一些后台进程,然而,ASM比DB执行更少的任务,SGA要比DB的小得多,另外,ASM在server上对性能的影响很小,数据库实例启动之前,必须先启动ASM实例挂载磁盘组。它不会挂载数据库。

Oracle ASM is installed in the Oracle Grid Infrastructure home before Oracle Database is installed in a separate Oracle home.
Oracle ASM and database instances require shared access to the disks in a disk group.
Oracle ASM instances manage the metadata of the disk group and provide file layout information to the database instances.
11g ASM安装在GI home中,之前是安装在独立的ORACLE HOME下。ASM实例和数据库实例共同访问磁盘中的磁盘。 ASM实例管理磁盘组中的metadata,为数据库实例提供文件布局信息。Oracle ASM metadata包含以下信息:
The disks that belong to a disk group  磁盘组中的磁盘
The amount of space that is available in a disk group 磁盘组中可用的空间
The filenames of the files in a disk group 文件名
The location of disk group data file extents 数据文件扩展区的位置
A redo log that records information about atomically changing metadata blocks 改变元始据块的redo
Oracle ADVM volume information

ORACLE ASM实例可以使用clusteware集群,每个节点都有一个ASM instance,如果几个不同的数据库实例在同一个节点上,那么这些数据库实例共享这个单一ASM INSTANCE。如果ASM实例在一个节点上故障,那么所有的数据库实例在这个节点上也故障,它不像文件系统驱动发生故障那样,ASM instance故障不要求重启OS,在RAC下,ASM和DB instance在正常的节点上自动恢复ASM instance故障。
在单实例环境下,多个数据库instance共享一个asm instance;在RAC下,Oracle ASM提供了一个集群存储池,每个节点ASM instance为多个ORACLE RAC或single-instance DB服务,所有的数据库被合并,而且共享ASM磁盘组。
集群存储池被多个单实例数据库共享,多个数据库instance可以共享共同的磁盘组。clustered storage pool是用Oracle clusterware完成的。

Oracle ASM Disk Groups
磁盘组包含多个磁盘,而且是ASM实例管理的基本对象。每个磁盘组包含用于空间管理的元数据,磁盘组组件包括磁盘,文件,分配单元AU.
文件是从磁盘中分配,任何ASM文件完全包含在一个单独的磁盘组中,然而,一个磁盘组可能多个数据库的文件,一个数据库可能从多个磁盘组读取文件,对于大多数安装来说,只需要很少磁盘组,通常2个,不多于3个。

磁盘镜像(Mirroring)和故障组(Failure Groups)
镜像有三种方式,也是三种冗余级别:
Normal for 2-way mirroring
High for 3-way mirroring
External to not use Oracle ASM mirroring, such as when you configure hardware RAID for redundancy
冗余级别允许多少个磁盘故障,而不是卸载磁盘或丢失数据。磁盘组类型决定镜像级别。ORACLE ASM镜像比附加RAID镜像更加灵活。
当ASM分配给一个镜像文件分配一个extent时,ORACLE ASM分配一个primary copy和一个mirror copy。ASM选择磁盘在不同的故障组去存储mirror copy而不是primary copy。
故障组用于存放mirror copy以便每个copy在不同的故障组磁盘上。

ASM磁盘
主要包括以下信息:
A disk or partition from a storage array
An entire disk or the partitions of a disk
Logical volumes
Network-attached files (NFS)
对磁盘命名的解释:
When you add a disk to a disk group, you can assign an Oracle ASM disk name or Oracle ASM assigns the Oracle ASM disk name automatically.
This name is different from the path name used by the operating system. In a cluster, a disk may be assigned different operating system device names on different nodes,but the disk has the same Oracle ASM disk name on all of the nodes. In a cluster, an Oracle ASM disk must be accessible from all of the instances that share the disk group。

Oracle ASM spreads the files proportionally across all of the disks in the disk group. This allocation pattern maintains every disk at the same capacity level and ensures that all of the disks in a disk group have the same I/O load. Because Oracle ASM load balances among all of the disks in a disk group, different Oracle ASM disks should not share the same physical drive.

Allocation Units(AU)
Every Oracle ASM disk is divided into allocation units (AU). An allocation unit is the fundamental unit of allocation within a disk group.A file extent consists of one or more allocation units. An Oracle ASM file consists of one or more file extents.
When you create a disk group, you can set the Oracle ASM allocation unit size with the AU_SIZE disk group attribute.
The values can be 1, 2, 4, 8, 16, 32, or 64 MB, depending on the specific disk group compatibility level.
Larger AU sizes typically provide performance advantages for data warehouse applications that use large sequential reads.

Oracle ASM Files
Files that are stored in Oracle ASM disk groups are called Oracle ASM files. Each Oracle ASM file is contained within a single Oracle ASM disk group.
Oracle Database communicates with Oracle ASM in terms of files. This is similar to the way Oracle Database uses files on any file system.
You can store the various file types in Oracle ASM disk groups, including:
Control files  控制文件
Data files, temporary data files, and data file copies 数据文件,临时数据文件,数据文件拷贝
SPFILEs 服务器参数文件
Online redo logs, archive logs, and Flashback logs 联机日志,归档日志以及闪回日志
RMAN backups RMAN备份集
Disaster recovery configurations 灾难恢复配置
Change tracking bitmaps 改变跟踪位图
Data Pump dumpsets 数据泵文件

扩展区EXTENTS
ASM文件作为一个extents的集合存储在磁盘组中,extents存储在不同的磁盘上。extent包含一个或多个AU,为了容纳越来越大的文件,ORACLE ASM使用不同大小的extent。不同大小的extent可以支持更大的ASM数据文件,减少大数据库SGA内存需求,改善文件创建打开操作的性能。初始化extent大小等于磁盘组AU大小,它以4或16的倍数增长。

ASM条带化(Striping)
条带化的目的:
To balance loads across all of the disks in a disk group  负载均衡
To reduce I/O latency 减少IO延时。
为了条带化数据,ASM将文件条带化,将数据均匀的分散在磁盘中的各个磁盘中,精细条带化大小在任何配置中总是等于128KB,提供了更小的IO延迟。

File Templates文件模板
模板是属性值的集合,用于确定磁盘范围,文件镜像以及条带化属性。默认模板提供给每个oracle文件类型,但是你可以定制模板满足独特的需求,每个磁盘组有一个与文件类型相关联的模板。

ASM_DISKSTRING初始化参数
用于确定发现磁盘组,例如可以将ASM_DISKSTRING 设置为具有三个磁盘组的字符串
ALTER SYSTEM SET ASM_DISKSTRING='SYS_DG,DATA_DG,FRA_DG' SCOPE=SPFILE SID='+ASM';

挂载和卸载磁盘
ALTER DISKGROUP DATA_DG MOUNT;
ALTER DISKGROUP DATA_DG DISMOUNT;

Online Storage Reconfigurations and Dynamic Rebalancing联机存储重配置以及动态重平衡
Rebalancing a disk group moves data between disks to ensure that every file is evenly spread across all of the disks in a disk group.
When all of the files are evenly dispersed, all of the disks are evenly filled to the same percentage; this ensures load balancing.
Rebalancing does not relocate data based on I/O statistics nor is rebalancing started based on I/O statistics. Oracle ASM rebalancing operations are controlled by the size of the disks in a disk group.
ASM_POWER_LIMIT参数
Oracle ASM automatically initiates a rebalance after storage configuration changes, such as when you add, drop, or resize disks.
The power setting parameter determines the speed with which rebalancing operations occur.

相关内容