Oracle

Oracle ASM Automatic Storage Management-26

Advertisements

ASM – Automatic Storage Management

It’s an oracle 10g feature. ASM is same as normal database instead of storing a DB files on normal filesystem. It will store a file an ASM managed file system, which will give disk redundancy. It only prevents a disk failure not the instance failure.

 

ASM uses a disk group to store the oracle files. A disk group is a collection of disks.

It supports single-instance and (Oracle RAC) configurations.

ASM only supports for external disk. External disk should be a raw disk, mostly a RAID.

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

RAID – Redundancy array of independent disk –

Types: RAID – 0, 1 & 5. In RAID 5 – Normal parity (Striping + Mirroring) & Distributed parity (It will distribute the data)

ASM only supports for external disk. External disk should be a raw disk.

Ex:

/dev/sdb ,/dev/sdc, /dev/sdd etc..

Read & write will be fast for raw disks. Since, normal disk will have OS disk level configuration etc.

We can do file mirroring and striping by using ASM.

 

Create volume in storage.

Create LUN.

EX: Storage team task

Storagehost> df –Ah

Aggr1 100T 500T 5ooT

Storagehost> vol create vol_data1 aggr1 150g

snapdrive storage create –lun  Storagehost:/vol/vol_data1/lun2  -lunsize 100g

Lun created – /dev/sdb

 

DBAs requirement to storage team: 10*100 dedicated raw disk

Change the owner of all disks 10 disks.

chown –R oracle:oinstsll /dev/sdb etc..

Note:  We can also change the internal disk as external by using converting.

 

ASM components

Disk group – It is a logical one, more than one physical disk can be divided as a logical group.

Minimum two disk group needed for the database.

DG1 – CRD file

DG2 – Flash recovery area (Archive, RMAN backup etc)

In diskgroup, we can add and remove disks.

For adding and removing, rebalancing will be run, since it’s a RAID.

 

DISK

It’s a physical disk. Data will be stored here.

A disk can be a shared, more than one diskgroup. For that we need to use force option.

Ex: D1 — DG1 & DG2.

Normal DB ASM DB
/opt/ * dbf, log  etc /dev/sdb/ * NO
It’s a physical mount point It’s a raw disk, create disk group to use

 

ASM Instance – It is used to mount and manage the disk group.

+ASM  – It is instance.

A server can have only one ASM instance.

We can have more disk group and DB instance.

 

ASM instances mount disk groups to make ASM files available to database instances; ASM instances do not mount databases.

ASM instances manage the metadata of the disk group and provide file layout information to the database instances.

ASM instances can be clustered using Oracle Clusterware; there is one ASM instance for each cluster node. If there are several database instances for different databases on the same node, then the database instances share the same single ASM instance on that node.

If the ASM instance on a node fails, then all of the database instances on that node also fail. Unlike a file system failure, an ASM instance failure does not require restarting the operating system. In an Oracle RAC environment, the ASM and database instances on the surviving nodes automatically recover from an ASM instance failure on a node.

 

EX:

Linux server 1:

+ASM DB
DG1 Muthu DB
DG2  “
DG3 Rajesh DB
DG4  “
DG5 Test DB
DG6  “

 

Parameter file of ASM:

Init+ASM.ora or spfile+ASM.ora – $ORACLE_HOME/dbs

$ vi init+ASM.ora

Instance_type = ASM (rdbms – for normal db)

Db_unique_name = +ASM

  • all the other normal database parameters.

ASM parameters:

  1. ASM_diskgropus=’DG1’,’DG2’,’DG3’,’DG4’,’DG5’,’DG6’
  2. ASM_disk_strings=’/dev/sdb’,’/dev/sdc, … etc
  3. ASM_power_limit= [o-11] – 1 is default.

0- is diable, 1 – slow , 2- fast … 11 – super fast. It is for rebalancing.

Note: Rebalancing will be slow down the Database. It should be done in maintenance time.

 

Manual ASM instance creation:

 

$ export ORACLE_SID= +ASM

$ orapwd file = $ORACLE_HOME/dbs/orapw+ASM password=sys

$ sqlplus /nolog

Sql> startup pfile= ‘/opt/init=ASM.ora’

Sql> create spfile from pfile=’/optinit+ASM.ora’;

Sql> shutdown immediate

Sql> startup

 

Manning ASM disk group

  1. Failover group
  2. Rebalancing

Failover group

Types of ASM Disk groups:

Mirroring options

  1. None (External) – No mirroring
  2. Normal (2 mirroring allowed)
  3. High ( 3 – Mirroring)

All the disks should be same size. For external extent can be different size.

 

External redundancy disk creation

Sql> create diskgroup dg1 external redundancy disk ‘/dev/sdb’,’ /dev/sdc’, /dev/sdd’;

 

Normal redundancy disk creation

Sql> create diskgroup dg1 normal redundancy

Failgroup fg1 disk ‘/dev/sdb’,’ /dev/sdc’, /dev/sdd’

