Saturday, 18 October 2014

Install and Configure Oracle 11gR2 with ASM on Solaris 10



There are 3 simple steps to install Oracle Oracle Database 11G release 2 with ASM option
on Solaris 10.
They are:
1- Install Oracle Database 11gR2 RDBMS
2- Install Oracle Grid Infrastructure 11gR2 in a separate home than Oracle RDBMS home
3- Use ASMCA GUI interface for creating ASM disk groups
Here are the detail:
        I.            Install Oracle Database 11GR2 RDBMS
1.      Memory requirement
   The following are the memory requirements for installing Oracle Database
   11g Release 2 (11.2):
  • Minimum: 1 GB of RAM
Recommended: 2 GB of RAM or more
To determine the physical RAM size, enter the following command:
# /usr/sbin/prtconf | grep "Memory size"

If the size of the physical RAM is less than the required size, then you must install more memory before continuing.
The following table describes the relationship between installed RAM and the configured swap space recommendation:
Available RAM
Swap Space
Between 1 GB and 2 GB
1.5 times the size of the RAM
Between 2 GB and 16 GB
Equal to the size of the RAM
More than 16 GB
16GB

To determine the size of the configured swap space, enter the following command:
# /usr/sbin/swap -l
To determine the available RAM and swap space, enter the following command:
# sar -r -i n 
        
where, n is the number of seconds to delay for the next iterations and i is the number of iterations you want to test.
2.      Disk Space Requirements
The following are the disk space requirements for installing Oracle Database 11g Release 2 (11.2):
·         At least 1 GB of space in the /tmp directory
To determine the amount of disk space available in the /tmp directory, enter the following command:
# df -k /tmp
If there is less than 1 GB of free space in the /tmp directory, then complete one of the following steps:
·         Delete unnecessary files from the /tmp directory to meet the disk space requirement.
·         Set the TMP and TMPDIR environment variables when setting the oracle user's environment.
The following table shows the approximate disk space requirements for software files for each installation type:
Installation Type
Requirement for Software Files (GB)
Enterprise Edition
5.5
Standard Edition
5.5

3.      Operating System Requirements

The following are the operating system requirements for Oracle Database 11g Release 2 (11.2):
·         Oracle Solaris 10 U6 (5.10-2008.10)
Starting with Oracle Database 11g Release 2 (11.2.0.3), Oracle Database is also supported on the following operating system version (or later):
·         Oracle Solaris 11 11/11 X86
To determine the distribution and version of Oracle Solaris installed, enter the following command:
# uname -r
5.10

4.     Package Requirements

Oracle Solaris 10
·         SUNWarc
·         SUNWbtool
·         SUNWhea
·         SUNWlibC
·         SUNWlibm
·         SUNWlibms
·         SUNWsprot
·         SUNWtoo
·         SUNWi1of
·         SUNWi1cs (ISO8859-1)
·         SUNWi15cs (ISO8859-15)
·         SUNWxwfnt
·         SUNWcsl
To determine whether the required packages are installed, enter commands similar to the following:
# pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibC SUNWlibms SUNWsprot \
  SUNWtoo SUNWi1of SUNWi1cs SUNWi15cs SUNWxwfnt

5.     Operating system-specific patches

Installation Type or Product
Requirement
All installations
Patches for Oracle Solaris 10:
  • 120754-06: SunOS 5.10_x86 libmtsk
  • 119961-05: SunOS 5.10_x86: Assembler
  • 119964-14: SunOS 5.10_x86 Shared library patch for C++_x86
  • 137104-02
  • 139575-03
  • 139556-08
  • 141415-04
Database Smart Flash Cache (An Enterprise Edition only feature.)
The following patches are required for Oracle Solaris on x86-64 (64-bit) if you are using the flash cache feature:
140797-01
140900-01
141017-01
141415-10
141737-05

 

To determine whether an operating system patch is installed, enter a command similar to the following:
# /usr/sbin/patchadd -p | grep patch_number(without version number)

6.     Creating Required Operating System Groups and User

