Disclaimer

Sunday, 24 November 2024

ASM - Details

 

ASM (Automatic Storage Management)

ASM is a specialized storage management feature of Oracle Database that simplifies storage management and improves database performance by automating the allocation and management of storage resources. 

ASM organizes disks into disk groups and allows you to manage redundancy and performance optimization without needing to manually configure storage on the operating system level.


Key Functionality of ASM:

  1. Disk Group Management:

    • ASM organizes disks into disk groups for storage allocation. These groups act as logical containers for database files.
  2. Disk Redundancy:

    • ASM provides redundancy through mirroring (RAID-like functionality). Redundancy ensures that data is not lost in case of disk failure, with options like Normal and High redundancy.
  3. Automatic I/O Load Balancing:

    • ASM automatically balances I/O operations across disks in a disk group, minimizing manual tuning efforts.
  4. File Management:

    • ASM eliminates the need for specifying file locations and mount points for database files (e.g., data files, redo logs), as files are stored directly in ASM-managed disk groups.
  5. Support for Large Files:

    • ASM is capable of handling large files, making it suitable for environments with large amounts of data or high-performance requirements.


ASM Initialization Parameters and Instance Creation

The following are important ASM-specific initialization parameters used during the creation and configuration of an ASM instance:

  1. INSTANCE_TYPE:

    • Defines the type of instance: ASM (for ASM instances) or RDBMS (for database instances). Default is RDBMS.
  2. DB_UNIQUE_NAME:

    • Specifies a globally unique name for the database. The default value is +ASM, but if multiple ASM instances are used, this should be unique across all instances.
  3. ASM_POWER_LIMIT:

    • Controls the maximum power for a rebalancing operation. Valid values range from 1 to 11, with 1 being the default. Higher values use more system resources and result in faster rebalancing. This is applied during operations like adding or removing disks.
  4. ASM_DISKGROUPS:

    • Specifies the disk groups that should be mounted by the ASM instance upon startup or through commands like ALTER DISKGROUP ALL MOUNT.
  5. ASM_DISKSTRING:

    • Limits the discovery of disks by specifying a pattern or location. The default is NULL, meaning all available disks will be considered for ASM use.



Startup and Shutdown of ASM Instances

ASM instances are started and stopped in a similar manner to database instances, with some specific options:

Startup Options:

  • FORCE: Forces a SHUTDOWN ABORT before restarting the ASM instance.
  • MOUNT: Starts the ASM instance and mounts the specified disk groups.
  • NOMOUNT: Starts the ASM instance without mounting any disk groups.
  • OPEN: Not applicable to ASM instances.

Shutdown Options:

  • NORMAL: Waits for all connections to finish and shuts down gracefully.
  • IMMEDIATE: Does not wait for SQL transactions to complete but will shut down once they are finished.
  • TRANSACTIONAL: Similar to IMMEDIATE, but ensures that pending transactions are rolled back before shutdown.
  • ABORT: Shuts down the ASM instance immediately without waiting for any ongoing processes.



Disk Management in ASM

Creating Disk Groups:

The CREATE DISKGROUP command allows you to create a disk group with specific redundancy options:

CREATE DISKGROUP DATA01 NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK '/devices/diska1' NAME diska1, '/devices/diska2' NAME diska2 FAILGROUP failure_group_2 DISK '/devices/diskb1' NAME diskb1, '/devices/diskb2' NAME diskb2;
  • Normal Redundancy: Requires two failure groups with mirrored disks (2-way mirroring).
  • High Redundancy: Requires three failure groups with mirrored disks (3-way mirroring).
  • External Redundancy: Disks are protected by external RAID or hardware-based mirroring.

Dropping Disk Groups:

DROP DISKGROUP DATA01 INCLUDING CONTENTS;
  • The INCLUDING CONTENTS option removes all files in the disk group along with the disk group.

Adding/Deleting Disks:

To add new disks to a disk group:

