Oracle Database Experts

By Charles Kim

August 11th, 2007

Setup Oracle ASMLIB

FDISK Output

[root@rac103 ~]# fdisk -l

Disk /dev/hda: 82.3 GB, 82348277760 bytes

240 heads, 63 sectors/track, 10637 cylinders

Units = cylinders of 15120 * 512 = 7741440 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 1354 10236208+ 83 Linux

/dev/hda2 1355 6772 40960080 83 Linux

/dev/hda3 6773 7043 2048760 82 Linux swap

/dev/hda4 7044 10637 27170640 5 Extended

/dev/hda5 7044 7314 2048728+ 83 Linux

/dev/hda6 7315 8348 7817008+ 83 Linux

/dev/hda7 8349 9382 7817008+ 83 Linux

/dev/hda8 9383 10416 7817008+ 83 Linux

Change permission for disks

[root@rac103 ~]# cd /dev

[root@rac103 dev]# chown oracle:oinstall /dev/hda6

[root@rac103 dev]# chown oracle:oinstall /dev/hda7

[root@rac103 dev]# chown oracle:oinstall /dev/hda8

Configure ASM

[root@rac103 dev]# cd /etc/init.d

[root@rac103 init.d]# ls -l oracle*

-rwxr-xr-x 1 root root 18114 Oct 24 2006 oracleasm

[root@rac103 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 <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 []: oinstall

Start Oracle ASM library driver on boot (y/n) [n]: y

Fix permissions of Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: [ OK ]

Loading module “oracleasm”: [ OK ]

Mounting ASMlib driver filesystem: [ OK ]

Scanning system for ASM disks: [ OK ]

[root@rac103 init.d]#

[root@rac103 init.d]# ./oracleasm

Usage: ./oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}

[root@rac103 init.d]# ./oracleasm createdisk DATA1 /dev/hda6

Marking disk “/dev/hda6″ as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm createdisk DATA2 /dev/hda7

Marking disk “/dev/hda7″ as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm createdisk FRA1 /dev/hda8

Marking disk “/dev/hda8″ as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# ./oracleasm querydisk DATA1

Disk “DATA1″ is a valid ASM disk on device [3, 6]

[root@rac103 init.d]# ./oracleasm querydisk DATA2

Disk “DATA2″ is a valid ASM disk on device [3, 7]

[root@rac103 init.d]# ./oracleasm querydisk FRA1

Disk “FRA1″ is a valid ASM disk on device [3, 8]

[root@rac103 init.d]# ./oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# ./oracleasm scandisks

Scanning system for ASM disks: [ OK ]

[root@rac103 init.d]# ./oracleasm stop

Unmounting ASMlib driver filesystem: [ OK ]

Unloading module “oracleasm”: [ OK ]

[root@rac103 init.d]# ./oracleasm start

Loading module “oracleasm”: [ OK ]

Mounting ASMlib driver filesystem: [ OK ]

Scanning system for ASM disks: [ OK ]

 

Now start CSS for non-RAC ASM
cd $ORACLE_HOME/bin

[root@rac103 bin]# ./localconfig add

/etc/oracle does not exist. Creating it now.

Successfully accumulated necessary OCR keys.

Creating OCR keys for user ‘root’, privgrp ‘root’..

Operation successful.

Configuration for local CSS has been initialized

 

Adding to inittab

Startup will be queued to init within 90 seconds.

Checking the status of new Oracle init process…

Expecting the CRS daemons to be up within 600 seconds.

CSS is active on these nodes.

rac103

CSS is active on all nodes.

Oracle CSS service is installed and running under init(1M)

 

Listdisks and Querydisk

[root@rac103 init.d]# /etc/init.d/oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda6

Disk “/dev/hda6″ is marked an ASM disk with the label “DATA1″

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda7

Disk “/dev/hda7″ is marked an ASM disk with the label “DATA2″

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda8

Disk “/dev/hda8″ is marked an ASM disk with the label “FRA1″

 

Resetting CSS to new oracle home

[root@rac103 bin]# ./localconfig reset /apps/oracle/product/11.1.0/ASM

Successfully accumulated necessary OCR keys.

Creating OCR keys for user ‘root’, privgrp ‘root’..

Operation successful.

Configuration for local CSS has been initialized

Stale CSS daemon is running… killing it now

Cleaning up Network socket directories

Setting up Network socket directories

Adding to inittab

Startup will be queued to init within 30 seconds.

Checking the status of new Oracle init process…

Expecting the CRS daemons to be up within 600 seconds.

Cluster Synchronization Services is active on these nodes.

rac103

Cluster Synchronization Services is active on all the nodes.

Oracle CSS service is installed and running under init(1M)

 

Manually Cleaning up CSS

[root@rac103 bin]# ./localconfig delete

Stopping Cluster Synchronization Services.

Shutting down the Cluster Synchronization Services daemon.

Shutdown request successfully issued.

Shutdown has begun. The daemons should exit soon.

Cleaning up Network socket directories

[root@rac103 bin]# ps -ef |grep -i css

root 6477 6288 0 18:25 pts/2 00:00:00 grep -i css

[root@rac103 bin]# ./localconfig add

Successfully accumulated necessary OCR keys.

Creating OCR keys for user ‘root’, privgrp ‘root’..

Operation successful.

Configuration for local CSS has been initialized

 

Cleaning up Network socket directories

Setting up Network socket directories

Adding to inittab

Startup will be queued to init within 30 seconds.

Checking the status of new Oracle init process…

Expecting the CRS daemons to be up within 600 seconds.

Cluster Synchronization Services is active on these nodes.

rac103

Cluster Synchronization Services is active on all the nodes.

Oracle CSS service is installed and running under init(1M)

August 11th, 2007

Redhat Linux Setup

Create Oracle User:

# groupadd oinstall
# groupadd dba
# mkdir -p /home/oracle /ocfs
# useradd -d /home/oracle -g oinstall -G dba -s /bin/ksh oracle
# chown oracle:dba /export/home/oracle /apps
# echo "oracle123" |passwd oracle
passwd: password successfully changed for oracle
Setup /etc/profile
if [ $USER = "oracle" ]; then            
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384                        
    ulimit -n 65536            
  else                        
  ulimit -u 16384 -n 65536            
  fi
fi

/etc/pam.d/login
session required /lib/security/pam_limits.so

 

/etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
/etc/sysctl.conf
kernel.shmall                = 2097152
kernel.shmmax                = 2147483648
kernel.shmmni                = 4096
kernel.sem                   = 250 32000 100 128
fs.file-max                  = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default        = 1048576
net.core.rmem_max            = 1048576
net.core.wmem_default        = 262144
net.core.wmem_max            = 262144

FOR COMPLETE step by step shell scripts, please consult the DBAExpert.com website:  http://dbaexpert.com/linux/

				
August 11th, 2007

Mount NFS

On the server: 
First, modify /etc/exports
         #
         # /etc/exports for DBAExpert.com
         #
         /apps/oracle/11g rac101.dbaexpert.com(rw) \
                          rac11.dbaexpert.com

Start the NFS Server processes
service nfs start

On the client, mount the share:
First, create the directory for 11g (as in this example).  Next, mount the file system:
mount rac1:/apps/oracle/11g /11g

				
|