Sunday, January 22, 2012

ASM (Automatic Storage Management)

ASM (Automatic Storage Management)

In summary ASM provides the following functionality:

1. Manages groups of disks, called disk groups.
2. Manages disk redundancy within a disk group.
3. Provides near-optimal I/O balancing without any manual tuning.
4. Enables management of database objects without specifying mount points and filenames.
5. Supports large files.

Initialization Parameters and ASM Instance Creation

The initialization parameters that are of specific interest for an ASM instance are:

1. INSTANCE_TYPE - Set to ASM or RDBMS depending on the instance type. The default is RDBMS.
2. DB_UNIQUE_NAME - Specifies a globally unique name for the database. This defaults to +ASM but must be altered if you intend to run multiple ASM instances.
3. ASM_POWER_LIMIT -The maximum power for a rebalancing operation on an ASM instance. The valid values range from 1 to 11, with 1 being the default. The higher the limit the more resources are allocated resulting in faster rebalancing operations. This value is also used as the default when  the POWER clause is omitted from a rebalance operation.
4. ASM_DISKGROUPS - The list of disk groups that should be mounted by an ASM instance during instance startup, or by the ALTER DISKGROUP ALL MOUNT statement. 
5. ASM configuration changes are automatically reflected in this parameter.
6. ASM_DISKSTRING - Specifies a value that can be used to limit the disks considered for discovery. Altering the default value may improve the speed of disk  group mount time and the speed of adding a disk to a disk group. Changing the parameter to a value which prevents the discovery of                          already mounted disks results in an error. The default value is NULL allowing all suitable disks to be considered.

Startup and Shutdown of ASM Instances

ASM instance are started and stopped in a similar way to normal database instances. The options for the STARTUP commands are:

FORCE - Performs a SHUTDOWN ABORT before restarting the ASM instance.
MOUNT - Starts the ASM instance and mounts the disk groups specified by the ASM_DISKGROUPS parameter.
NOMOUNT - Starts the ASM instance without mounting any disk groups.
OPEN - This is not a valid option for an ASM instance.
The options for the SHUTDOWN command are:

NORMAL - The ASM instance waits for all connected ASM instances and SQL sessions to exit then shuts down.
IMMEDIATE - The ASM instance waits for any SQL transactions to complete then shuts down. It doesn't wait for sessions to exit.
TRANSACTIONAL - Same as IMMEDIATE.
ABORT - The ASM instance shuts down instantly.
Disks

Disk groups are created using the CREATE DISKGROUP statement. This statement allows you to specify the level of redundancy:

1. NORMAL REDUNDANCY - Two-way mirroring, requiring two failure groups.
2. HIGH REDUNDANCY - Three-way mirroring, requiring three failure groups.
3. EXTERNAL REDUNDANCY - No mirroring for disks that are already protected using hardware mirroring or RAID. If you have hardware RAID it should be used in preference to ASM redundancy, so this will be the standard option for most installations.

Disk group creation

CREATE DISKGROUP disk_group_1 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;

Drop Disk group

DROP DISKGROUP disk_group_1 INCLUDING CONTENTS;

Add Disks to disk group

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

Delete Disks from Disk group

ALTER DISKGROUP disk_group_1 DROP DISK diska2;

Resize Disks

-- Resize a specific disk.
ALTER DISKGROUP disk_group_1
  RESIZE DISK diska1 SIZE 100G;

-- Resize all disks in a failure group.
ALTER DISKGROUP disk_group_1
  RESIZE DISKS IN FAILGROUP failure_group_1 SIZE 100G;

-- Resize all disks in a disk group.
ALTER DISKGROUP disk_group_1
  RESIZE ALL SIZE 100G;

Undrop diskgroup

ALTER DISKGROUP disk_group_1 UNDROP DISKS;

Rebalancing Diskgroup

ALTER DISKGROUP disk_group_1 REBALANCE POWER 5;

Disk group mount/unmount

ALTER DISKGROUP ALL DISMOUNT;
ALTER DISKGROUP ALL MOUNT;
ALTER DISKGROUP disk_group_1 DISMOUNT;
ALTER DISKGROUP disk_group_1 MOUNT;

Directories

-- Create a directory.
ALTER DISKGROUP disk_group_1 ADD DIRECTORY '+disk_group_1/my_dir';

-- Rename a directory.
ALTER DISKGROUP disk_group_1 RENAME DIRECTORY '+disk_group_1/my_dir' TO '+disk_group_1/my_dir_2';

-- Delete a directory and all its contents.
ALTER DISKGROUP disk_group_1 DROP DIRECTORY '+disk_group_1/my_dir_2' FORCE;

Aliases

