Friday, May 21, 2010

How to install and configure ASM





In this demo VMware Fusion (for Windows VMware workstation),
Enterprise-R5-U5-Server-i386-dvd.iso, Oracle Database Grid Infrastructure, Oracle 11gR2 and ASMlibs will be used.



Installing Automatic Storage Management (ASM)


For Linux systems Oracle provides a custom device driver known as ASMLib, which is recommended for most ASM installations on Linux. ASMLib is available for free download from OTN.
Determine the Version of ASMLib you need
ASMLib 2.0 is delivered as a set of three RPM packages.
• oracleasmlib-2.0 - the ASM libraries
• oracleasm-support-2.0 - utilities needed to administer ASMLib
• oracleasm - a kernel module for the ASM library that is specific to each kernel
Each Linux distribution has its own set of ASMLib 2.0 packages (OEL 5 uses the same RPMs as Red Hat Enterprise Linux 5 AS). Within each distribution, each kernel version has a corresponding oracleasm package.



Install asmlibs


First determine which kernel you are using by logging in as root and running the following command:
[root@oraasm-primary Server]# uname -rm
2.6.18-194.el5 i686

The example shows that this is a 2.6.18 kernel, patch level 5, for Enterprise Linux 5 on 32-bit x86 compatible hardware (i686).
Use this information to find the correct ASMLib packages on OTN:
1. Point your Web browser to http://www.oracle.com/technology/tech/linux/asmlib/index.html
2. Select the link for your version of Linux (OEL5 users may use the Red Hat Enterprise Linux 5 AS).
3. Download the oracleasmlib and oracleasm-support packages for your version of Linux. The files are grouped by architecture (AMD64 / Intel em64t for x86_64, IA64 for Itanium, and IA32 for x86).
At the top of each section is a Library and Tools heading. Download both of the files under this heading - these are the support utilities and ASM libraries (oracleasm-support and oracleasmlib, respectively).
4. Next, download the oracleasm package corresponding to your kernel. In the example above, the oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm package was used. Note that there are two or three drivers listed under most of
the kernel versions.
For example:
Drivers for kernel 2.6.18-194.el5
* oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm
* oracleasm-support-2.1.3-1.el5.i386.rpm
* oracleasmlib-2.0.4-1.el5.i386.rpm
5. Next, install the packages by executing the following command as root:
rpm -Uvh oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm oracleasm-support-2.1.3-1.el5.i386.rpm oracleasmlib-2.0.4-1.el5.i386.rpm


[root@oraasm-primary SOFTWARE]# rpm -Uvh oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm oracleasm-support-2.1.3-1.el5.i386.rpm oracleasmlib-2.0.4-1.el5.i386.rpm
warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [ 33%]
2:oracleasm-2.6.18-194.el########################################### [ 67%]
3:oracleasmlib ########################################### [100%]
[root@oraasm-primary SOFTWARE]#

Configuring ASMLib



Before using ASMLib, you must run a configuration script to prepare the driver. Run the following command as root, and answer the prompt questions as shown in the example below.
[root@oraasm-primary SOFTWARE]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]


Execute the "fdisk" command to partition the disks that will be used for the ASM storage. We will first format disks from sdb to sdg. The following output shows the expected fdisk output for the sdb disk.



First check disks

[root@oraasm-primary SOFTWARE]# ls -l /dev/sd*
brw-r----- 1 root disk 8, 0 Apr 24 2010 /dev/sda
brw-r----- 1 root disk 8, 1 Apr 24 16:51 /dev/sda1
brw-r----- 1 root disk 8, 2 Apr 24 2010 /dev/sda2
brw-r----- 1 root disk 8, 16 Apr 24 2010 /dev/sdb
brw-r----- 1 root disk 8, 32 Apr 24 2010 /dev/sdc
brw-r----- 1 root disk 8, 48 Apr 24 2010 /dev/sdd
brw-r----- 1 root disk 8, 64 Apr 24 2010 /dev/sde
brw-r----- 1 root disk 8, 80 Apr 24 2010 /dev/sdf
brw-r----- 1 root disk 8, 96 Apr 24 2010 /dev/sdg

