Thursday 14 April 2016

Installing Grid Infrastructure to use ASM on Linux


These steps are tested VirtualBox, it can or can not work on VMWare.
  • First  add virtual hard disks in your VirtualBox / VMWare by going in machine settings.
  • Then create partitions by using fdisk a UNIX/LINUX command. I will show a demo below you just do the same for how many partitions you’ve added earlier in the Step 1. The following will show all the connected partitions.
  •  [oracle@localhost ~]$ su  
     Password:  
     [root@localhost oracle]# fdisk -l  
     Disk /dev/sda: 32.2 GB, 32212254720 bytes  
     255 heads, 63 sectors/track, 3916 cylinders  
     Units = cylinders of 16065 * 512 = 8225280 bytes  
     Sector size (logical/physical): 512 bytes / 512 bytes  
     I/O size (minimum/optimal): 512 bytes / 512 bytes  
     Disk identifier: 0x00001c59  
     Device Boot   Start     End   Blocks  Id System  
     /dev/sda1  *      1     64   512000  83 Linux  
     Partition 1 does not end on cylinder boundary.  
     /dev/sda2       64    3917  30944256  8e Linux LVM  
     Disk /dev/sdb: 10.7 GB, 10737418240 bytes  
     255 heads, 63 sectors/track, 1305 cylinders  
     Units = cylinders of 16065 * 512 = 8225280 bytes  
     Sector size (logical/physical): 512 bytes / 512 bytes  
     I/O size (minimum/optimal): 512 bytes / 512 bytes  
     Disk identifier: 0x00000000  
     Disk /dev/sdc: 10.7 GB, 10737418240 bytes  
     255 heads, 63 sectors/track, 1305 cylinders  
     Units = cylinders of 16065 * 512 = 8225280 bytes  
     Sector size (logical/physical): 512 bytes / 512 bytes  
     I/O size (minimum/optimal): 512 bytes / 512 bytes  
     Disk identifier: 0x00000000  
     Disk /dev/mapper/VolGroup-lv_root: 29.6 GB, 29569843200 bytes  
     255 heads, 63 sectors/track, 3594 cylinders  
     Units = cylinders of 16065 * 512 = 8225280 bytes  
     Sector size (logical/physical): 512 bytes / 512 bytes  
     I/O size (minimum/optimal): 512 bytes / 512 bytes  
     Disk identifier: 0x00000000  
     Disk /dev/mapper/VolGroup-lv_swap: 2113 MB, 2113929216 bytes  
     255 heads, 63 sectors/track, 257 cylinders  
     Units = cylinders of 16065 * 512 = 8225280 bytes  
     Sector size (logical/physical): 512 bytes / 512 bytes  
     I/O size (minimum/optimal): 512 bytes / 512 bytes  
     Disk identifier: 0x00000000  
    
  • Now to create a partition use the following (steps are in bold), follow this for the disks you’ve added:
  •  [root@localhost oracle]# fdisk /dev/sdb  
     Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel  
     Building a new DOS disklabel with disk identifier 0x7caea3d4.  
     Changes will remain in memory only, until you decide to write them.  
     After that, of course, the previous content won't be recoverable.  
     Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)  
     WARNING: DOS-compatible mode is deprecated. It's strongly recommended to  
          switch off the mode (command 'c') and change display units to  
          sectors (command 'u').  
     Command (m for help): n  
     Command action  
       e  extended  
       p  primary partition (1-4)  
     p  
     Partition number (1-4): 1  
     First cylinder (1-1305, default 1): 1  
     Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):[ENTER]  
     Using default value 1305  
     Command (m for help): p  
     Disk /dev/sdb: 10.7 GB, 10737418240 bytes  
     255 heads, 63 sectors/track, 1305 cylinders  
     Units = cylinders of 16065 * 512 = 8225280 bytes  
     Sector size (logical/physical): 512 bytes / 512 bytes  
     I/O size (minimum/optimal): 512 bytes / 512 bytes  
     Disk identifier: 0x7caea3d4  
       Device Boot   Start     End   Blocks  Id System  
     /dev/sdb1        1    1305  10482381  83 Linux  
     Command (m for help): w  
     The partition table has been altered!  
     Calling ioctl() to re-read partition table.  
     Syncing disks.  
    
  • If you are using Oracle Linux then skip this step, else download this rpms and install
     root@localhost /]# rpm -Uvh oracleasmlib-2.0.4-1.el6.i686.rpm  
     warning: oracleasmlib-2.0.4-1.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY  
     Preparing...    ########################################### [100%]  
       1:oracleasmlib  ########################################### [100%]  
    
  • Now unzip the Grid Infrastructure software downloaded from Oracle Official Site.
  • Now if you want to do Grid Infrastructure installation as oracle user the follow this: (if some groupadd / useradd gives any error just change add to mod)
  •  [root@localhost /]# groupadd -g 501 oinstall  
     [root@localhost /]# groupadd -g 502 dba  
     [root@localhost /]# groupadd -g 503 oper  
     [root@localhost /]# groupadd -g 504 asmadmin  
     [root@localhost /]# groupadd -g 505 asmdba  
     [root@localhost /]# groupadd -g 506 asmoper  
     [root@localhost ~]# useradd -u 501 -g oinstall -G dba,oper,asmadmin,asmdba,asmoper oracle  
    
  • Now login as oracle user or whichever user you had granted those groups and then edit that users .bash_profile and add following code to that file:
  •  [root@localhost ~]# su – oracle  
     [oracle@localhost ~]$ cat .bash_profile  
     # .bash_profile  
     # Get the aliases and functions  
     if [ -f ~/.bashrc ]; then  
         . ~/.bashrc  
     fi  
     # User specific environment and startup programs  
     PATH=$PATH:$HOME/bin  export PATH  
     # Oracle Settings  
     TMP=/tmp; export TMP  
     TMPDIR=$TMP; export TMPDIR  
     ORACLE_HOSTNAME=localhost.localdomain; export ORACLE_HOSTNAME  
     # ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME  
     ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE  
     ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME  
     # ORACLE_SID=DB11G; export ORACLE_SID  
     PATH=/usr/sbin:$PATH; export PATH  
     PATH=$ORACLE_HOME/bin:$GRID_HOME/bin:$PATH; export PATH  
     LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH  
     CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH  
    
  • Now verify if nobody user exists or not (by id nobody command) if it don’t exists add that user. To do this just follow this procedure:
  •  [oracle@localhost ~]$ id nobody  
     uid=99(nobody) gid=99(nobody) groups=99(nobody)  
     [root@testnode1 ~]# /usr/sbin/useradd nobody  
    
  • Now disable the firewall.
  •  [root@localhost ~]# service iptables save  
     iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]  
     [root@localhost ~]# service iptables stop  
     iptables: Setting chains to policy ACCEPT: filter          [ OK ]  
     iptables: Flushing firewall rules:                         [ OK ]  
     iptables: Unloading modules:                               [ OK ]  
     [root@localhost ~]# chkconfig iptables off  
     [root@localhost ~]# service iptables status  
     iptables: Firewall is not running.  
    
  • Now create the necessary directories and assign them with proper group and user. (skip if already created.)
  •  [root@localhost /]# mkdir -p /u01/app/oracle/product/11.2.0/grid  
     [root@localhost /]# mkdir -p /u01/app/oracle/product/11.2.0/db_1  
     [root@localhost /]# ls /u01/app/oracle/product/11.2.0/  
     db_1 grid  
     [root@localhost /]# chown -R oracle:oinstall /u01/  
     [root@localhost /]# chmod -R 775 /u01/  
    
  • After installing the ASMLib packages for Linux, configure and load the ASM kernel module. This task needs to be run as the root user account.
  •  [root@localhost /]# oracleasm configure -i
     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 <ENTER> 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 []: asmadmin  
     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  
    
  • Now load the ASM kernel module.
  •  [root@localhost oracle]# oracleasm init  
     Creating /dev/oracleasm mount point: /dev/oracleasm  
     Loading module "oracleasm": oracleasm  
     Configuring "oracleasm" to use device physical block size  
     Mounting ASMlib driver filesystem: /dev/oracleasm  
    
  • In the previous steps, we had hard disks partitioned to be used by Oracle ASM. Use oracleasm to label the hard disk partitions for discovery by ASM.
  •  [root@localhost /]# oracleasm listdisks  
     DATAVOL1  
     FRAVOL1  
    
  • Perform one last check that the new Oracle ASM disks are mounted in the oracleasm file system, and verify if owner is oracle and group is oinstall or not.
  •  [root@testnode1 ~]# ls -l /dev/oracleasm/disks  
     total 0  
     brw-rw---- 1 oracle asmadmin 8, 33 Jan 15 19:10 DATAVOL1  
     brw-rw---- 1 oracle asmadmin 8, 49 Jan 15 19:10 FRAVOL1  
    
  • So now configure user equivalence for oracle user account.
  •  [oracle@localhost grid]$ mkdir ~/.ssh/  
     mkdir: cannot create directory `/home/oracle/.ssh/': File exists  
     [oracle@localhost grid]$ chmod 700 ~/.ssh/  
     [oracle@localhost grid]$ ssh-keygen -t dsa  
     Generating public/private dsa key pair.  
     Enter file in which to save the key (/home/oracle/.ssh/id_dsa):[ENTER]  
     Enter passphrase (empty for no passphrase): [ENTER]  
     Enter same passphrase again: [ENTER]  
     Your identification has been saved in /home/oracle/.ssh/id_dsa.  
     Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.  
     The key fingerprint is:  
     fa:c6:11:a8:ea:53:04:a9:f5:8e:ca:e8:59:30:6d:f1 oracle@localhost.localdomain  
     The key's randomart image is:  
     +--[ DSA 1024]----+  
     |  .              |  
     | +               |  
     | o +  .          |  
     |. . = . .        |  
     | o * E S.        |  
     | = + ..          |  
     |o. + .. .        |  
     |o.=  .o          |  
     |.+..  ..         |  
     +-----------------+  
     [oracle@localhost grid]$ touch ~/.ssh/authorized_keys  
     [oracle@localhost grid]$ ssh localhost cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys  
     The authenticity of host 'localhost (::1)' can't be established.  
     RSA key fingerprint is 0e:85:8a:17:25:82:ff:11:00:30:bd:77:ca:a3:02:7c.  
     Are you sure you want to continue connecting (yes/no)? yes  
     Warning: Permanently added 'localhost' (RSA) to the list of known hosts.  
     oracle@localhost's password:*******  
     [oracle@localhost grid]$ chmod 600 ~/.ssh/authorized_keys  
     [oracle@localhost grid]$ ssh localhost "date;hostname"  
     Thu Jan 28 18:13:55 IST 2016  
     localhost.localdomain  
    
  • Now before running ./runInstaller make sure your $TNS_ADMIN environment is set to /u01/app/oracle/product/11.2.0/grid/network/admin.
  •  [oracle@testnode1 ~]$ id  
     uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),504(asmadmin),505(asmdba),506(asmoper)  
     [oracle@testnode1 ~]$ echo $TNS_ADMIN  
     /u01/app/oracle/product/11.2.0/grid/network/admin  
     [oracle@testnode1 ~]$ cd /grid  
     [oracle@testnode1 grid]$ ./runInstaller  
    
  • Now follow the GUI instruction and create ASM instance along with the instance don’t just install software only. If the ASM disks are not get identified by OUI then just click on change discovery path and change it to /dev/oracleasm/disks.
  • If you face following error after running root.sh then, just click here to solve.
  •  [root@localhost grid]# ./root.sh  
     Running Oracle 11g root.sh script...  
     The following environment variables are set as:  
       ORACLE_OWNER= oracle  
       ORACLE_HOME= /u01/app/oracle/product/11.2.0/grid  
     Enter the full pathname of the local bin directory: [/usr/local/bin]:  
       Copying dbhome to /usr/local/bin ...  
       Copying oraenv to /usr/local/bin ...  
       Copying coraenv to /usr/local/bin ...  
     Creating /etc/oratab file...  
     Entries will be added to the /etc/oratab file as needed by  
     Database Configuration Assistant when a database is created  
     Finished running generic part of root.sh script.  
     Now product-specific root actions will be performed.  
     2016-01-28 18:33:47: Checking for super user privileges  
     2016-01-28 18:33:47: User has super user privileges  
     2016-01-28 18:33:47: Parsing the host name  
     Using configuration parameter file: /u01/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params  
     Creating trace directory  
     LOCAL ADD MODE  
     Creating OCR keys for user 'oracle', privgrp 'oinstall'..  
     Operation successful.  
     CRS-4664: Node localhost successfully pinned.  
     Adding daemon to inittab  
     CRS-4124: Oracle High Availability Services startup failed.  
     CRS-4000: Command Start failed, or completed with errors.  
     ohasd failed to start: Inappropriate ioctl for device  
     ohasd failed to start: Inappropriate ioctl for device at /u01/app/oracle/product/11.2.0/grid/crs/install/roothas.pl line 296.  
    

No comments :

Post a Comment