Failgroup fg2 disk ‘/dev/sde’,’ /dev/sdf’, /dev/sdg’;

 

high redundancy disk creation

Sql> create diskgroup dg1 high redundancy

Failgroup fg1 disk ‘/dev/sdb’,’ /dev/sdc’, /dev/sdd’

Failgroup fg2 disk ‘/dev/sde’,’ /dev/sdf’, /dev/sdg’

Failgroup fg2 disk ‘/dev/sdh’,’ /dev/sdi’, /dev/sdj’;

 

Adding disk into DG

 

Sql> alter diskgroup dg1 add disk = ‘/dev/sdk’, ‘/dev/sdl’, ‘/dev/sdm’;

Sql> alter diskgroup dg1 drop add disk = ‘/dev/sdk’, ‘/dev/sdl’;

Note: Rebalancing will be done for adding & dropping disks. This can be run by RBAL BG.

 

Scenario

ASM power limit is zero. I need to delete a disk, but without data loss. Since 0 – will not rebalance.

 

For that we need to set a power limit for particular disk group.

Sql> alter diskgroup dg1 rebalance power 10;

Sql> alter diskgroup dg2 drop disk ‘/dev/sdk,..’;

 

How to mount a disk group:

Ex: normal Db  df –h

ASM – DG1

Sql> alter diskgroup dg1 mount;

Sql> alter diskgroup dg1 dismount;

Sql> drop diskgroup dg1;

Sql> alter diskgroup dg1 including contents;

 

How to create a ASM using a GUI

For version 10g & 11g R1

$ dbca

— Configure ASM –Sys password –Create –Dgname: DG1–External– Choose disk –ok

 

Components

ASM files:

It’s a physical file. To manage we have methods.

  1. OMF – Oracle managed files – from 9i
  2. UMF – User managed files

 

Types Normal ASM
UMF sql> create tablespace <tools> datafile ‘/opt/oracle/tools.dbf’ size 100m; sql> create tablespace <tools> datafile ‘+DG1’ size 100m;
OMF sql> create tablespace <tools>; sql> create tablespace <tools>;

 

For OMF – Oracle will create a file in the default file location.

Show parameter db_create_file_dest;

 

ASM filename:

It’s a fully qualified name. It will take it automatically.

Syntax: <+dgname>/<dbname>/<filetype>/<tag.file#.incarnation>

(Disk group, DB, .dbf or log, tbs name, file#, 8 digit number)

 

Sql> create tablespace tools datafile ‘+DG1’ size 100m;

Sql> select filename from dba_data_files where tablespace_name=’tools’;

Result: +DG1/Muthu/datafile/tools.01.17171314. – FQN.

You can also give a filepath /opt/oracle..

You can also change to valid name by using alias name.

Alias ASM filename

$ export ORACLE_SID=+ASM

Sql> alter diskgroup dg1 add alias file ‘+DG1/Muthu/datafile/tools.dbf’ for ‘+DG1/Muthu/datafile/tools.01.17171314’;

 

Sql> alter diskgroup dg1 drop file ‘+DG1/Muthu/datafile/tools.dbf’;

ASM instance startup & shutdown

Startup:

  1. ASM instance
  2. Database instance

Shutdown

  1. Database instance
  2. ASM instance

 

Normal DB ASM
Physical mount point Logical
/opt/*.dbf,.log +DG1/*.dbf,.log
$ cd /opt $export ORACLE_SID=+ASM
$ ls $ asmcmd
asmcmd> ls

 

 

In 11G R2 onwards, we cannot use DBCA to create an ASM disk group.

10G & 11G R1, Database and ASM will be in single ORACLE OHME.

Ex: /opt/oracle/product/10.2.0/db_1

11G R2, DB — oracle software/database & ASM — Grid infrastructure software — ASM

 

Software:

 

DB:

p1….10f7.zip

p1….20f7.zip

ASM: p1….30f7.zip – 900MB.

For installation, we need to install ASM software first and then databases. We need to create two users for that and both will be in different OH.

ASM Home

/opt/app/grid/product/11/2.0/gridhome

 

Database Home

/opt/app/grid/product/11/2.0/dbhome

$ export ORACLE_HOME & ORACLR_PATH or change it in the bash_profile.

 

$ asmca – ASM configuration assistance

Enter Sys password — same as like pervious one 10g.

For DB creation, wherever we give a location, we need to give a disk group name instead.

 

ASM V$ Views

 

V$asm_diskgroup, v$asm_disk, v$asm_alias, v$asm_file, v$asm_operation ,… etc

ASM alert log file: 11g /opt/oracle/diag/ASM/+ASM/trace/Alert_+ASM.log

 

I’m currently working as a SQL server DBA in one of the top MNC. I’m passionate about SQL Server And I’m specialized in Administration and Performance tuning. I’m an active member of SQL server Central and MSDN forum. I also write articles in SQL server Central. For more Click here

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 24 = 25