Then execute the fdisk command:
[root@oraasm-primary SOFTWARE]# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1): press "enter"
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652): press "enter"
Using default value 652

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
Repeat the same procedure for /dev/sdc, /dev/sdd, /dev/sde, /dev/sdf, /dev/sdg



Next you instruct the ASM driver which disks to use. Oracle recommends that each disk contain a single partition for the entire disk. See Partitioning the Disks at the beginning of this section for an example of creating disk partitions.
Mark disks to be used by ASMLib by running the following command as root:
/etc/init.d/oracleasm createdisk DISK_NAME device_name


[root@oraasm-primary SOFTWARE]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk: [ OK ]
[root@oraasm-primary SOFTWARE]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "VOL2" as an ASM disk: [ OK ]
[root@oraasm-primary SOFTWARE]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "VOL3" as an ASM disk: [ OK ]
[root@oraasm-primary SOFTWARE]# /etc/init.d/oracleasm createdisk VOL4 /dev/sde1
Marking disk "VOL4" as an ASM disk: [ OK ]
[root@oraasm-primary SOFTWARE]# /etc/init.d/oracleasm createdisk VOL5 /dev/sdf1
Marking disk "VOL5" as an ASM disk: [ OK ]
[root@oraasm-primary SOFTWARE]# /etc/init.d/oracleasm createdisk VOL6 /dev/sdg1
Marking disk "VOL6" as an ASM disk: [ OK ]



Verify that ASMLib has marked the disks:
[root@oraasm-primary SOFTWARE]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
VOL5
VOL6
[root@oraasm-primary SOFTWARE]#









Installing Oracle GRID software



Download Oracle Database 11g Release 2 Grid Infrastructure from Oracle site, uncompress files and copy them to the shared directory.
Login in as oracle user and go to the directory where you saved Oracle installation software.

37.png

run ./runInstaller


38.png

Select Grid Infrastructure Only
39.png
Languages: English

Dba group will be the default group for all
40.png
Select for YES

41.png

We already made our directory structure in /data/app and this will be used.
ORACLE_BASE = /data/app/oracle
42.png
After you click “next” you have to wait for couple of seconds until the next screen is displayed.
Select NEXT on following screen.
43.png

Select "Fix & Check Again" on following screen.
46.png


Start new terminal session and type the following command:

[oracle@oraasm-primary ~]$ su
Password:
[root@oraasm-primary oracle]# /tmp/CVU_11.2.0.1.0_oracle/runfixup.sh

Click on "OK" button.

47.png



The “Swap size” and the “Network Time Protocol” warnings can be ignored at this stage.
Mark “Ignore all” and click “Next” and on the next screen click “Finish”.

Press FINISH
Installation will take approximately 10 min
44.png45.png
The next stage is the root.sh script.
48.png

Startanextra terminal and use the su command to log in as root
Step one:
run /data/app/oraInventory/orainstRoot.sh

49.png

Second step:
run /data/app/11.2.0/grid/root.sh and accept defaults.
50.png
Read the screen output and run the scripts as requested. Here the next step is executed as:
/data/app/11.2.0/grid/perl/bin/perl -I/data/app/11.2.0/grid/perl/lib -I/data/app/11.2.0/grid/crs/install /data/app/11.2.0/grid/crs/install/roothas.pl

51.png

Click 'OK' on “Execute Configuration scripts” to finish the installation

52.png

Creating an ASM instance


Start a terminal session as “oracle” user. To set up oratab add the following line to /etc/oratab


cat >> /etc/oratab << EOF
+ASM:/data/app/11.2.0/grid:N
EOF

