How to create ASM Diskgroup in silent mode


Below command will give list of all the disks that’s available for use.

[oracle@bunker ~]$ /usr/sbin/oracleasm listdisks
DATA01
DATA02
DATA03
DATA04
FRA01
OCRVOTE01

asmca -silent -creatediskgroup -diskGroupName DATA05 -disk ‘/dev/disk05’
-redundancy External
-compatible.asm=’11.2′
-compatible.rdbms=’11.2′

Disk Group DATA05 created successfully.

now we can go ahead and check it using below command

crsctl stat res -t |grep -A 2 ".dg"

 

 

 

 

 

 

ASM In Oracle


1) What is ASM?

In Oracle Database 10g/11g there are two types of instances: database and ASM instances. The ASM instance, which is generally named +ASM, is started with the INSTANCE_TYPE=ASM init.ora parameter. This parameter, when set, signals the Oracle initialization routine to start an ASM instance and not a standard database instance. Unlike the standard database instance, the ASM instance contains no physical files; such as logfiles, controlfiles or datafiles, and only requires a few init.ora parameters for startup.

Upon startup, an ASM instance will spawn all the basic background processes, plus some new ones that are specific to the operation of ASM. The STARTUP clauses for ASM instances are similar to those for database instances. For example, RESTRICT prevents database instances from connecting to this ASM instance. NOMOUNT starts up an ASM instance without mounting any disk group. MOUNT option simply mounts all defined diskgroups

For RAC configurations, the ASM SID is +ASMx instance, where x represents the instance number.

2) What are the key benefits of ASM?

ASM provides filesystem and volume manager capabilities built into the Oracle database kernel. Withthis capability, ASM simplifies storage management tasks, such as creating/laying out databases and disk space management. Since ASM allows disk management to be done using familiar create/alter/drop SQL statements, DBAs do not need to learn a new skill set or make crucial decisions on provisioning.

The following are some key benefits of ASM:

  • ASM spreads I/O evenly across all available disk drives to prevent hot spots and maximize performance.
  • ASM eliminates the need for over provisioning and maximizes storage resource utilization facilitating database consolidation.
  • Inherent large file support.
  • Performs automatic online redistribution after the incremental addition or removal of storage  capacity.
  • Maintains redundant copies of data to provide high availability, or leverages 3rd party RAID functionality.
  • Supports Oracle Database as well as Oracle Real Application Clusters (RAC).
  • Capable of leveraging 3rd party multipathing technologies.
  • For simplicity and easier migration to ASM, an Oracle database can contain ASM and non-ASM files.
  • Any new files can be created as ASM files whilst existing files can also be migrated to ASM.
  • RMAN commands enable non-ASM managed files to be relocated to an ASM disk group.
  • Enterprise Manager Database Control or Grid Control can be used to manage ASM disk and file activities.

3) Describe about ASM architecture.

Automatic Storage Management (ASM) instance

Instance that manages the diskgroup metadata

Disk Groups Logcal grouping of disks

Determines file mirroring options

ASM Disks LUNs presented to ASM

ASM Files Files that are stored in ASM disk groups are called ASM files, this includes database files

Notes:

Many databases can connect as clients to single ASM instances

ASM instance name should only be +ASM only

One diskgroup can serve many databases

4) How does database connects to ASM Instance?

The database communicates with ASM instance using the ASMB (umblicus process) process. Once the database obtains the necessary extents from extent map, all database IO going  forward is processed through by the database processes, bypassing ASM. Thus we say ASM is not really in the IO path. So, the question how do we make ASM go faster…..you don’t have to.

4) What init.ora parameters does a user need to configure for ASM instances?

The default parameter settings work perfectly for ASM. The only parameters needed for 11g ASM:

  • PROCESSES*
  • ASM_DISKSTRING*
  • ASM_DISKGROUPS
  • INSTANCE_TYPE

5) How does the database interact with the ASM instance and how do I make ASM go faster?

ASM is not in the I/O path so ASM does not impede the database file access. Since the RDBMS instance is performing raw I/O, the I/O is as fast as possible.

6) Do I need to define the RDBMS FILESYSTEMIO_OPTIONS parameter when I use ASM?

No. The RDBMS does I/O directly to the raw disk devices, the FILESYSTEMIO_OPTIONS  parameter is only for filesystems.

