lab2 install and configure asmlib

Upload: ashwadhama

Post on 03-Apr-2018

250 views

Category:

Documents


2 download

TRANSCRIPT

  • 7/28/2019 Lab2 Install and Configure ASMLib

    1/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    Alejandro Vargas | Principal Support ConsultantOracle Advanced Customer Services

    INDEX

    Part 1 : Install The ASMLib Drivers ............................................................................................................................... 2Cheking The Kernel Version ......................................................................................................................................... 2Downloading the Drivers for ASMLib ............................................................................................................................2Installing the ASMLib Drivers .................................................................................................................................... ... 3Part 2 : Configure ASMLib .............................................................................................................................................4Configure ASMLib ....................................................................................................................................................... .4Create ASM Disks......................................................................................................................................................................................5

    Part 3 : ASMLib Directory Structures ............................................................................................................................ 6ASM Directories.......................................................................................................................................................................................6ASM files on /opt directory ............................................................................................................................................7Map ASMLib Disks to Physical Devices .......................................................................................................................8File /etc/sysconfig/oracleasm .................................................................................................................................... ... 8ASM init file ....................................................................................................................................................................9Scripts ..........................................................................................................................................................................10

    1/10

  • 7/28/2019 Lab2 Install and Configure ASMLib

    2/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    Part 1 : Install The ASMLib Drivers

    Cheking The Kernel Version

    [oracle@asmxpt ~]$ uname -aLinux asmxpt 2.6.18-8.el5 #1 SMP Tue Jun 5 23:11:13 EDT 2007 i686 i686 i386 GNU/Linux

    Downloading the Drivers for ASMLib

    On the download page find the OS you are using, in our case OEL 5.http://www.oracle.com/technology/tech/linux/asmlib/index.html

    Once on the page Oracle ASMLib Downloads for Red Hat Enterprise Linux Server 5http://www.oracle.com/technology/software/tech/linux/asmlib/rhel5.htmlwe need to find the drivers for Intel IA32 (x86) Architecture and download the generic Libraryand Tools drivers located at the head of the group:Library and Tools

    oracleasm-support-2.1.2-1.el5.i386.rpm

    oracleasmlib-2.0.3-1.el5.i386.rpm

    Aditionally we need to download the driver that exactly match our kernel, that is 2.6.18-8.el5:Drivers for kernel 2.6.18-8.el5

    oracleasm-2.6.18-8.el5-2.0.4-1.el5.i686.rpm

    In our lab the drivers were already downloaded and are located in this directory:

    /root/asmlibrpms

    2/10

    http://www.oracle.com/technology/tech/linux/asmlib/index.htmlhttp://www.oracle.com/technology/software/tech/linux/asmlib/rhel5.htmlhttp://www.oracle.com/technology/tech/linux/asmlib/index.htmlhttp://www.oracle.com/technology/software/tech/linux/asmlib/rhel5.html
  • 7/28/2019 Lab2 Install and Configure ASMLib

    3/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    Installing the ASMLib Drivers

    As root execute the following commands:

    # cd /root/asmlibrpms

    # rpm -Uvh /root/asmlibrpms/oracleasm-support-2.0.4-1.el5.i386.rpm \/root/asmlibrpms/oracleasmlib-2.0.3-1.el5.i386.rpm \/root/asmlibrpms/oracleasm-2.6.18-8.el5-2.0.4-1.el5.i686.rpm

    Preparing... ########################################### [100%]1:oracleasm-support ########################################### [ 33%]2:oracleasm-2.6.18-8.el5 ########################################### [ 67%]

    3:oracleasmlib ########################################### [100%]

    3/10

  • 7/28/2019 Lab2 Install and Configure ASMLib

    4/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    Part 2 : Configure ASMLib

    Configure ASMLib

    Once ASMLib is installed we can execute its executable oracleasm located at /etc/init.d, it will return a list of availablecommands.

    [root@asmxpt asmlibrpms]# /etc/init.d/oracleasmUsage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}

    ASMLib configure command:

    [root@asmxpt asmlibrpms]# /etc/init.d/oracleasm configureConfiguring the Oracle ASM library driver.

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

    Default user to own the driver interface []: oracleDefault group to own the driver interface []: dbaStart Oracle ASM library driver on boot (y/n) [n]: yFix permissions of Oracle ASM disks on boot (y/n) [y]: yWriting Oracle ASM library driver configuration: [ OK ]Creating /dev/oracleasm mount point: [ OK ]Loading module "oracleasm": [ OK ]Mounting ASMlib driver filesystem: [ OK ]

    4/10

  • 7/28/2019 Lab2 Install and Configure ASMLib

    5/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    Scanning system for ASM disks: [ OK ]

    Checking ASMLib status

    [root@asmxpt asmlibrpms]# /etc/init.d/oracleasm statusChecking if ASM is loaded: [ OK ]Checking if /dev/oracleasm is mounted: [ OK ]

    Create ASM Disks

    We have a set of 8 LUNs ready, we will create 4 ASM disks on LUNs sdb1,sdc1,sdd1 and sde1

    [root@asmxpt ~]# /etc/init.d/oracleasm createdisk vol1 /dev/sdb1Marking disk "/dev/sdb1" as an ASM disk: [ OK ][root@asmxpt ~]# /etc/init.d/oracleasm createdisk vol2 /dev/sdc1Marking disk "/dev/sdc1" as an ASM disk: [ OK ][root@asmxpt ~]# /etc/init.d/oracleasm createdisk vol3 /dev/sdd1Marking disk "/dev/sdd1" as an ASM disk: [ OK ][root@asmxpt ~]# /etc/init.d/oracleasm createdisk vol4 /dev/sde1Marking disk "/dev/sde1" as an ASM disk: [ OK ]

    Check the created ASM disks

    [root@asmxpt ~]# /etc/init.d/oracleasm listdisksVOL1VOL2VOL3VOL4

    5/10

  • 7/28/2019 Lab2 Install and Configure ASMLib

    6/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    Part 3 : ASMLib Directory Structures

    ASM Directories

    Once ASM is configured and ASM disks are created several structures are created

    [root@asmxpt ~]# ls -l /dev/oracleasm/total 0drwxr-xr-x 1 root root 0 Jan 31 22:13 disks

    drwxrwx--- 1 oracle dba 0 Jan 31 22:13 iid

    On the /dev/oracleasm/disks directory are located the ASMLib mappings of ASM devices to physical devices

    [root@asmxpt ~]# ls -l /dev/oracleasm/diskstotal 0brw-rw---- 1 oracle dba 8, 17 Jan 31 22:23 VOL1brw-rw---- 1 oracle dba 8, 33 Jan 31 22:24 VOL2brw-rw---- 1 oracle dba 8, 49 Jan 31 22:24 VOL3brw-rw---- 1 oracle dba 8, 65 Jan 31 22:24 VOL4

    The major and minor numbers permit to map the ASM Disks to the physical devices

    [root@asmxpt ~]# ls -l /dev/* | grep 8, | grep " 17 "brw-rw---- 1 oracle dba 8, 17 Jan 31 22:13 /dev/sdb1

    6/10

  • 7/28/2019 Lab2 Install and Configure ASMLib

    7/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    ASM files on /opt directory

    Note that is the ASM directories located on opt are removed ASMLib still will be appera to be functional, but discovery willnot work. Ive seen this problem happening a couple of times

    [oracle@asmxpt ~]$ cd /opt[oracle@asmxpt /opt]$ ls -l | grep -i ordrwxr-xr-x 8 root root 4096 Sep 10 2007 openoffice.org2.3drwxr-xr-x 3 root root 4096 Jan 31 22:05 oracledrwxrwxr-x 3 root users 4096 Oct 15 12:54 OracleCalendar_instdrwxr-xr-x 3 root root 4096 Oct 16 17:31 ORCLfmap

    [oracle@asmxpt /opt]$ du -h ./oracle/20K ./oracle/extapi/32/asm/orcl/124K ./oracle/extapi/32/asm/orcl28K ./oracle/extapi/32/asm32K ./oracle/extapi/3236K ./oracle/extapi40K ./oracle/

    [oracle@asmxpt /opt]$ du -h ORCLfmap/940K ORCLfmap/prot1_32/bin

    4.0K ORCLfmap/prot1_32/log8.0K ORCLfmap/prot1_32/etc956K ORCLfmap/prot1_32960K ORCLfmap/

    7/10

  • 7/28/2019 Lab2 Install and Configure ASMLib

    8/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    Map ASMLib Disks to Physical Devices

    Using a script we can check which is the mapping of ASM disks to physical devices[root@asmxpt ~]# ./chkasmdisksASM disk VOL1 based on /dev/sdb1 [8, 17]ASM disk VOL2 based on /dev/sdc1 [8, 33]ASM disk VOL3 based on /dev/sdd1 [8, 49]ASM disk VOL4 based on /dev/sde1 [8, 65]

    File /etc/sysconfig/oracleasm

    The /etc/sysconfig/oracleasm file has configurable parameters to control ASMLib behaviour, it is updated by runningoracleasm configure. Usually scanorder and scanexclude can be manually configured if necessary

    [root@asmxpt etc]# strings ./sysconfig/oracleasm# This is a configuration file for automatic loading of the Oracle# Automatic Storage Management library kernel driver. It is generated# By running /etc/init.d/oracleasm configure. Please use that method# to modify this file# ORACLEASM_ENABELED: 'true' means to load the driver on boot.ORACLEASM_ENABLED=true# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.

    ORACLEASM_UID=oracle# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.ORACLEASM_GID=dba# ORACLEASM_SCANBOOT: 'true' means fix disk perms on bootORACLEASM_SCANBOOT=true# ORACLEASM_CLEARBOOT: 'true' means clean old disk perms on bootORACLEASM_CLEARBOOT=true

    8/10

  • 7/28/2019 Lab2 Install and Configure ASMLib

    9/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    # ORACLEASM_SCANORDER: Matching patterns to order disk scanningORACLEASM_SCANORDER=# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan

    ORACLEASM_SCANEXCLUDE=

    ASM init file

    One init file is setup at ASMLib install time on different levels of system startup/shutdown init directories

    /etc/rc.d/rc3.d/S29oracleasm/etc/rc.d/rc5.d/S29oracleasm/etc/rc.d/rc6.d/K20oracleasm

    /etc/rc.d/rc1.d/K20oracleasm/etc/rc.d/rc4.d/S29oracleasm/etc/rc.d/rc2.d/S29oracleasm/etc/rc.d/init.d/oracleasm/etc/rc.d/rc0.d/K20oracleasm

    9/10

  • 7/28/2019 Lab2 Install and Configure ASMLib

    10/10

    ASM HANDS-ON TRAINING

    Lab 2 Install and Configure ASMLib

    Scripts

    #!/bin/ksh# chkasmdisks/etc/init.d/oracleasm querydisk `/etc/init.d/oracleasm listdisks` | cut -f2,10,11 -d" " |perl -pe 's/"(.*)".*\[(.*), *(.*)\]/$1 $2 $3/g;' | while read v_asmdisk v_minor v_majordov_device=`ls -la /dev | grep " $v_minor, *$v_major " | awk '{print $10}'`echo "ASM disk $v_asmdisk based on /dev/$v_device [$v_minor, $v_major]"done# eof chkasmdisks

    End of Lab2

    10/10