Oracle - ASM(Automatic Storage Management)
Contents
Oracle ASM
is a volume manager and a file system for Oracle database files that supportssingle-instance
Oracle Database andOracle 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 ina disk group
is evenly distributed to eliminate hot spots and to provide uniform performance across the disks.
Oracle ASM Instances
An
Oracle ASM instance
is built on the same technology as an Oracle Database instance. An Oracle ASM instance has aSystem 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.
See the below structures:
Example - Oracle ASM Cluster with RAC
PS.
Oracle ASM cluster
in an OracleRAC
environment where Oracle ASM provides a clustered pool of storage. There is one Oracle ASM instance for each node serving multipleOracle RAC
orsingle-instance
databases in the cluster. All of the databases are consolidated and share the same two Oracle ASM disk groups.
Example - Oracle ASM Cluster with single instance
PS.
A clustered storage pool
can be shared by multiplesingle-instance
Oracle Databases. In this case, multiple databases share common disk groups. A shared Oracle ASM storage pool is achieved by using Oracle Clusterware. However, in such environments an Oracle RAC license is not required.
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.
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)
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.
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.
How to Use ASM
Start & Stop
1 | # start |
Adding a diskgroup
1 | SQL> create diskgroup orag2 external redundancy disk 'ORCL:VOL5'; |
Recreating a diskgroup
1 | dd if=/dev/zero of=/dev/rdsk/c1t4d0s4 bs=8192 count=12800 |
Rebalancing
1 | # The rebalancing speed is controlled by the ASM_POWER_LIMIT initialization parameter. |
Coverting to ASM
One can use
Rman
to convert a datafile, tablespace or entire database from/toASM
.
Here are the steps required to migrate an entire database toASM
Convert a database to ASM
Ensure the database is using an
SPFILE
and not aPFILE
(it’s about time after all!).
Set parameters on the target database.
For example, if we set bothDB_CREATE_FILE_DEST
andDB_RECOVERY_FILE_DEST
we should get mirrored controlfiles and duplexed log files by default:
1 | SQL> alter system set DB_CREATE_FILE_DEST = '+DATA'; |
Start the database in
NOMOUNT
mode and restore the controlfile into the new location from the old location:
1 | RMAN> connect target / |
Mount the database and copy the database into the
ASM disk group
:
1 | RMAN> ALTER DATABASE MOUNT; |
Switch all datafiles to the new
ASM
location and open the database:
1 | RMAN> SWITCH DATABASE TO COPY; |
Add new tempfiles and drop the old tempfiles:
1 | SQL> alter tablespace temp add tempfile; |
Optionally, move
SPFILE
intoASM
:
1 | SQL> CREATE SPFILE '+DATA' FROM PFILE; |
Move redo log files into
ASM
- for each group:
1 | SQL> ALTER DATABASE DROP LOGFILE GROUP 1; |
Convert a tablespace to ASM
Ensure the database in in
archive log mode
, and fromrman
:
1 | connect target; |
Convert a datafile to ASM
Ensure the database in in
archive log mode
, and fromrman
:
1 | connect target; |
Monitoring
1 | V$ASM_DISK -- ASM disks |
Resources:
https://docs.oracle.com/cd/E11882_01/server.112/e18951/asmcon.htm#OSTMG94057
http://www.orafaq.com/wiki/Automatic_Storage_Management
Author: itabas016
Link: https://tech.itabas.com/2016/10/14/database/oracle-kt-asm/
License: CC BY-NC-ND 4.0