Forgot your password?    
+ Reply to Thread
Results 1 to 2 of 2

Thread: Step by Step Creation of ASM Instance

  1. #1
    Expert Oracle Administrator
    Join Date
    Oct 2011
    Posts
    120

    Step by Step Creation of ASM Instance

    Overview
    Automatic Storage Management (ASM) is a new feature in Oracle10g that alleviates the DBA from having to manually manage and tune disks used by Oracle databases. ASM provides the DBA with a file system and volume manager that makes use of an Oracle instance (referred to as an ASM instance) and can be managed using either SQL or Oracle Enterprise Manager.

    Only one ASM instance is required per node. The same ASM instance can manage ASM storage for all 10g databases running on the node.
    When the DBA installs the Oracle10g software and creates a new database, creating an ASM instance is a snap. The DBCA provides a simple check box and an easy wizard to create an ASM instance as well as an Oracle database that makes use of the new ASM instance for ASM storage. But, what happens when the DBA is migrating to Oracle10g or didn't opt to use ASM when a 10g database was first created. The DBA will need to know how to manually create an ASM instance and that is what this article provides.

    Configuring Oracle Cluster Synchronization Services (CSS)

    Automatic Storage Management (ASM) requires the use of Oracle Cluster Synchronization Services (CSS), and as such, CSS must be configured and running before attempting to use ASM. The CSS service is required to enable synchronization between an ASM instance and the database instances that rely on it for database file storage.

    In a non-RAC environment, the Oracle Universal Installer will configure and start a single-node version of the CSS service. For Oracle Real Application Clusters (RAC) installations, the CSS service is installed with Oracle Cluster Ready Services (CRS) in a separate Oracle home directory (also called the CRS home directory). For single-node installations, the CSS service is installed in and runs from the same Oracle home as the Oracle database.
    Because CSS must be running before any ASM instance or database instance starts, Oracle Universal Installer configures it to start automatically when the system starts. For Linux / UNIX platforms, the Oracle Universal Installer writes the CSS configuration tasks to the root.sh which is run by the DBA after the installation process.

    With Oracle10g R1, CSS was always configured regardless of whether you chose to configure ASM or not. On the Linux / UNIX platform, CSS was installed and configured via the root.sh script. This caused a lot of problems since many did not know what this process was, and for most of them, didn't want the CSS process running since they were not using ASM.

    Oracle listened carefully to the concerns (and strongly worded complaints) about the CSS process and in Oracle10g R2, will only configure this process when it is absolutely necessary. In Oracle10g R2, for example, if you don't choose to configure an ASM stand-alone instance or if you don't choose to configure a database that uses ASM storage, Oracle will not automatically configure CSS in the root.sh script.

    In the case where the CSS process is not configured to run on the node (see above), you can make use of the $ORACLE_HOME/bin/localconfig script in Linux / UNIX or %ORACLE_HOME%\bin\localconfig.bat batch file in Windows. For example in Linux, run the following command as root to configure CSS outside of the root.sh script after the fact:
    $ su
    # $ORACLE_HOME/bin/localconfig all

    Creating the ASM Instance
    The following steps can be used to create a fully functional ASM instance named +ASM. The node I am using in this example also has a regular 10g database running named PRODDB. These steps should all be carried out by the oracle UNIX user account:

    1. Create Admin Directories
    We start by creating the admin directories from the ORACLE_BASE. The admin directories for the existing database on this node, (PRODDB), is located at $ORACLE_BASE/admin/PRODDB. The new +ASM admin directories will be created alongside the PRODDB database:

    mkdir -p $ORACLE_BASE/admin/+ASM/bdump
    mkdir -p $ORACLE_BASE/admin/+ASM/cdump
    mkdir -p $ORACLE_BASE/admin/+ASM/hdump
    mkdir -p $ORACLE_BASE/admin/+ASM/pfile
    mkdir -p $ORACLE_BASE/admin/+ASM/udump

    2. Create Instance Parameter File
    In this step, we will manually create an instance parameter file for the ASM instance. This is actually an easy task as most of the parameters that are used for a normal instance are not used for an ASM instance. Note that you should be fine by accepting the default size for the database buffer cache, shared pool, and many of the other SGA memory sructures. The only exception is the large pool. I like to manually set this value to at least 12MB. In most cases, the SGA memory footprint is less then 100MB. Let's start by creating the file init.ora and placing that file in $ORACLE_BASE/admin/+ASM/pfile. The initial parameters to use for the file are:

    # vi $ORACLE_BASE/admin/+ASM/pfile/init.ora
    asm_diskstring='/dev/raw/*'

    background_dump_dest=/u01/app/oracle/admin/+ASM/bdump
    core_dump_dest=/u01/app/oracle/admin/+ASM/cdump
    user_dump_dest=/u01/app/oracle/admin/+ASM/udump
    instance_type=asm
    compatible=10.1.0.4.0
    large_pool_size=12M
    remote_login_passwordfile=exclusive
    After creating the $ORACLE_BASE/admin/+ASM/pfile/init.ora file, UNIX users should create the following symbolic link:
    $ ln -s $ORACLE_BASE/admin/+ASM/pfile/init.ora $ORACLE_HOME/dbs/init+ASM.ora

    Identify RAW Devices
    Before starting the ASM instance, we should identify the RAW device(s) (UNIX) or logical drives (Windows) that will be used as ASM disks. For the purpose of this article, I have four RAW devices setup on Linux:
    # ls -l /dev/raw/raw[1234]
    crw-rw---- 1 oracle dba 162, 1 Jun 2 22:04 /dev/raw/raw1
    crw-rw---- 1 oracle dba 162, 2 Jun 2 22:04 /dev/raw/raw2
    crw-rw---- 1 oracle dba 162, 3 Jun 2 22:04 /dev/raw/raw3
    crw-rw---- 1 oracle dba 162, 4 Jun 2 22:04 /dev/raw/raw4

    Starting the ASM Instance
    Once the instance parameter file is in place, it is time to start the ASM instance. It is important to note that an ASM instance never mounts an actual database. The ASM instance is responsible for mounting and managing disk groups.
    # su - oracle
    $ ORACLE_SID=+ASM; export ORACLE_SID
    $ sqlplus "/ as sysdba"

    SQL> startup

    SQL> create spfile from pfile='/u01/app/oracle/admin/+ASM/pfile/init.ora';

    SQL> shutdown
    ASM instance shutdown

    SQL> startup
    ASM instance started

    SQL> create spfile from pfile='C:\oracle\product\10.1.0\admin\+ASM\pfile\i nit.ora';
    File created.

    SQL> shutdown
    ASM instance shutdown

    SQL> startup
    ASM instance started
    You will notice when starting the ASM instance, we received the error:
    ORA-15110: no diskgroups mounted
    This error can be safely ignored.

    Notice also that we created a server parameter file (SPFILE) for the ASM instance. This allows Oracle to automatically record new disk group names in the asm_diskgroups instance parameter, so that those disk groups can be automatically mounted whenever the ASM instance is started.
    Now that the ASM instance is started, all other Oracle database instances running on the same node will be able to find it.

    Verify RAW / Logical Disk Are Discovered
    At this point, we have an ASM instance running, but no disk groups to speak of. ASM disk groups are created using from RAW (or logical) disks.
    Available (candidate) disks for ASM are discovered by use of the asm_diskstring instance parameter. This parameter contains the path(s) that Oracle will use to discover (or see) these candidate disks. In most cases, you shouldn't have to set this value as the default value is set for the supported platform.

    The following table is a list of default values for asm_diskstring on supported platforms when the value of the instance parameter is set to NULL (the value is not set):
    Operating System Default Search String
    Solaris (32/64 bit) /dev/rdsk/*
    Windows NT/XP \\.\orcldisk*
    Linux (32/64 bit) /dev/raw/*
    HP-UX /dev/rdsk/*
    HP-UX(Tru 64) /dev/rdisk/*
    AIX /dev/rhdisk/*

    I have four RAW devices setup on Linux: You can follow Creating san with openfiler present in this post to create the raw devices
    # ls -l /dev/raw/raw[1234]
    crw-rw---- 1 oracle dba 162, 1 Jun 2 22:04 /dev/raw/raw1
    crw-rw---- 1 oracle dba 162, 2 Jun 2 22:04 /dev/raw/raw2
    crw-rw---- 1 oracle dba 162, 3 Jun 2 22:04 /dev/raw/raw3
    crw-rw---- 1 oracle dba 162, 4 Jun 2 22:04 /dev/raw/raw4

    I now need to determine if Oracle can find these four disks. The view V$ASM_DISK can be queried from the ASM instance to determine which disks are being used or may potentially be used as ASM disks. Note that you must log into the ASM instance with SYSDBA privileges. Here is the query that I ran from the ASM instance:
    $ ORACLE_SID=+ASM; export ORACLE_SID
    $ sqlplus "/ as sysdba"

    SQL> SELECT group_number, disk_number, mount_status, header_status, state, path
    2 FROM v$asm_disk

    Note the value of zero in the GROUP_NUMBER column for all four disks. This indicates that a disk is available but hasn't yet been assigned to a disk group. The next section details the steps for creating a disk group.


    Continued in next post ....
    Last edited by Hemant; 12-15-2011 at 09:20 PM.

  2. #2
    Expert Oracle Administrator
    Join Date
    Oct 2011
    Location
    New Delhi, India
    Posts
    427
    Continued ...

    Creating Disk Groups
    Disk Group Mirroring and Failure Groups
    Before defining the type of mirroring within a disk group, you must group disks into failure groups. A failure group is one or more disks within a disk group that share a common resource, such as a disk controller, whose failure would cause the entire set of disks to be unavailable to the group. In most cases, an ASM instance does not know the hardware and software dependencies for a given disk. Therefore, unless you specifically assign a disk to a failure group, each disk in a disk group is assigned to its own failure group. Once the failure groups have been defined, you can define the mirroring for the disk group; the number of failure groups available within a disk group can restrict the type of mirroring available for the disk group. There are three types of mirroring available: external redundancy, normal redundancy, and high redundancy.

    External Redundancy External redundancy requires only one disk location and assumes that the disk is not critical to the ongoing operation of the database or that the disk is managed externally with high-availability hardware such as a RAID controller.

    Normal Redundancy Normal redundancy provides two-way mirroring and requires at least two failure groups within a disk group. Failure of one of the disks in a failure group does not cause any downtime for the disk group or any data loss other than a slight performance hit for queries against objects in the disk group; when all disks in the failure group are online, read performance is typically improved because the requested data is available on more than one disk.

    High Redundancy High redundancy provides three-way mirroring and requires at least three failure groups within a disk group. The failure of disks in two out of the three failure groups is for the most part transparent to the database users, as in normal redundancy mirroring. Mirroring is managed at a very low level. Extents, not disks, are mirrored. In addition, each disk will have a mixture of both primary and mirrored (secondary and tertiary) extents on each disk. Although a slight amount of overhead is incurred for managing mirroring at the extent level, it provides the advantage of spreading out the load from the failed disk to all other disks instead of a single disk.

    Disk Group Dynamic Rebalancing
    Whenever you change the configuration of a disk group—whether you are adding or removing a failure group or a disk within a failure group—dynamic rebalancing occurs automatically to proportionally reallocate data from other members of the disk group to the new member of the disk group. This rebalance occurs while the database is online and available to users; any impact to ongoing database I/O can be controlled by adjusting the value of the initialization parameter ASM_POWER_LIMIT to a lower value. Not only does dynamic rebalancing free you from the tedious and often error-prone task of identifying hot spots in a disk group, it also provides an automatic way to migrate an entire database from a set of slower disks to a set of faster disks while the entire database remains online. Faster disks are added as a new failure group in the existing disk group with the slower disks and the automatic rebalance occurs. After the rebalance operations complete, the failure groups containing the slower disks are dropped, leaving a disk group with only fast disks. To make this operation even faster, both the add and drop operations can be initiated within the same alter diskgroup command.

    Create new DiskGroup
    Now I will create a new disk group named PRODDB_DATA1 and assign all four discovered disks to it. The disk group will be configured for NORMAL REDUNDANCY which results in two-way mirroring of al files within the disk group. Within the disk group, I will be configuring two failure groups, which defines two independent sets of disk that should never contain more than one copy of mirrored data (mirrored extents).
    The new disk group should be created from the ASM instance using the following SQL:
    SQL> CREATE DISKGROUP PRODDB_data1 NORMAL REDUNDANCY
    2 FAILGROUP controller1 DISK '/dev/raw/raw1', '/dev/raw/raw2'
    3 FAILGROUP controller2 DISK '/dev/raw/raw3', '/dev/raw/raw4';


    Diskgroup created.

    Now, let's take a look at the new disk group and disk details:
    SQL> select group_number, name, total_mb, free_mb, state, type
    2 from v$asm_diskgroup;


    SQL> select group_number, disk_number, mount_status, header_status, state, path, failgroup
    2 from v$asm_disk;

    Using Disk Groups
    Finally, let's start making use of the new disk group! Disk groups can be used in place of actual file names when creating database files, redo log members, control files, etc.
    Let's now login to the database instance running on the node that will be making use of the new ASM instance. I had a database instance already created and running on the node named PRODDB. The database was created using the local file system for all database files, redo log members, and control files:

    $ ORACLE_SID=PRODDB; export ORACLE_SID
    $ sqlplus "/ as sysdba"

    SQL> @dba_files_all

    Let's now create a new tablespace that makes use of the new disk group:
    SQL> create tablespace users2 datafile '+PRODDB_DATA1' size 100m;

    Tablespace created.

    And that's it! The CREATE TABLESPACE command (above) uses a datafile named +PRODDB_DATA1. Note that the plus sign (+) in front of the name PRODDB_DATA1 indicates to Oracle that this name is a disk group name, and not an operating system file name. In this example, the PRODDB instance queries the ASM instance for a new file in that disk group and uses that file for the tablespace data. Let's take a look at that new file name:
    SQL> @dba_files_all

    APPENDEX A
    Contents of dba_files_all.sql
    SET LINESIZE 147
    SET PAGESIZE 9999
    SET VERIFY OFF

    COLUMN tablespace FORMAT a29 HEADING 'Tablespace Name / File Class'
    COLUMN filename FORMAT a64 HEADING 'Filename'
    COLUMN filesize FORMAT 99,999,999,999 HEADING 'File Size'
    COLUMN autoextensible FORMAT a4 HEADING 'Auto'
    COLUMN increment_by FORMAT 99,999,999,999 HEADING 'Next'
    COLUMN maxbytes FORMAT 99,999,999,999 HEADING 'Max'

    BREAK ON report
    COMPUTE SUM OF filesize ON report

    SELECT /*+ ordered */
    d.tablespace_name tablespace
    , d.file_name filename
    , d.bytes filesize
    , d.autoextensible autoextensible
    , d.increment_by * e.value increment_by
    , d.maxbytes maxbytes
    FROM
    sys.dba_data_files d , v$datafile v , (SELECT value FROM v$parameter WHERE name = 'db_block_size') e
    WHERE
    (d.file_name = v.name)
    UNION
    SELECT
    d.tablespace_name tablespace
    , d.file_name filename
    , d.bytes filesize
    , d.autoextensible autoextensible
    , d.increment_by * e.value increment_by
    , d.maxbytes maxbytes
    FROM
    sys.dba_temp_files d , (SELECT value FROM v$parameter WHERE name = 'db_block_size') e
    UNION
    SELECT '[ ONLINE REDO LOG ]' , a.member , b.bytes , null , TO_NUMBER(null), TO_NUMBER(null)
    FROM v$logfile a , v$log b
    WHERE a.group# = b.group#
    UNION
    SELECT '[ CONTROL FILE ]' , a.name , TO_NUMBER(null) , null , TO_NUMBER(null), TO_NUMBER(null)
    FROM v$controlfile a ORDER BY 1,2
    /

