Blog Archives

Physical vs Logical Blocksize on ASMLib Devices

As you all may know, ASMLib is a recommended module for Oracle databases running on Linux platforms and it is an embedded module for UEK (Oracle Unbreakable Kernel) users. Oracle announced that (two years ago or so) they will no longer maintain ASMLib for Red Hat compatible kernel but this does not mean that they abandon the project, rather it is mainly related to the effort they need to put in maintaining the module for multiple kernel versions.

A while ago, Oracle added a new feature to ASMLib allowing ASM devices to choose between physical or logical block sizes in I/O operations. This should be, I believe, a fail-back mechanism for SSD devices used as ASM disks. Many SSD devices use 4K block size however Linux still uses default 512 bytes logical block size for those devices in the same way it does for motor disks. In early releases of ASMLib (oracleasm-support-2.1.7 and earlier), ASM uses physical block size (4K for SSDs). This is still the default behavior in oracleasm-support-2.1.8 but now sysadmin can choose between physical and logical blocksize by using [-b|-p] switches in oracleasm-configure.sh script.

  • -b|—logical-blocks sets logical blocksize usage
  • -p|—physical-blocks set physical blocksize usage

Those switches set /sys/module/oracleasm/parameters/use_logical_block_size which is default to be false (use physical blocksize). So that asmlib module can use the value to decide which block size to use.

Advertisements

Upgrade to Oracle Enterprise Linux 5.9 and/so UEK2

I have upgraded one of my Oracle Linux boxes to Oracle Linux Release 5.9 which introduces several new things (Release Notes). Just to mention three of them

Download and update yum repository file