[oracle@oraasm-primary ~]$ . oraenv -v
ORACLE_SID = [+ASM] ?
The Oracle base for ORACLE_HOME=/data/app/11.2.0/grid is /data/app/oracle

53.png


Create the init+ASM.ora file in $ORACLE_HOME/dbs
cat >> /data/app/11.2.0/grid/dbs/init+ASM.ora << EOF
instance_type=asm
large_pool_size=12M
remote_login_passwordfile=exclusive
EOF
54.png


Check if cssd is running:
[oracle@oraasm-primary ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.cssd ora.cssd.type OFFLINE OFFLINE
ora.diskmon ora....on.type OFFLINE OFFLINE

NO cssd is offline.
[oracle@oraasm-primary ~]$ crs_start ora.cssd
Attempting to start `ora.cssd` on member `oraasm-primary`
Attempting to start `ora.diskmon` on member `oraasm-primary`
Start of `ora.diskmon` on member `oraasm-primary` succeeded.
Start of `ora.cssd` on member `oraasm-primary` succeeded.

Check now again.
[oracle@oraasm-primary ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.cssd ora.cssd.type ONLINE ONLINE oraa...mary
ora.diskmon ora....on.type ONLINE ONLINE oraa...mary
[oracle@oraasm-primary ~]$

Up & running, ok.
We should create spfile for our +ASM instance

55.png









[oracle@oraasm-primary ~]$ srvctl status asm
PRCR-1001 : Resource ora.asm does not exist
[oracle@oraasm-primary ~]$ srvctl add asm -p /data/app/11.2.0/grid/dbs/initASM.ora
[oracle@oraasm-primary ~]$ srvctl status asm
ASM is not running.
[oracle@oraasm-primary ~]$ srvctl start asm
[oracle@oraasm-primary ~]$ srvctl status asm
ASM is running on oraasm-primary



srvctl modify asm -p /data/app/11.2.0/grid/dbs/spfile+ASM.ora


56.png

SQL> sho parameter spfile

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /data/app/11.2.0/grid/dbs/spfile+ASM.ora

Creating DISKGROUPS



col PATH format a10
col name format a10
col FAILGROUP format a10
col label format a10
set lines 200


SELECT name
, type
, round (total_mb/1024 ,2) "Total GB"
, round (free_mb/1024 ,2) "Free GB"
, round (free_mb/total_mb*100 ,2) " Free %"
, round (usable_file_mb /1024 ,2)"Usable GB"
, required_mirror_free_mb/ 1024 "Required Mirros GB"
FROM V$ASM_DISKGROUP;

No rows

SELECT path
, round (OS_MB /1024 , 2) OS_GB
, round (TOTAL_MB/1024 , 2) TOTAL_GB
, round (FREE_MB/1024 , 2 ) FREE_GB
, round (HOT_USED_MB/1024 , 2 ) HOT_USED_GB
, round (COLD_USED_MB/1024 , 2 ) COLD_USED_GB
, FAILGROUP
, LABEL
FROM V$ASM_DISK
order by name;
57.png

We can now make disk groups in sql*plus or using asmca.
Start asmca in a terminal session.
Select Create

58.png


Mark disks you want to add to diskgroup and then click “Show advanced options” button

59.png


Set Database Compatibility to 10.2
Set new group name, for exaple DG1
Click OK
60.png


Next we create diskgroup in sql*plus:
CREATE DISKGROUP FRA NORMAL REDUNDANCY
DISK 'ORCL:VOL3',
'ORCL:VOL4'
ATTRIBUTE 'au_size'='4M',
'compatible.asm' = '11.2',
'compatible.rdbms' = '10.2'
/
Diskgroup created.



61.png

Now we have the storage and the next step is database creation.





NEXT "How to Install Oracle 11r2 database on ASM"

Linkedin


   Samir Jazvin
   Senior Oracle DBA

View Samir Jazvin's profile on LinkedIn