7) Why Oracle recommends two diskgroups?

Oracle recommends two diskgroups to provide a balance of manageability, utilization, and performance.

8) We have a 16 TB database. I’m curious about the number of disk groups we should use; e.g. 1 large disk group, a couple of disk groups, or otherwise?

For VLDBs you will probably end up with different storage tiers; e.g with some of our large customers they have Tier1 (RAID10 FC), Tier2 (RAID5 FC), Tier3 (SATA), etc. Each one of these is mapped to a diskgroup.

9) We have a new app and don’t know our access pattern, but assuming mostly sequential access, what size would be a good AU fit?

For 11g ASM/RDBMS it is recommended to use 4MB ASM AU for disk groups. See Metalink Note 810484.1

10) Would it be better to use BIGFILE tablespaces, or standard tablespaces for ASM?

The use of Bigfile tablespaces has no bearing on ASM (or vice versa). In fact most database object related decisions are transparent to ASM.

11) What is the best LUN size for ASM?

There is no best size! In most cases the storage team will dictate to you based on their standardized LUN size. The ASM administrator merely has to communicate the ASM Best Practices and application  characteristics to storage folks :

  • Need equally sized / performance LUNs
  • Minimum of 4 LUNs
  • The capacity requirement
  • The workload characteristic (random r/w, sequential r/w) & any response time SLA

Using this info , and their standards, the storage folks should build a nice LUN group set for you.

12) In 11g RAC we want to separate ASM admins from DBAs and create different users and groups. How do we set this up?

For clarification

  • Separate Oracle Home for ASM and RDBMS.
  • RDBMS instance connects to ASM using OSDBA group of the ASM instance.

Thus, software owner for each RDBMS instance connecting to ASM must be

a member of ASM’s OSDBA group.

  • Choose a different OSDBA group for ASM instance (asmdba) than for

RDBMS instance (dba)

  • In 11g, ASM administrator has to be member of a separate SYSASM group to

separate ASM Admin and DBAs.

13) Can my RDBMS and ASM instances run different versions?

Yes. ASM can be at a higher version or at lower version than its client databases. There’s two

components of compatiblity:

Software compatibility

Diskgroup compatibility attributes:compatible.asm

compatible.rdbms

14) Where do I run my database listener from; i.e., ASM HOME or DB HOME?

It is recommended to run the listener from the ASM HOME. This is particularly important for RAC env, since the listener is a node-level resource. In this config, you can create additional [user] listeners from the database homes as needed.

15) How do I backup my ASM instance?

Not applicable! ASM has no files to backup, as its does not contain controlfile,redo logs etc.

16) When should I use RMAN and when should I use ASMCMD copy?

    • RMAN is the recommended and most complete and flexible method to backup and transport database files in ASM.

ASMCMD copy is good for copying single files

  • Supports all Oracle file types
  • Can be used to instantiate a Data Guard environment
  • Does not update the controlfile
  • Does not create OMF files

17) I’m going to do add disks to my ASM diskgroup, how long will this rebalance take?

    • Rebalance time is heavily driven by the three items:

1) Amount of data currently in the diskgroup

2) IO bandwidth available on the server

3) ASM_POWER_LIMIT or Rebalance Power Level

18) We are migrating to a new storage array. How do I move my ASM database from storage A to storage B?

Given that the new and old storage are both visible to ASM, simply add the new disks to the ASM disk group and drop the old disks. ASM rebalance will migrate data online.

Note 428681.1 covers how to move OCR/Voting disks to the new storage array

19) Is it possible to unplug an ASM disk group from one platform and plug into a server on another platform (for example, from Solaris to Linux)?

No. Cross-platform disk group migration not supported. To move datafiles between endian-ness platforms, you need to use XTTS, Datapump or Streams.

20) How does ASM work with multipathing software?

It works great! Multipathing software is at a layer lower than ASM, and thus is transparent.

You may need to adjust ASM_DISKSTRING to specify only the path to the multipathing pseudo devices.

21) Is ASM constantly rebalancing to manage “hot spots”?

No…No…Nope!! ASM provides even distribution of extents across all disks in a disk group. Since each disk will equal number of extents, no single disk will be hotter than another. Thus the answer NO, ASM does not dynamically move hot spots, because hot spots simply do not