The following local operating system groups and users are required if you are installing Oracle Database:
·         The Oracle Inventory group (typically, oinstall)
·         The OSDBA group (typically, dba)
·         The Oracle software owner (typically, oracle)
·         The OSOPER group (Optional. Typically, oper)
To determine whether the oinstall group exists, enter the following command:
# more /var/opt/oracle/oraInst.loc
To determine whether the dba group exists, enter the following command:
# grep dba /etc/group
 If necessary, enter the following commands to create the oinstall and dba groups:
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
To determine whether the oracle user exists and belongs to the correct groups, enter the following command:
# id -a oracle
If the oracle user does not exist, enter the following command to create it:
# /usr/sbin/useradd -d /export/home/oracle -m -s /bin/bash -g oinstall -G dba oracle
Enter the following command to set the password of the oracle user:
# passwd -r files oracle

7.     Configuring Kernel Parameters on Oracle Solaris 10

On Oracle Solaris 10, verify that the kernel parameters shown in the following table are set to values greater than or equal to the minimum value shown.

Resource Control
Recommended Value
project.max-sem-ids
100
process.max-sem-nsems
256
project.max-shm-memory
4294967295
project.max-shm-ids
100

To display the current values of the resource control, enter the following commands:
$ id -p // to verify the project id
uid=100(oracle) gid=100(dba) projid=1 (group.dba)
$ prctl -n project.max-shm-memory -i project group.dba
$ prctl -n project.max-sem-ids -i project group.dba
 
To modify the value of max-shm-memory to 6 GB:
# prctl -n project.max-shm-memory -v 6gb -r -i project group.dba

8.     Configuring Shell Limits

The ulimit settings determine process memory related resource limits. Verify that the shell limits displayed in the following table are set to the values shown:
Shell Limit
Description
Soft Limit (KB)
Hard Limit (KB)
STACK
Size of the stack segment of the process
at most 10240
at most 32768
NOFILES
Open file descriptors
at least 1024
at least 65536
MAXUPRC or MAXPROC
Maximum user processes
at least 2047
at least 16384

To display the current value specified for these shell limits enter the following commands:
ulimit -s
ulimit –n
 

9.     Creating Required Directories

Create directories with names similar to the following, and specify the correct owner, group, and permissions for them:
·         The Oracle base directory
·         An optional Oracle data file directory
 
Enter the following command to create subdirectories in the mount point directory that you identified for the Oracle base directory:
# mkdir -p /u01/app/oracle
# mkdir -p /u01/app/oracle/product/11.2.0.2/db_1
 
If you intend to use a second file system for the Oracle Database files, then create an oradata subdirectory in the mount point directory that you identified for the Oracle data file directory (shown as /u02 in the examples):
# mkdir /u02/oradata
Change the owner and group of the directories that you created to the oracle user and the oinstall group:
# chown -R oracle:oinstall /u01/app/oracle
# chown -R oracle:oinstall /u01
Change the permissions on the directories that you created to 775:
# chmod -R 775 /u01/app/oracle
 

10. Configuring the oracle User's Environment

 
Edit .profile in /export/home/oracle. Adding the following parameters to this file:
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE 
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1
export ORACLE_HOME
ORACLE_UNQNAME=TRA
export ORACLE_UNQNAME
ORACLE_SID=TRA
export ORACLE_SID
TMP=/mount_point/tmp
TMPDIR=/mount_point/tmp
export TMP TMPDIR
PATH=$ORACLE_HOME/bin:$PATH; export PATH
UMASK=022
export UMASK

11. Mounting the Product Disc

On most Oracle Solaris systems, the product disc mounts automatically when you insert it into the drive.
If the disc does not mount automatically, then follow these steps to mount it:
1.      Switch user to root:
2.  $ su - root
3.      If necessary, enter a command similar to the following to eject the currently mounted disc, then remove it from the drive:
4.  # eject
5.      Insert the disc into the disc drive.
6.      To verify that the disc mounted automatically, enter a command similar to the following:
7.  # ls /dvd/dvd0
8.      If this command fails to display the contents of the disc, then enter a command similar to the following:
9.  # /usr/sbin/mount -r -F hsfs /dev/dsk/cxtydzs2 /dvd

12. Installing Oracle Database