-- Create an alias using the fully qualified filename.
ALTER DISKGROUP disk_group_1 ADD ALIAS '+disk_group_1/my_dir/my_file.dbf'
  FOR '+disk_group_1/mydb/datafile/my_ts.342.3';

-- Create an alias using the numeric form filename.
ALTER DISKGROUP disk_group_1 ADD ALIAS '+disk_group_1/my_dir/my_file.dbf'
  FOR '+disk_group_1.342.3';

-- Rename an alias.
ALTER DISKGROUP disk_group_1 RENAME ALIAS '+disk_group_1/my_dir/my_file.dbf'
  TO '+disk_group_1/my_dir/my_file2.dbf';

-- Delete an alias.
ALTER DISKGROUP disk_group_1 DELETE ALIAS '+disk_group_1/my_dir/my_file.dbf';

Files

-- Drop file using an alias.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/my_dir/my_file.dbf';

-- Drop file using a numeric form filename.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1.342.3';

-- Drop file using a fully qualified filename.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/mydb/datafile/my_ts.342.3';

Checking metadata

-- Check metadata for a specific file.
ALTER DISKGROUP disk_group_1 CHECK FILE '+disk_group_1/my_dir/my_file.dbf'

-- Check metadata for a specific failure group in the disk group.
ALTER DISKGROUP disk_group_1 CHECK FAILGROUP failure_group_1;

-- Check metadata for a specific disk in the disk group.
ALTER DISKGROUP disk_group_1 CHECK DISK diska1;

-- Check metadata for all disks in the disk group.
ALTER DISKGROUP disk_group_1 CHECK ALL;

Change compatible attribute for a diskgroup

alter diskgroup DG_ASM1POC_DT_01 set attribute 'compatible.rdbms'='10.2.0.5'; This parameter cannot be lowered.

Start/stop diskgroups

srvctl start diskgroup -g DG_ASM1POC_DT_01 -n lnxdb-svl-02,lnxdb-svl-03,lnxdb-svl-04

srvctl stop diskgroup -g DG_ASM1POC_DT_01 -n lnxdb-svl-02,lnxdb-svl-03,lnxdb-svl-04

How to list the diskgroups in ASM instance?

sqlplus / as sysasm
select name, state from v$asm_diskgroup;
or
asmcmd lsdg or 
asmcmd ls

ASM Views

ViewASM InstanceDB Instance
V$ASM_ALIASDisplays a row for each alias present in every disk group mounted by the ASM instance.Returns no rows
V$ASM_CLIENTDisplays a row for each database instance using a disk group managed by the ASM instance.Displays a row for the ASM instance if the database has open ASM files.
V$ASM_DISKDisplays a row for each disk discovered by the ASM instance, including disks which are not part of any disk group.Displays a row for each disk in disk groups in use by the database instance.
V$ASM_DISKGROUPDisplays a row for each disk group discovered by the ASM instance.Displays a row for each disk group mounted by the local ASM instance.
V$ASM_FILEDisplays a row for each file for each disk group mounted by the ASM instance.Displays no rows.
V$ASM_OPERATIONDisplays a row for each file for each long running operation executing in the ASM instance.Displays no rows.
V$ASM_TEMPLATEDisplays a row for each template present in each disk group mounted by the ASM instance.Displays a row for each template present in each disk group mounted by the ASM instance with which the database instance communicates.

ASM Background processes

1. ARBn - ASM Rebalance Process , Rebalances data extents within an ASM disk group
2. ASMB - ASM Background Process. Communicates with the ASM instance, managing storage and providing statistics
3. GMON - ASM Disk Group Monitor Process. Monitors all mounted ASM disk groups
4. ABMR - Auto BMR Background Process. Coordinates execution of tasks such as filtering duplicate block media recovery requests and performing flood control.
5. ACFS - ASM Cluster File System CSS Process. Tracks the cluster membership in CSS and informs the file system driver of membership changes.
6. Bnnn - ASM Blocking Slave Process for GMON. Performs maintenance actions on ASM disk groups 
7. CTWR - Change Tracking Writer Process. Tracks the cluster membership in CSS and informs the file system driver of membership changes 
8. LMON - Global Enqueue Service Monitor Process. Monitors an Oracle RAC cluster to manage global resources 
9. LMSn - Global Cache Service Process. Manages resources and provides resource control among Oracle RAC instances 
10. RMSn - Oracle RAC Management Process. Performs manageability tasks for Oracle RAC

Reference : oracle-base.com

Post a Comment

Autoconfig post 12C upgrade from 11g failed with "ORA-01804: failure to initialize timezone information"

Autoconfig post 12C upgrade from 11g failed with "ORA-01804: failure to initialize timezone information" Error DB Autoconfig ...