occur in ASM configurations. Rebalance only occurs on storage configuration changes (e.g. add, drop, or resize disks).

  1. Q) What are the file types that ASM support and keep in disk groups?

Control files

Flashback logs

Data Pump dump sets

Data files

DB SPFILE

Data Guard configuration

Temporary data files

RMAN backup sets

Change tracking bitmaps

Online redo logs

RMAN data file copies

OCR files

Archive logs

Transport data files

ASM SPFILE

  1. Q) List Key benefits of ASM?
  • Stripes files rather than logical volumes
  • Provides redundancy on a file basis
  • Enables online disk reconfiguration and dynamic rebalancing
  • Reduces the time significantly to resynchronize a transient failure by tracking changes while disk is offline
  • Provides adjustable rebalancing speed
  • Is cluster-aware
  • Supports reading from mirrored copy instead of primary copy for extended clusters
  • Is automatically installed as part of the Grid Infrastructure
  1. Q) What is ASM Striping?

ASM can use variable size data extents to support larger files, reduce memory requirements, and improve performance.

Each data extent resides on an individual disk.

Data extents consist of one or more allocation units.

The data extent size is:

  • Equal to AU for the first 20,000 extents (0–19999)
  • Equal to 4 × AU for the next 20,000 extents (20000–39999)
  • Equal to 16 × AU for extents above 40,000

ASM stripes files using extents with a coarse method for load balancing or a fine method to reduce latency.

  • Coarse-grained striping is always equal to the effective AU size.
  • Fine-grained striping is always equal to 128 KB.
  1. Q) How many ASM Diskgroups can be created under one ASM Instance?

ASM imposes the following limits:

  • 63 disk groups in a storage system
  • 10,000 ASM disks in a storage system
  • Two-terabyte maximum storage for each ASM disk (non-Exadata)
  • Four-petabyte maximum storage for each ASM disk (Exadata)
  • 40-exabyte maximum storage for each storage system
  • 1 million files for each disk group
  • ASM file size limits (database limit is 128 TB):
  1. External redundancy maximum file size is 140 PB.
  2. Normal redundancy maximum file size is 42 PB.
  3. High redundancy maximum file size is 15 PB.

27) What is a diskgroup?

A disk group consists of multiple disks and is the fundamental object that ASM manages. Each disk group contains the metadata that is required for the management of space in the disk group. The ASM instance manages the metadata about the files in a Disk Group in the same way that a file system manages metadata about its files. However, the vast majority of I/O operations do not pass through the ASM instance. In a moment we will look at how file

I/O works with respect to the ASM instance.

  1. Q) Diagram that how database interacts with ASM when a request is to read or open a datafile.

1A. Database issues open of a database file

1B. ASM sends the extent map for the file to database instance. Starting with 11g, the RDBMS only receives first 60 extents the remaining extents in the extent map are paged in on demand, providing a faster open

2A/2B. Database now reads directly from disk

3A.RDBMS foreground initiates a create tablespace for example

3B. ASM does the allocation for its essentially reserving the allocation units

for the file creation

3C. Once allocation phase is done, the extent map is sent to the RDBMS

3D. The RDBMS initialization phase kicks in. In this phase the initializes all

the reserved AUs

3E. If file creation is successful, then the RDBMS commits the file creation

Going forward all I/Os are done by the RDBMS directly.

  1. Q) Can my disks in a diskgroup can be varied size? For example one disk is of 100GB and another disk is of 50GB. If so how does ASM manage the extents?

Yes, disk sizes can be varied, Oracle ASM will manage data efficiently and intelligent by placing the extents proportional to the size of the disk in the disk group, bigger diskgroups have more extents than lesser ones.

Here I would like to share one of best Oracle ASM feature known as “ASM Fast Mirror Resync”

111

  • Fraction of time to re-establish redundancy
  • Only changed blocks are resynced.

 

Step by Step Oracle 10g Automatic Storage Management Setup


Automatic Storage Management:
=====================
Automatic Storage Management (ASM) is an integrated file system and volume manager expressly built for Oracle database files. ASM provides the performance of raw I/O with the easy management of a file system. It simplifies database administration by eliminating the need for you to directly manage potentially thousands of Oracle database files. It does this by enabling you to divide all available storage into disk groups. You manage a small set of disk groups and ASM automates the placement of the database files within those disk groups.