To start Oracle Universal Installer, enter the following command:
$ /mount_point/db/runInstaller
Following the steps on the installation screen to complete the Oracle Database software installation task.
      II.            Install Oracle Grid Infrastructure 11gR2
Install Oracle Grid Infrastructure is next step in order to enable Oracle ASM management. Oracle GI must be installed in a separate folder than Oracle database binary (which has been installed in previous section).
With Oracle Grid Infrastructure 11g release 2 (11.2), Oracle Automatic Storage Management (Oracle ASM) and Oracle Clusterware are installed into a single home directory, which is referred to as the Grid Infrastructure home. The installation of the combined products is called Oracle Grid Infrastructure. However, Oracle Clusterware and Oracle Automatic Storage Management remain separate products.
With this release, Oracle Cluster Registry (OCR) and voting disks can be placed on Oracle Automatic Storage Management (Oracle ASM).
This feature enables Oracle ASM to provide a unified storage solution, storing all the data for the clusterware and the database, without the need for third-party volume managers or cluster filesystems.
With Oracle Clusterware 11g release 2 (11.2), during installation Oracle Universal Installer (OUI) generates Fixup scripts (runfixup.sh) that you can run to complete required preinstallation steps.
Oracle Database 11g Release 2 introduces the new Grid Infrastructure Oracle Home which includes Oracle Restart and Oracle Automatic Storage Management(ASM). To implement ASM, you must install Grid Infrastructure. ASM requires unformatted partitions to use as ASM disks and group into ASM diskgroups.

1.     Verify System Requirements

The minimum required RAM is at least 2.5 GB of RAM for Oracle Grid Infrastructure for a Cluster installations, including installations where you plan to install Oracle RAC. For systems with 2.5 GB to 16 GB RAM, Oracle recommends that you use swap space equal to RAM.
Enter the following commands to check available memory:
# /usr/sbin/prtconf | grep "Memory size"

# /usr/sbin/swap –s

Ensure that you have at least 1 GB of space in /tmp. If this space is not available, then increase the size, or delete unnecessary files in /tmp.
# df –h /tmp

2.     Create Groups and Users

Using the same user oinstall, oracle and dba group which are created in the previous section. Create a new home for Oracle GI.

# mkdir -p /u01/app/11.2.0/grid
# chown -R oracle:oinstall /u01
# chmod -R 775 /u01/

Login as the "oracle" user and add the following lines at the end of the "/home/oracle/.bash_profile" file.

Create a file called "/home/oracle/grid_env" with the following contents.

RACLE_SID=+ASM1; export ORACLE_SID
ORACLE_HOME=$GRID_HOME; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$BASE_PATH; export PATH
 
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

Create a file called "/home/oracle/db_env" with the following contents.

ORACLE_SID=RAC1; export ORACLE_SID
ORACLE_HOME=$DB_HOME; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$BASE_PATH; export PATH
 
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

3.     Disk Configuration - (External Disks for ASM)

Before any of the disks can be discovered by ASM, they need to be properly partitioned and configured. Before providing the details on how to partition disks, here are some things to keep in mind with regards to configuring disks for ASM:

·         It is recommended when allocating disks for use by ASM, to use the entire disk and allocate this space to slice 4.

·         Before creating the large partition on slice 4 (as described in the previous item) it is required to reserve a small partition (i.e. 500MB) on slice 0 first - then to allocate all remaining space  to slice 4.

·         Slice 0 cannot be used as an ASM disk. Using this slice causes disk corruption and may render the disk as unusable.

·         Never use or modify slice 2 of a disk under Solaris as this slice is reserved for the backup partition and always refers to the entire disk.

·         Use the format utility to create disk partitions.

Run the format command to create the appropriate partitions on all disks that will be used for Oracle ASM.

# format
Searching for disks...done
 
 
AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <WDC WD400BB-22DEA0 cyl 19156 alt 2 hd 16 sec 255>
          /pci@1f,0/ide@d/dad@0,0
       1. c0t2d0 <WDC WD400BB-22DEA0 cyl 19156 alt 2 hd 16 sec 255>
          /pci@1f,0/ide@d/dad@2,0
       2. c1t0d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
          /pci@1f,0/pci@5/scsi@1/sd@0,0
       3. c1t1d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
          /pci@1f,0/pci@5/scsi@1/sd@1,0