ALTER DISKGROUP DATA01 ADD DISK '/devices/disk*3', '/devices/disk*4';


To remove a disk:

ALTER DISKGROUP DATA01 DROP DISK diska2;


Resizing Disks:

To resize a specific disk:

ALTER DISKGROUP DATA01 RESIZE DISK diska1 SIZE 100G;


To resize all disks in a failure group:

ALTER DISKGROUP DATA01 RESIZE DISKS IN FAILGROUP failure_group_1 SIZE 100G;


To resize all disks in the disk group:

ALTER DISKGROUP DATA01 RESIZE ALL SIZE 100G;





Rebalancing Disk Groups

Rebalancing ensures the data is evenly distributed across all disks in a disk group. The POWER parameter controls the speed of the rebalancing process.

ALTER DISKGROUP DATA01 REBALANCE POWER 5;


Higher values for POWER result in faster rebalancing but higher resource usage.





ASM Directories and Aliases

ASM allows the management of directories and aliases:

Creating and Managing Directories:

  • Create Directory:
ALTER DISKGROUP DATA01 ADD DIRECTORY '+DATA01/ORCL';
  • Rename Directory:
ALTER DISKGROUP DATA01 RENAME DIRECTORY '+DATA01/ORCL' TO '+DATA01/ORCL_2';
  • Drop Directory:
ALTER DISKGROUP DATA01 DROP DIRECTORY '+DATA01/ORCL_2' FORCE;

Creating and Managing Aliases:

  • Create Alias:
ALTER DISKGROUP DATA01 ADD ALIAS '+DATA01/ORCL/user01.dbf' FOR '+DATA01/mydb/datafile/my_ts.342.3';
  • Rename Alias:
ALTER DISKGROUP DATA01 RENAME ALIAS '+DATA01/ORCL/user01.dbf' TO '+DATA01/ORCL/user012.dbf';
  • Delete Alias:
ALTER DISKGROUP DATA01 DELETE ALIAS '+DATA01/ORCL/user01.dbf';

Dropping Files from ASM:

ALTER DISKGROUP DATA01 DROP FILE '+DATA01/ORCL/user01.dbf';




ASM Views

ASM provides several views for monitoring and managing ASM instances:

  • V$ASM_DISKGROUP: Lists disk groups managed by the ASM instance.
  • V$ASM_DISK: Displays disks, both part of disk groups and not, along with their status.
  • V$ASM_CLIENT: Displays database instances using ASM disk groups.
  • V$ASM_FILE: Lists files within disk groups.
  • V$ASM_ALIAS: Shows all aliases in use within ASM.
  • V$ASM_OPERATION: Displays ongoing long-running operations, such as rebalancing.


ASM Background Processes

ASM instances have various background processes to manage disk operations and communication with the database:

  1. ARBn (ASM Rebalance Process):
    Rebalances data extents across ASM disks.

  2. ASMB (ASM Background Process):
    Coordinates and communicates with the database instance for storage management tasks.

  3. GMON (ASM Disk Group Monitor):
    Monitors the health and status of mounted ASM disk groups.

  4. ABMR (Auto BMR Background Process):
    Manages automatic block media recovery (BMR) requests.

  5. ACFS (ASM Cluster File System):
    Manages the cluster file system in an ASM environment.

  6. Bnnn (ASM Blocking Slave Process):
    Helps GMON with maintenance tasks related to disk groups.





How to List Disk Groups in ASM:

Use the following commands to list disk groups in an ASM instance:

  1. Using SQL:
SELECT name, state FROM v$asm_diskgroup;
  1. Using ASM Command Line:

asmcmd lsdg







No comments:

Post a Comment

How to recovery PDB when PDB database is dropped in Oracle

  How to recovery PDB when PDB database is dropped :) [oracle@rac01 ~]$ sqlplus '/as sysdba' SQL*Plus: Release 21.0.0.0.0 - Product...