[root@localhost yum.repos.d]$ cd /etc/yum.repos.d
[root@localhost yum.repos.d]$ wget http://public-yum.oracle.com/public-yum-el5.repo
[root@localhost yum.repos.d]$ mv public-yum-el5.repo.1 public-yum-el5.repo
[root@localhost yum.repos.d]$ grep -B 5 enabled=1 public-yum-el5.repo
[el5_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1
--
[ol5_u9_base]
name=Oracle Linux $releasever Update 9 installation media copy ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/9/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1
--
[ol5_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/UEK/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1

We are ready to upgrade

[root@localhost yum.repos.d]$ yum update

Rebounce Linux

[root@localhost yum.repos.d]$ reboot

Before

Check Oracle Linux Version

[oracle@localhost ~]$ cat /etc/oracle-release
Oracle Linux Server release 5.8

Check kernel version

[oracle@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32-300.32.2.el5uek #1 SMP Tue Aug 28 10:15:29 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

Check your memory page size

[oracle@localhost ~]$ getconf PAGESIZE
4096

After

Once you are done after reboot, check Oracle Linux Version

[oracle@localhost ~]$ cat /etc/oracle-release
Oracle Linux Server release 5.9

Check kernel version

[oracle@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.39-300.28.1.el5uek #1 SMP Tue Feb 5 10:15:29 PST 2013 x86_64 x86_64 x86_64 GNU/Linux

Check your memory page size

[oracle@localhost ~]$ getconf PAGESIZE
4096

Ooops!!! No change ?

[root@localhost ~]$ cat /sys/kernel/mm/transparent_hugepage/enabled 
[always] madvise never

Actually transparent huge page allocation is enabled but it deserves a separate discussion

Grow Oracle Linux Root Filesystem

It is always the case that in my Linux VM installations I run out of root file system space and need to grow it (I can hear you experienced admin, I should create another filesystem for my use and not use root file system for my joy). Here are the steps to grow root filesystem for Oracle Linux running on VMware:

Click on the wrench symbol to go to your virtual machine configuration menu

Screen Shot 2012-12-31 at 1.02.46 AM

Choose Hard Disk (SCSI) menu to increase the size of an availabe virtual disk (in this case your root file system disk)

Screen Shot 2012-12-31 at 1.07.12 AMGrow your virtual disk to a proper size (In this case I grow it form 28GB to 34GB)

Screen Shot 2012-12-31 at 1.07.23 AM

Now you can start your Oracle Linux on VM*.

First step at guest OS (Oracle Linux) is to grow disk partition size using fdisk. Here are the steps assuming that your root file system is on /dev/sda2 partition

  1. fdisk /dev/sda
  2. d (to delete)
  3. 2 (to delete partition 2)
  4. n (to create a new partition)
  5. p (to create a new partition with primary type)
  6. 2 (to create a new primary partition with id 2)
  7. Accept all defaults (to create a new primary partition with default offset and fully covering virtual disk you have already provisioned)
  8. w (write partition table)

Once you are done with disk partition modification rebounce Oracle Linux to ensure partition tables are read by Linux.

Once the guest OS is back, resize physical volume using pvresize. We will add 6GB (slightly less maybe) to existing physical partition using pvresize command

pvresize --setphysicalvolumesize 31G /dev/sda2

Now we can grow logical volume by 6GB

lvresize -L +6G /dev/VolGroup00/LogVol00

Final step is to grow file system online using resize2fs

resize2fs /dev/VolGroup00/LogVol00

You are done. You can continue filling root file system  🙂

* Before starting it is a good decision to protect your existing VM guest by using VMware snapshots.

Oracle Enterprise Linux for Home User: Install Latest Firefox Version

It is a joy to use Linux for any purpose. Although Oracle Linux is mainly designed for enterprise stack, a stable operating system for a technical user is always a need.

However default configurations and program versions are not suitable for daily use always. One example of this is Firefox 3.0.6 available in Oracle Linux (or Red Hat). Here is how you can upgrade it to 17.0

Download latest Firefox release from Mozilla web page. Then unpack and install it by simply following.

tar -xjvf firefox-17.0.tar.bz2
cp -r firefox /opt/
ln -sf /opt/firefox/firefox /usr/bin/firefox

Oracle R Enterprise Configuration on Oracle Linux

Before starting to deal with large volumes of data problems on Oracle R Enterprise (ORE) you need to perform a couple of configurations over your Oracle Linux and Oracle Database systems. Here is the recipe:

  • Ensure that you have the following lines in your oracle users .bash_profile file
    export R_HOME=/usr/lib64/R
    export PATH=/usr/bin:$PATH
    
  • Ensure that you have already installed libpng.x86_64 and libpng-devel.x86_64 packages on your Oracle Linux otherwise issue to install them.
    yum install libpng.x86_64 libpng-devel.x86_64
    
  • Switch to root and issue R. Once you are in R session, install two prerequisites of ORE:
    install.packages("DBI")
    install.packages("png")
    
  • Ensure that your database is 11.2.0.3 otherwise refer you need to apply several database patches:
  • Go to Oracle R Enterprise Download Page and download Oracle R Enterprise Server Install for Oracle Database on Linux 64-bit (91M) and Oracle R Enterprise Client Supporting Packages for Linux 64-bit Platform (1M)  (ore-server-linux-x86-64-1.1.zip and ore-supporting-linux-x86-64-1.1.zip) under Oracle R Enterprise Downloads (v1.1) section
  • Unzip the file by issuing
    unzip ore-server-linux-x86-64-1.1.zip ore-supporting-linux-x86-64-1.1.zip
    
  • At this point ensure that your database to support Oracle R Enterprise is up and running
  • Execute install.sh in order to create ORE libraries and database objects into SYS and RQSYS schemas.
    cd server
    ./install.sh
    


    Oracle R Enterprise 1.1 Server Installation.

    Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.

    Do you wish to proceed? [yes]

    Checking R ................... Pass
    Checking R libraries ......... Pass
    Checking ORACLE_HOME ......... Pass
    Checking ORACLE_SID .......... Pass
    Checking sqlplus ............. Pass
    Checking ORE ................. Pass

    Choosing RQSYS tablespaces
    PERMANENT tablespace to use for RQSYS [SYSAUX]:
    TEMPORARY tablespace to use for RQSYS [TEMP]:

    Current configuration
    R_HOME = /usr/lib64/R
    R_LIBS_USER = /u01/app/oracle/product/11.2.0/dbhome_1/R/library
    ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
    ORACLE_SID = orcl
    PERMANENT tablespace = SYSAUX
    TEMPORARY tablespace = TEMP

    Installing libraries ......... Pass
    Installing RQSYS ............. Pass
    Installing ORE packages ...... Pass
    Creating ORE script .......... Pass

    NOTE: To use ORE functionality, a database user with RQROLE role,
    a few more grants and synonyms is required. A complete list of
    requirements is available in rquser.sql. There is also a demo
    script demo_user.sh creating a new user RQUSER.

    To use embedded R functionality, an RQADMIN role is required.
    Please, consult the documentation for more information on various
    roles.

    Done

  • Finally install some required R libraries/packages by using install.packages command in R. Ensure that user (root will do that) you will start R has a write permission on /usr/lib64/R/library
    install.packages("/home/oracle/Desktop/server/ORE_1.1_R_x86_64-unknown-linux-gnu.tar.gz", repos = NULL)
    install.packages("/home/oracle/Desktop/server/OREbase_1.1_R_x86_64-unknown-linux-gnu.tar.gz", repos = NULL)
    install.packages("/home/oracle/Desktop/server/OREeda_1.1_R_x86_64-unknown-linux-gnu.tar.gz", repos = NULL)
    install.packages("/home/oracle/Desktop/server/OREgraphics_1.1_R_x86_64-unknown-linux-gnu.tar.gz", repos = NULL)
    install.packages("/home/oracle/Desktop/server/OREstats_1.1_R_x86_64-unknown-linux-gnu.tar.gz", repos = NULL)
    install.packages("/home/oracle/Desktop/server/ORExml_1.1_R_x86_64-unknown-linux-gnu.tar.gz", repos = NULL)
    install.packages("/home/oracle/Desktop/supporting/ROracle_1.1-2_R_x86_64-unknown-linux-gnu.tar.gz", repos = NULL)
    
  • Finally start a R session (ensure that $ORACLE_HOME/lib is in your LD_LIBRARY_PATH before starting R session) and load ORE library
    library(ORE)
    Loading required package: OREbase
    Loading required package: ROracle
    Loading required package: DBI
    
    Attaching package: 'OREbase'
    
    The following object(s) are masked from 'package:base':
    
        cbind, data.frame, eval, interaction, order, paste, pmax, pmin,
        rbind, table
    
    Loading required package: OREstats
    Loading required package: MASS
    Loading required package: OREgraphics
    Loading required package: OREeda
    Loading required package: ORExml
    

Create your Own R Server on Oracle Linux

It is very common to have people running R on their individual PCs. One major problem is the hardware limitations of  your PCs will inhibit you to deal with large volumes of data.

Moreover if you wish to use Oracle R Enterprise you need a database connectivity and for some platforms like Mac there is no client available yet. In this post you will find how you can install R in a centralised fashion so that any individual can access it via their favorite browser.

Preparing Oracle Enterprise Linux

  • Ensure that ol5_u6_base (or a further release) and el5_addons (ol5_addons is also ok) repos are enabled in /etc/yum.repos.d/public-yum-el5.repo file(by setting enabled flag to 1)
  • Issue yum install R.x86_64 (Notice that R package is in el5_addons and other dependendents from el5_addons and ol5_u6_base)
  • Download 64-bit RStudio-Server by issuing wget http://download2.rstudio.org/rstudio-server-0.96.331-x86_64.rpm
  • Install RStudio-Server by issuing sudo rpm -Uvh rstudio-server-0.96.331-x86_64.rpm
  • Start a browser and go to http://<rstudio-servername&gt;:8787

  • Provide your linux authentication details
  • RStudio-Server is ready to use

VMware Tools for Oracle UEK

If you wish to use VMware Tools with Oracle UEK as the guest OS (you should use it in order to interact guest with the host, proper screen resolution and many other functionality) you need to perform some extra steps unlike some other Linux distros. Such as Ubuntu, which can be automatically configured by VMware

Here is the list of actions you should take for installation:

  1. Configure yum on your Linux installation
  2. Using VMware Virtual Machine menu choose Install VMware Tools option which will mount a pseudo device.
  3. Copy VMwareTools-8.8.4-730257.tar.gz  into /tmp and extract it using tar -xzvf VMwareTools-8.8.4-730257.tar.gz 
  4. yum install kernel-headers kernel-uek-devel
  5. ./vmware-install.pl as root

You are done.