In the SQL statements that you use for creating database structures such as tablespaces, control files, and redo and archive log files, you specify file location in terms of disk groups. ASM then creates and manages the associated underlying files for you.

Why we need Automatic Storage Management to be implemented:

  • If we want to have a file bigger than the disk/mount.
  • For the best I/O throughput operations.
  • To save file system administration cost
  • For disk fault tolerance etc.

  • Note: I suppose, already you have your Linux machine ready and Oracle 10g RDBMS binaries installed in there.

    1. First create a directory to hold raw disks on a particular location.

    $ mkdir /u01/asmdisks

    2. Create RAW partitions:

    Note: Here I have used raw devices that have been using traditionally. We have some drawbacks of using raw devices like if our raw disk is 10GB in size and the file stored in it is 5GB then remaining 5GB space can’t be reclaimed and would be a waste of storage and it has high maintenance costs.

    —————————————————————————————————–

Here we create 4 zero-filed files using the DD comand,if specifies the input path. of specifies the output path. bs sets both input and output block sizes to n bytes, count copies only n input blocks.

[root@ora10srv bin]# dd if=/dev/zero of=/u01/asmdisks/disk1 bs=1024k count=1000

1000+0 records in
1000+0 records out

[root@ora10srv bin]# dd if=/dev/zero of=/u01/asmdisks/disk2 bs=1024k count=1000
1000+0 records in
1000+0 records out

[root@ora10srv bin]# dd if=/dev/zero of=/u01/asmdisks/disk3 bs=1024k count=1000
1000+0 records in
1000+0 records out

[root@ora10srv bin]# dd if=/dev/zero of=/u01/asmdisks/disk4 bs=1024k count=1000
1000+0 records in
1000+0 records out

Use the loopback device to assign these disks.

A loopback device in Linux is a virtual device that can be used like any other media device.The loopback filesystem associates a file on another filesystem as a complete device. This can then be formatted and mounted just like any of the other devices listed above. To do this the device called/dev/loop0 or /dev/loop1 etc is associated with the file and then this new virtual device is mounted.

[root@ora10srv bin]# /sbin/losetup /dev/loop1 /u01/asmdisks/disk1

[root@ora10srv bin]# /sbin/losetup /dev/loop2 /u01/asmdisks/disk2

[root@ora10srv bin]# /sbin/losetup /dev/loop3 /u01/asmdisks/disk3

[root@ora10srv bin]# /sbin/losetup /dev/loop4 /u01/asmdisks/disk4

To associate the character block device with a raw block device, Use the raw command to make the association.

[root@ora10srv bin]# raw /dev/raw/raw1 /dev/loop1
/dev/raw/raw1:  bound to major 7, minor 1

[root@ora10srv bin]# raw /dev/raw/raw2 /dev/loop2
/dev/raw/raw2:  bound to major 7, minor 2

[root@ora10srv bin]# raw /dev/raw/raw3 /dev/loop3
/dev/raw/raw3:  bound to major 7, minor 3

[root@ora10srv bin]# raw /dev/raw/raw4 /dev/loop4
/dev/raw/raw4:  bound to major 7, minor 4

Now, we need to change the permission for oracle user on the raw disks created above.

[oracle@ora10srv raw]$ cd /dev/raw

[oracle@ora10srv raw]$ chown -R oracle:oinstall *

[oracle@ora10srv raw]$ chmod 660 *

[oracle@ora10srv raw]$ ls -ltr
total 0
crw-rw—-  1 oracle oinstall 162, 1 Jan 28 13:39 raw1
crw-rw—-  1 oracle oinstall 162, 2 Jan 28 13:39 raw2
crw-rw—-  1 oracle oinstall 162, 3 Jan 28 13:39 raw3
crw-rw—-  1 oracle oinstall 162, 4 Jan 28 13:40 raw4

3. Before creating and starting ASM instance, CSS service must be up and running so in order to get your CSS service up and running just go to $ORACLE_HOME/bin and run the following command as root user to start CSS service.

[root@ora10srv bin]# ./localconfig add
Successfully accumulated necessary OCR keys.
Creating OCR keys for user ‘root’, privgrp ‘root’..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process…
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
ora10srv
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

4. Run DBCA to create ASM Instance and database:

[oracle@ora10srv bin]$ ./dbca