Specify disk (enter its number): 2
 
selecting c1t0d0
[disk formatted]
 
FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> partition
 
PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd>     - execute <cmd>, then return
        quit
partition> modify
Select partitioning base:
        0. Current partition table (original)
        1. All Free Hog
Choose base (enter number) [0]? 1
 
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0               0         (0/0/0)           0
  1       swap    wu       0               0         (0/0/0)           0
  2     backup    wu       0 - 4923        8.43GB    (4924/0/0) 17682084
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6        usr    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
 
Do you wish to continue creating a new partition
table based on above table[yes]? yes
Free Hog partition[6]? 7
Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]: 500mb
Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]: 7.9gb
Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '6' [0b, 0c, 0.00mb, 0.00gb]:
 
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0 -  285      501.48MB    (286/0/0)   1027026
  1       swap    wu       0               0         (0/0/0)           0
  2     backup    wu       0 - 4923        8.43GB    (4924/0/0) 17682084
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm     286 - 4899        7.90GB    (4614/0/0) 16568874
  5 unassigned    wm       0               0         (0/0/0)           0
  6        usr    wm       0               0         (0/0/0)           0
  7 unassigned    wm    4900 - 4923       42.08MB    (24/0/0)      86184
 
Okay to make this the current partition table[yes]? yes
Enter table name (remember quotes): "asm"
 
Ready to label disk, continue? yes
 
partition> quit
format> verify
 
format> disk
 
 
AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <WDC WD400BB-22DEA0 cyl 19156 alt 2 hd 16 sec 255>
          /pci@1f,0/ide@d/dad@0,0
       1. c0t2d0 <WDC WD400BB-22DEA0 cyl 19156 alt 2 hd 16 sec 255>
          /pci@1f,0/ide@d/dad@2,0
       2. c1t0d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
          /pci@1f,0/pci@5/scsi@1/sd@0,0
       3. c1t1d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
          /pci@1f,0/pci@5/scsi@1/sd@1,0
Specify disk (enter its number)[2]: <Continue with disks 3>
 

The next step in this section is to configure the main data slices (created above on slice 4) for use as ASM disks.

We start by looking in the /dev/rdsk directory to locate the raw interfaces (logical) that already exist for the slice(s) we created in the previous tasks.
# cd /dev/rdsk
# ls -l c1t0d0s4 c1t1d0s4
# ls -lL c1t0d0s4 c1t1d0s4
crw-r-----   1 root     sys       33, 196 Dec 15 13:51 c1t0d0s4
crw-r-----   1 root     sys       33, 260 Dec 15 13:51 c1t1d0s4
We start by creating a directory to store these new interfaces:
# su -
# mkdir /asmdisks
# cd /asmdisks

The next step is to use the mknod utility. The mknod utility is used to create both character and block special files.

# mknod disk1 c 32 4
# mknod disk2 c 32 12
The above commands created 2 character special files which are simply raw interfaces to the slices that we had created earlier in this section:
# ls -l /asmdisks

The final step we should perform is to give the appropriate permissions to these files for the oracle

user account and the ASM instance:

 

# cd /asmdisks
# chown oracle:dba disk1
# chown oracle:dba disk2

We now have the slices ready to be accessible by the ASM instance.

Download Oracle Grid Infrastructure CD or zip file from Oracle software distribution. Decompress zip file to specific folder.

Login oracle user and start GI installer:

# su – oracle
# cd /u02/installation/grid
#./runInstaller

Following the instruction on the screen complete the GI installation task (Select Install Oracle Grid Infrastructure in Standalone mode in the second step). During the installation Oracle installer allows to create the first ASM group, name it and select ASM disk candidates from created slices above.

    III.             Use ASMCA GUI interface for creating ASM disk groups

- Set ORACLE_HOME, PATH variable to Grid Infra home location.
- Make sure proper DISPLAY variable is configured.

- Run command asmca from $GRID_HOME/bin

Click on create button

Here it should discover all raw devices which was configured in previous step

Select any one of the Disk with "external" redundancy and click "OK"

Creation of Disk Group completed Successfully, now you can use this Disk group for all your oracle storage requirements.