Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Wednesday, 11 July 2012

Configuring ASM on Linux as well as windows‎

Database: Oracle
OS: Windows/Linux
Methodology: Not Raw/Logical Disk
Interface: Instance Creation with DBCA and DiskGroup through Command line
Similar to database creation you can use DBCA to create ASM too. You can create ASM instance at any time regardless if a database already exist or not. Here in below example you find the snaps of main steps.
1. Start DBCA and Select “Configure Automatic Storage Management” and click next.

2. Enter the SYS passwords for new ASM instance to be created.

Note: If you attempt to create an ASM instance and CSS is not configured, then Oracle will prompt you to install CSS first. How to install CSS Click on the link: CSS

After installing CSS (if required) you will finally find the confirmation message, click on OK

3. Oracle will then create the ASM instance. A new window will appear giving you the option to create new disk groups. You can choose to create disk groups or you can click on finish to complete the ASM instillation only leaving to disk group creation later. Here in the below example we will manually create the disk group.
4. The name of the resulting instance will be +ASM. You can check or log into the ASM instance from SQL*Plus.
On windows:
C:\>Sqlplus sys/test1 as sysdba
$ sqlplus "/ as sysdba"
SQL*Plus: Release - Production on Tue Jul 03 11:33:45 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup;
ASM instance started
Total System Global Area   83886080 bytes
Fixed Size                  1247420 bytes
Variable Size              57472836 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
When you first start the ASM instance, you will see this error:
ORA-15110: no diskgroups mounted
This indicates that no ASM disk groups have yet been allocated to the ASM instance. Shutdown the instance and first create ASM disk groups.
SQL> shutdown;   
Note: If you execute a normal or immediate shutdown command on an ASM instance, that shutdown will fail if there is any database using that ASM instance. An error will be returned and the ASM instance will stay up. As a result, before you shutdown the ASM instance, you will need to shutdown all databases using that ASM instance. You can perform a shutdown abort on the ASM instance. This will cause the ASM instance to shutdown immediately and all of the associated databases will be shutdown in an inconsistent state. This will require instance recovery when the databases are re-started, which can increase the time it takes to re-open the database. Oracle recommends that you not use the shutdown abort command when stopping an ASM instance.
Verify RAW/Logical Disk Are Discovered
At this point, we have an ASM instance running, but no disk groups. 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)
Windows NT/XP
Linux (32/64 bit)
HP-UX(Tru 64)

SQL>Alter system set ASM_DISKSTRING='D:\oracle\asmdisk\_file*';
In this example, we will point ASM to look for disks in devices when we create disk groups.
We will also need to set a hidden parameter called _ASM_ALLOW_ONLY_RAW_DISKS to allow ASM to see non-raw disks.
SQL>Alter system set "_asm_allow_only_raw_disks"=false scope=spfile;
You can query the V$ASM_ATTRIBUTE view to see the individual attributes assigned to a given disk group.
SELECT group_number,name,value FROM v$asm_attribute ORDER BY group_number, name;
When the ASM instance is started, it will use the paths listed in the ASM_DISKSTRING parameter and discover the disks that are available.
Select path, group_number group_#, disk_number disk_#, mount_status, header_status, state,total_mb, free_mb from v$asm_disk order by group_number;
There are some cases where the V$ASM_DISK view will not report any disks. For example, on a Windows XP system there may be no raw disks to discover, so the V$ASM_DISK view will simply be blank. This is not a problem, because you can use an existing file system as a location for an ASM disk. In another case ASM will not discover disks that contain an operating system partition table and more than 10,000 disks.
Creating ASM DiskGroup on Linux
  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;
Creating ASM DiskGroup on Windows
  FAILGROUP failure_group_1 DISK
  FAILGROUP failure_group_2 DISK
Redundancy: The redundancy setting defines attributes for that disk group including what kind of striping occurs and if the data will be mirrored or not. You can take the default template setting, or you can assign another ASM template.
Normal: Typically employs two way mirroring by default, and thus requires two failgroups be allocated.
High: Typically employs three way mirroring by default, and thus requires three failgroups be allocated.
External: Does not employ any mirroring or striping. This setting is typically used when the disk group is being assigned to an external disk that is attached to some device that already employs some disk redundancy.
Modify Diskgroup Template:
If you need to create your own template then first create disk group using default template then after alter it.
ALTER DISKGROUP disk_group_1
ADD TEMPLATE new_template
ATTRIBUTES (mirror);
SQL> select * from v$asm_template where group_number=2;

Drop DiskGroup Template:
ALTER DISKGROUP disk_group_1
DROP TEMPLATE new_template;
Note: You cannot drop the default templates, but you can modify them:
ALTER DISKGROUP disk_group_1
Drop DiskGroup:
DROP DISKGROUP disk_group_1;
By default, if any files exist in the disk group, ASM will not allow you to drop that disk group unless you use the including contents clause.
DROP DISKGROUP disk_group_1 including contents;


Post a Comment