Here we choose – Configure Automatic Storage Management option to create and start an ASM instance.

Provide Password for SYS and click on Next.

Click on OK to create and start ASM instance.

Click on Create New to create the Disk group to be used for database files.

Here Provide Disk Group Name – DATA and select candidate disks and click on OK.

Disk group has been created and mounted now.

Click on Yes – in order to create database further.

Now you can see +ASM Instance has been setup successfully and running.

[oracle@ora10srv bin]# ps -ef | grep asm
oracle    5788  5787  0 13:42 pts/1    00:00:15 /u01/app/oracle/product/10.2.0/db_1/jdk/jre/bin/java -Dsun.java2d.font.DisableAlgorithmicStyles=true -DORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 -DDISPLAY=:0.0 -DJDBC_PROTOCOL=thin -mx128m -classpath /u01/app/oracle/product/10.2.0/db_1/jdk/jre/lib/rt.jar:/u01/app/oracle/product/10.2.0/db_1/jdk/jre/lib/i18n.jar:/u01/app/oracle/product/10.2.0/db_1/assistants/dbca/jlib/dbca.jar:/u01/app/oracle/product/10.2.0/db_1/assistants/jlib/assistantsCommon.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/ewt3.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/ewtcompat-3_3_15.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/share.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/help4.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/jewt4.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/oracle_ice5.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/kodiak.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/swingall-1_1_1.jar:/u01/app/oracle/product/10.2.0/db_1/lib/xmlparserv2.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/orai18n.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/orai18n-mapping.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/orai18n-utility.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/orai18n-collation.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/netcfg.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/ojmisc.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/oraclepki103.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/ldapjclnt10.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/opm.jar:/u01/app/oracle/product/10.2.0/db_1/jdbc/lib/classes12.zip:/u01/app/oracle/product/10.2.0/db_1/jlib/srvm.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/srvmhas.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/srvmasm.jar:/u01/app/oracle/product/10.2.0/db_1/classes:/u01/app/oracle/product/10.2.0/db_1/jlib/oemlt-10_1_0.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/emca.jar:/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar:/u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/oc4j.jar:/u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/db_oc4j_deploy.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/emConfigInstall.jar:/u01/app/oracle/product/10.2.0/db_1/oui/jlib/OraInstaller.jar:/u01/app/oracle/product/10.2.0/db_1/oui/jlib/OraPrereq.jar:/u01/app/oracle/product/10.2.0/db_1/inventory/prereqs/oui/OraPrereqChecks.jar:/u01/app/oracle/product/10.2.0/db_1/oui/jlib/OraPrereqChecks.jar oracle.sysman.assistants.dbca.Dbca
oracle   25656     1  0 14:39 ?        00:00:00 asm_pmon_+ASM
oracle   25658     1  0 14:39 ?        00:00:00 asm_psp0_+ASM
oracle   25660     1  0 14:39 ?        00:00:00 asm_mman_+ASM
oracle   25662     1  0 14:39 ?        00:00:01 asm_dbw0_+ASM
oracle   25664     1  0 14:39 ?        00:00:00 asm_lgwr_+ASM
oracle   25666     1  0 14:39 ?        00:00:00 asm_ckpt_+ASM
oracle   25668     1  0 14:39 ?        00:00:00 asm_smon_+ASM
oracle   25670     1  0 14:39 ?        00:00:00 asm_rbal_+ASM
oracle   25672     1  0 14:39 ?        00:00:00 asm_gmon_+ASM
root     25733  5496  0 14:42 pts/2    00:00:00 grep asm

[oracle@ora10srv bin]# ps -ef | grep pmon
oracle   25656     1  0 14:39 ?        00:00:00 asm_pmon_+ASM
root     25739  5496  0 14:43 pts/2    00:00:00 grep pmon

SQL> set linesize 220
SQL> select * from v$instance;

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME                                                        VERSION           STARTUP_T STATUS       PAR    THREAD# ARCHIVE LOG_SWITCH_WAIT LOGINS     SHU DATABASE_STATUS
————— —————- —————————————————————- —————– ——— ———— — ———- ——- ————— ———- — —————–
INSTANCE_ROLE      ACTIVE_ST BLO
—————— ——— —
1 +ASM             ora10srv                                                         10.2.0.3.0        28-JAN-15 STARTED      NO           0 STOPPED  ALLOWED    NO  ACTIVE
UNKNOWN            NORMAL    NO

