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.