+ Reply to Thread

Similar Threads

  1. Oracle 11g Manual Database Creation.
    By ajaychandi in forum Core Database Administration and Monitoring
    Replies: 1
    Last Post: 03-13-2013, 06:24 PM
  2. Oracle RAC 11gR2 Policy Managed Database Creation using DBCA Part 2.
    By ajaychandi in forum RAC Installation, ASM Install , ASM Administration
    Replies: 0
    Last Post: 02-26-2013, 07:14 PM
  3. Oracle RAC 11gR2 Policy Managed Database Creation using DBCA Part 1.
    By ajaychandi in forum RAC Installation, ASM Install , ASM Administration
    Replies: 0
    Last Post: 02-26-2013, 07:11 PM
  4. Manually DB Creation with 9i
    By devesh_ocp in forum Database Installation,Upgrades,Migration,Patching and Cloning
    Replies: 0
    Last Post: 04-24-2012, 10:47 PM
  5. RMAN Catalog Creation.
    By ajaychandi in forum Backup, Restoration & Recovery, RMAN, Flashback, Datapump, Export, Import
    Replies: 0
    Last Post: 02-18-2012, 12:19 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

DBA Lounge (P) Ltd. deals in Oracle Technologies on Consulting, Resourcing, Corporate Training


Online and corporate training available on Oracle Database 11g, Oracle 11g Real Application Cluster (RAC), Oracle Applications 11i/R12, Oracle Fusion Middleware 11g, Oracle Identity Management-OIM, Oracle Internet Directory 11g-OID, Oracle Business Intelligence Enterprise Edition-OBIEE, Oracle Golden Gate, Oracle Access Management-OAM, Oracle Internet Directory-ODS, Oracle Identity Analytics Architecture-OIA Statistics