Now, let’s proceed with database creation based on Automatic Storage Management.

Here we choose Automatic Storage Management(ASM) as our storage Mechanism.

Select disk groups to be used as storage for the database.

Now, let’s check with database login if our created database files are placed inside Automatic Storage Management.
[oracle@ora10srv bin]# ps -ef | grep pmon
oracle   25656     1  0 14:39 ?        00:00:00 asm_pmon_+ASM
oracle   26152     1  0 14:56 ?        00:00:00 ora_pmon_asmdb
root     26228  5496  0 15:01 pts/2    00:00:00 grep pmon
Enter user-name: sys as sysdba
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 – Production
With the Partitioning, OLAP and Data Mining options
SQL> set linesize 220
SQL> select name from v$datafile;
NAME
———————————————————
+DATA/asmdb/datafile/system.256.870187759
+DATA/asmdb/datafile/undotbs1.258.870187769
+DATA/asmdb/datafile/sysaux.257.870187763
+DATA/asmdb/datafile/users.259.870187771
SQL> select name from v$controlfile;
NAME
———————————————————–
+DATA/asmdb/controlfile/current.261.870188029
+DATA/asmdb/controlfile/current.260.870188031
Here we can see our database files are created inside Automatic Storage Management…………..!!
Hope it would help someone to setup ASM based database………….!!

Installing RPMs for ASMLIB


Problem:

You want to install packages for Oracle’s ASM libraries (ASMLIB). During the installation, you encounter dependency errors as you attempt to apply ASMLIB Linux packages.
Solution:

Installing Oracle’s ASMLIB has dependency requirements. You must install the RPMs in the following order:

1. oracleasm-support
2. oracleasm
3. oracleasmlib

If you attempt to apply RPMs in a different order than listed here, you will encounter the “Error: Failed dependencies” message. In the following example, ASMLIB RPMs will be installed and configured in the correct dependency order:

[root@gc oracle]# rpm -ihv oracleasm-support-2.0.3-1.i386.rpm Preparing… ########################################### [100%] 1:oracleasm-support ########################################### [100%]
[root@gc oracle]# rpm -ihv oracleasm-2.6.9-55.0.2.EL-2.0.3-1.i686.rpm Preparing… ########################################### [100%] 1:oracleasm-2.6.9-55.0.2.########################################### [100%]
[root@gc oracle]# rpm -ihv oracleasmlib-2.0.2-1.i386.rpm Preparing… ########################################### [100%] 1:oracleasmlib ########################################### [100%]
How It Works???

Oracle announced ASMLIB as a generic storage management interface concept to address disk management, discovery, and provisioning. ASMLIB was intended as an API for storage and operating system vendors to extend their storage core strengths and features such as perfor- mance and greater data integrity. Since the introduction of ASMLIB, Oracle released Oracle’s ASMLIB libraries only for the Linux operating system.

Managing ASM ACL With Command Line Utilities


Using SQL Statements to Manage Oracle ASM File Access Control

You can use the ALTER DISKGROUP SQL statement to manage file access control for Oracle ASM disk groups. These SQL statements are available for both database and Oracle ASM instances.

The SQL statements that support disk group access control are:

  • ALTER DISKGROUP ADD USERGROUP … WITH MEMBER

Adds an Oracle ASM user group to a disk group. The user group name is limited to a maximum of 30 characters. The databases identified in theMEMBER clause must be in the disk group, as shown by V$ASM_USER, or the command returns an error. Any users authenticated as SYSASM or SYSDBAcan create new user groups. For example:

SQL> SELECT group_number, os_name FROM V$ASM_USER;

GROUP_NUMBER OS_NAME

———— —————————————————————-

1 oracle1

1 oracle2

SQL> ALTER DISKGROUP data ADD USERGROUP ‘test_grp1’

WITH MEMBER ‘oracle1′,’oracle2’;

  • ALTER DISKGROUP DROP USERGROUP

Drops an Oracle ASM user group from a disk group. Dropping a group might leave some files without a valid group. For those files to have a valid group, you must manually update the group associated with those files to a valid group.

SQL> ALTER DISKGROUP data DROP USERGROUP ‘test_grp1’;

  • ALTER DISKGROUP MODIFY USERGROUP ADD MEMBER

