Oracle Automatic Storage Management (ASM)


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 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.

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.

The Oracle ASM volume manager functionality provides flexible server-based mirroring options. The Oracle ASM normal and high redundancy disk groups enable two-way and three-way mirroring respectively. You can use external redundancy to enable a Redundant Array of Independent Disks (RAID) storage subsystem to perform the mirroring protection function.

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.

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.

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.
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.

Oracle ASM Instances:

An Oracle ASM instance is built on the same technology as an Oracle Database instance. 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.
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.
  • 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
·         Oracle ADVM volume information
Oracle ASM for Single-Instance Oracle Databases

Oracle ASM Disk Groups

A disk group consists of multiple disks and is the fundamental object that Oracle ASM manages. Each disk group contains the metadata that is required for the management of space in the disk group. Disk group components include disks, files, and allocation units.
Files are allocated from disk groups. Any Oracle ASM file is completely contained within a single disk group. However, a disk group might contain files belonging to several databases and a single database can use files from multiple disk groups. For most installations you need only a small number of disk groups, usually two, and rarely more than three. 

Mirroring and Failure Groups

Mirroring protects data integrity by storing copies of data on multiple disks. When you create a disk group, you specify an Oracle ASM disk group type based on one of the following three redundancy levels:
  • 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 Disks

Oracle ASM disks are the storage devices that are provisioned to Oracle ASM disk groups. Examples of Oracle ASM disks include:
  • 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.

Allocation Units

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
  • Disaster recovery configurations
  • Change tracking bitmaps
  • Data Pump dumpsets

ASM Striping

Oracle ASM striping has two primary purposes:
  • To balance loads across all of the disks in a disk group
  • To reduce I/O latency
Coarse-grained striping provides load balancing for disk groups while fine-grained striping reduces latency for certain file types by spreading the load more widely.

Mounting and Dismounting Disk Groups

A disk group must be mounted by a local Oracle ASM instance before database instances can access the files in the disk group. Mounting the disk group requires discovering all of the disks and locating the files in the disk group that is being mounted.

Adding and Dropping Disks

You can add a disk to an existing disk group to add space and to improve throughput. The specified discovery string identifies the disk or disks that you could add. The disks that you add must be discovered by every Oracle ASM instance using its ASM_DISKSTRING initialization parameter. After you add a disk, Oracle ASM rebalancing operations move data onto the new disk. To minimize the rebalancing I/O, it is more efficient to add multiple disks at the same time.

Some useful oracleasm command:

oracleasm start
oracleasm stop
oracleasm restart
oracleasm enable
oracleasm disable
oracleasm configure
oracleasm createdisk vol /app/oracle/data
oracleasm deletedisk
oracleasm querydisk
oracleasm listdisks
oracleasm scandisks
oracleasm status


Checking ASM Diskgrou:
Asmcmd> lsdg -g
Checking ASM disk status and Candidate disk:
asmcmd >lsdsk -k -g --candidate
Asm instances:
Asmcmd> lsct
Files are using ASM instances:
Asmcmd> lsof
Use kfed, kfod to read dump ASM headers and display the current status
Header status
GRID_HOME/bin/kfed  read /dev/oracleasm/disks/DATA  | grep name
Disk status
kfod asm_diskstring='/dev/oracleasm/disks/*' nohdr=true verbose=true disks=all status=true op=disks
Checking diskgroup :
select path,header_status from v$asm_disk;
Creating ASM disk

Before creating ASM disk need to create raw disk using fdisk command and give permission  user “oracle” and group “oinstall(chown oracle:oinstall /dev/sdb1)

Allso add rc.local file to apply on reboot process.
vi /etc/rc.local
chown oracle:oinstall /dev/sdb1
chmod 600 /dev/sdb1
Configure the ASM:
# service oracleasm configure
oracleasm createdisk DATA1 /dev/sdb1

Creating a Diskgroup:
CREATE DISKGROUP dgroup_01 EXTERNAL REDUNDANCY DISK '$ORACLE_HOME/disks/*';
Creating ASM diskgroups at the SQL prompt:
CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK 'ORCL:DATA1', 'ORDL:DATA2';
Note: Diskgroup called DATA that contains the disks marked DATA1 and DATA2.
At last, set the ASM_DISKSTRING variable:
alter system set ASM_DISKSTRING='$ORACLE_HOME/disks/*';
**** You can create diskgroup using ASMCA tools*****


Adding and Removing Disks from ASM disk group :

>>Find out the disk groups details:
SQL>select group_number, name from v$asm_diskgroup ; 
>>Find the disk volumes that make up the ASM diskgroup 
SQL>select disk_number, mode_status, name, path from v$asm_disk where group_number = 1 order by disk_number, name ; 
>>Make sure our new volumes can be seen by asm and set disk string:
SQL> alter system set ASM_DISKSTRING='/dev/disk1*','/dev/disk2*' scope=both; 
>>Add new disks to our disk group
SQL> ALTER DISKGROUP ASM_DG1 ADD DISK '/dev/disk2' NAME ASM_DG1_1 NOFORCE ; 
>>Check the rebalance operation:
SQL> select * from v$asm_operation ; 
>>Check that new disk volumes are now in disk group. 
SQL>select disk_number, mode_status, name, path from v$asm_disk where group_number = 1 order by disk_number, name ; 

Remove the disks from the DISK group:
ALTER DISKGROUP ASM_DG1 DROP DISK ASM_DG_1;
SQL> select * from v$asm_operation ;
SQL> select disk_number, mode_status, name, path from v$asm_disk where group_number = 1 order by disk_number, name ;
To speed up this operation:
SQL>ALTER DISKGROUP  ASM_DG1 REBALANCE POWER 10;

Some ASM views to provided in Oracle Database to monitor ASM. 
v$asm_diskgroup:  Describes a disk group  like:number, name, size related info, state, and redundancy type
v$asm_client:  Identifies databases using disk groups managed by the ASM instance.
v$asm_disk:  Contains one row for every disk discovered by the ASM instance, including disks that are not part of any disk group
v$asm_file:  Contains one row for every ASM file in every disk group mounted by the ASM instance.
v$asm_template:  Contains one row for every template present in every disk group mounted by the ASM instance. Contains no rows 
v$asm_alias:  Contains one row for every alias present in every disk group mounted by the ASM instance.
v$asm_operation:  Contains one row for every active ASM long running operation executing in the ASM instance..
V$ASM_USERGROUP_MEMBER:Contains the members for each Oracle ASM File Access Control group.
V$ASM_USER: Contains the effective operating system user names of connected database instances and names of file owners.
V$ASM_ESTIMATE: Displays an estimate of the work involved in execution plans for Oracle ASM disk group rebalance and resync operations.
V$ASM_DISKGROUP_STAT: Contains the same columns as V$ASM_DISKGROUP, but to reduce overhead, V$ASM_DISKGROUP_STAT does not perform a discovery when it is queried. The V$ASM_DISKGROUP_STAT view is recommended for monitoring scripts.To display more complete information about all disks, use V$ASM_DISKGROUP.

No comments:

Post a Comment

thedbaportfolio@gmail.com