Adds users to the specified user group. The users must be in the disk group, as shown by V$ASM_USER, or the command returns an error. Only the creator of the group or the Oracle ASM administrator can modify group membership.

SQL> ALTER DISKGROUP data MODIFY USERGROUP ‘test_grp2’ ADD MEMBER ‘oracle2’;

  • ALTER DISKGROUP MODIFY USERGROUP DROP MEMBER

Removes users from the specified user group. If a member is not in the user group, then an error is returned. Only the creator of the group or the Oracle ASM administrator can modify group membership.

SQL> ALTER DISKGROUP data MODIFY USERGROUP ‘test_grp2’ DROP MEMBER ‘oracle2’;

  • ALTER DISKGROUP ADD USER

Adds operating system (OS) users to an Oracle ASM disk group, so that these users can have access privileges on the disk group. The users must be existing operating system users, and their user names must have a corresponding operating system user ID or system ID. If a user exists in the disk group, as shown by V$ASM_USER, then the command records an error and continues to add other users, if any.

The operating system user of a running database instance is automatically added to a disk group when the database instance accesses that disk group and creates files. However, for a database instance to read files in a disk group without creating any files, then you must use the ADD USER clause to add that database user to the disk group. Also, you can use this clause to add a database user to an existing disk group immediately after setting the Oracle ASM File Access Control disk group attributes and before creating new files.

SQL>  ALTER DISKGROUP DATA ADD USER ‘oracle1’;

  • ALTER DISKGROUP DROP USER

Drops operating system users from an Oracle ASM disk group. If a user is not in the disk group, then this command records an error and continues to drop other users, if any.

If the user owns any files on the same Oracle ASM disk group, then this command fails with an error, unless the CASCADE keyword is specified. If the latter case, then the user is deleted, along with all the files that the user owns.

If any files owned by the user are currently open, then the DROP USERcommand fails, and no files are deleted.

SQL>  ALTER DISKGROUP DATA DROP USER ‘oracle1’;

  • ALTER DISKGROUP SET PERMISSION

Modifies permissions of an Oracle ASM file. Setting read only permission to a file that has read write permission revokes the write permission. Only the file owner or the Oracle ASM administrator can change the permissions of a file. You cannot change the permissions on an open file.

SQL> ALTER DISKGROUP data SET PERMISSION OWNER=read write, GROUP=read only,

OTHER=none FOR FILE ‘+data/controlfile.f’;

  • ALTER DISKGROUP SET OWNERSHIP

Changes the owner or group of a file to the specified user or user group name, respectively. If the specified user or user group name does not exist, this command fails with an error. Only the owner of the file or the Oracle ASM administrator can run this command, and only the Oracle ASM administrator can change the owner. Also, the user group name must exist, and the owner of the file must be a member of that group. You cannot change the ownership of an open file.

SQL> ALTER DISKGROUP data SET OWNERSHIP OWNER=’oracle1′, GROUP=’test_grp1′

FOR FILE ‘+data/controlfile.f’;

Which device is mapped Oracle ASM disk?


We can list the asm disks (listdisks) but where can we find the mapping that ASMDISK1 is mapped to /dev/sda1 and so on?  I want answer this question with this post.

If you  are using ASMLib for configure ASM Disks, then you can use following steps for define which device mapped which ASM Disk.

As you  know, oracleasm listdisks is return only ASM disk names

[grid@oel62-rac1 ~]$ oracleasm listdisks
ASMDISK01
ASMDISK02
ASMDISK03
ASMDISK04
ASMDISK05
[grid@oel62-rac1 ~]$


If you want find which ASM disk is mapped which device, then you must use oracleasm querydisk with ASM disk name.

[grid@oel62-rac1 ~]$ oracleasm querydisk -d ASMDISK01
Disk "ASMDISK01"  Is a valid ASM disk On device[8,17] 


As see you, ASMDISK01 is valid ASM disk on device [8,17].

What is means?

It means ASMDISK01 is mapped to device [8,17].

How to find [8,17] device?


We must use Linux ls –l  command as below.

[grid@oel62-rac1 ~]$ ls -l /dev/* | grep 8, | grep 17
brw-rw----  1 root disk  8,  17 Apr 16 15:27


Now, we can say ASMDISK01 is mapped to /dev/sdb1.