a practical guide to oracle 10g rac its real easy! gavin soorma, emirates airline, dubai session#...

113
A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Upload: miles-mckenzie

Post on 16-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

A Practical Guide to Oracle 10g RAC

Its REAL Easy!

Gavin Soorma,

Emirates Airline, Dubai

Session# 106

Page 2: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Agenda• RAC concepts• Planning for a RAC installation• Pre Installation steps• Installation of 10g R2 Clusterware• Installation of 10g R2 Software • Creation of RAC database• Configuring Services and TAF• Migration of single instance to RAC

Page 3: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

What Is a RAC Cluster?

• Nodes• Interconnect• Shared disk subsystem• Instances• Database

NodeNode

Interconnect

Disks

Page 4: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Database vs InstanceRAC Cluster consists of ….

One or more instances

One Database residing on shared storage

Node 1

Instance 1

Node 2

Instance 2Interconnect

Shared Storage

LocalDisk

LocalDisk

Database

Page 5: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Why RAC?

• High Availability – survive node and instance failures

• Scalability – Add or remove nodes when needed

• Pay as you grow – harness the power of multiple low-cost computers

• Enable Grid Computing

• DBA’s have their own vested interests!

Page 6: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

What is Real Application Clusters?

• Two or more interconnected, but independent servers

• One instance per node

• Multiple instances accessing the same database

• Database files stored on disks physically or logically connected to each node, so that every instance can read from or write to them

Page 7: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

A RAC Database –what’s different?

Contents similar to single instance database except …

•Create and enable one redo thread per instance

•If using Automatic Undo Management also require one UNDO tablespace per instance

•Additional cluster specific data dictionary views created by running the script $ORACLE_HOME/rdbms/admin/catclust.sql

•New background processes

•Cluster specific init.ora parameters

Page 8: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

RAC specific Background Processes

• LMON – Global Enqueue Service Monitor• LMD0 – Global Enqueue Service Daemon• LMSx – Global Cache Server Processes• LCK0 – Lock Process• DIAG – Diagnosability Process

Page 9: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

RAC init.ora Parameters

*.db_cache_size=113246208*.java_pool_size=4194304*.db_name='racdb‘racdb2.instance_number=2racdb1.instance_number=1*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'racdb2.thread=2racdb1.thread=1*.undo_management='AUTO'racdb2.undo_tablespace='UNDOTBS2'racdb1.undo_tablespace='UNDOTBS1'

Page 10: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC Implementation Steps

• Hardware – Network Interface Cards, HBA cards etc• Interconnects – Physical cable, Gigabit Ethernet switch• Network – Virtual IP addresses• Plan the type of shared storage (ASM, OCFS etc)• Download latest RPM’s – ASM, OCFS • Install Clusterware (Cluster Ready Services)• Install 10g RAC software• Create RAC database • Configure Services and TAF ( Transparent Application Failover)

Page 11: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

RAC Database Storage

• Oracle files (control file, data files, redo log files)• Server Parameter File ( SPFILE)• Archive log files• Flash Recovery Area• Voting File• Oracle Cluster Registry (OCR) File• OCFS version 2.x will support shared ORACLE_HOME

Page 12: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Oracle Cluster Registry File

• OCR contains important metadata about RAC instances and nodes that make up the cluster

• Needs to be on a shared storage device

• About 100MB in size

• In Oracle 10g Release 2, higher availability for this critical component is provided by enabling a second OCR file location

Page 13: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Voting Disk File

• Contains information about cluster membership

• Used by CRS to avoid ‘split-brain’ scenarios if any node loses contact over the interconnect

• Mandatory to be located on shared storage

• Typically about 20MB in size

• Can be mirrored in Oracle 10g Release 2

Page 14: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Shared Storage Considerations Mandatory for:

Datafiles, Redo Log Files, Control Files, SPFile

Optional for:

Archive logfiles, Executables, Binaries, Network Configuration files

Supported shared storage

NAS (network attached storage)

SAN ( storage area network)

Supported file storage

Raw volumes

Cluster File System

ASM

Page 15: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Shared Storage Considerations

• Archive log files cannot be placed on raw devices

• CRS Files ( Voting Disk/Cluster Registry (OCR) cannotbe stored on ASM

• Software is installed on regular file system local to each node

• Database files can exist on raw devices, ASM or Cluster File System (OCFS)

Page 16: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Network Requirements

• Each node must have at least two network adapters; one for the public network interface and one for the private network interface (the interconnect).

• The public network adapter must support TCP/IP

• For the private network, the interconnect must preferably be a Gigabit Ethernet switch that supports UDP. This is used for Cache Fusion inter-node connection

• Host name and IP addresses associated with the public interface should be registered in DNS and /etc/hosts

Page 17: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

IP Address Requirements

For each Public Network Interface an IP address and host

name registered in the DNS

One unused Virtual IP address and associated host name

registered in the DNS for each node to be used in the cluster

A private IP address and optional host name for each private

interface

Virtual IP addresses is used in the network config files

Page 18: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Virtual IP Addresses

• VIPs are used in order to facilitate faster failover in the event of a node failure

• Each node not only has its own statically assigned IP address as well as also a virtual IP address that is assigned to the node

• The listener on each node will be listening on the Virtual IP and client connections will also come via this Virtual IP.

• Without VIP, clients will have to wait for long TCP/IP timeout before getting an error message or TCP reset from nodes that have died

Page 19: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Sample /etc/hosts file

racdb1:/opt/oracle> cat /etc/hosts

# Do not remove the following line, or various programs# that require network functionality will fail.#127.0.0.1 itlinuxbl53.hq.emirates.com itlinuxbl53

localhost.localdomain localhost57.12.70.59 itlinuxbl54.hq.emirates.com itlinuxbl5457.12.70.58 itlinuxbl53.hq.emirates.com itlinuxbl5310.20.176.74 itlinuxbl54-pvt.hq.emirates.com itlinuxbl54-pvt10.20.176.73 itlinuxbl53-pvt.hq.emirates.com itlinuxbl53-pvt57.12.70.80 itlinuxbl54-vip.hq.emirates.com itlinuxbl54-vip57.12.70.79 itlinuxbl53-vip.hq.emirates.com itlinuxbl53-vip

Page 20: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Setup User equivalence using SSH

• To install on all nodes in the cluster by launching OUI on one node• Will not prompt for password• OUI will use ssh or rcp to copy files to remote nodes

ssh-keygen -t dsa

cat id_dsa.pub > authorized_keys

• Copy authorized_keys from this node to other nodes • Run the same command on all nodes to generate the

authorized_keys file• Finally all nodes will have the same authorized_keys file

Page 21: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Setting up User Equivalence

ITLINUXBL53ssh-keygen -t dsa

cat id_dsa.pub > authorized_keys

scp authorized_keys itlinuxbl54:/opt/oracle

ITLINUXBL54ssh-keygen -t dsa

cat id_dsa.pub >> authorized_keys

scp authorized_keys itlinuxbl53:/opt/oracle/.ssh

ssh itlinuxbl54 hostname

ssh itlinuxbl53 hostname

Page 22: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configure the hang check timer

• Monitors the Linux kernel for hangs • If hang occurs module reboots the node • Define how often in seconds module checks for hangs• Define how long module waits for response from kernel

[root@itlinuxbl53 rootpre]# /sbin/insmod hangcheck-timer

hangcheck_tick=30 hangcheck_margin=180Using /lib/modules/2.4.21-37.ELsmp/kernel/drivers/char/hangcheck-timer.o

[root@itlinuxbl53 rootpre]# lsmod | grep hanghangcheck-timer 2672 0 (unused)

Page 23: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Case Study Environment

• Operating System: LINUX X86_64 RHEL 3AS• Hardware: HP BL25P Blade Servers with 2 CPU’s (AMD 64 bit

processors) and 4 GB of RAM • Oracle Software: Oracle Database 10g Enterprise Edition

Release 10.2.0.1.0 - 64bit• Two Node Cluster: ITLINUXBL53.hq.emirates.com,

ITLINUXBL54.hq.emirates.com• Shared Storage: OCFS for Cluster Registry and Voting Disks.

ASM for all other database related files• Database Name: racdb• Instance Names: racdb1, racdb2

Page 24: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Oracle 10g CRS Install

• Oracle 10g Clusterware – Cluster Ready Services• Oracle’s own full-stack clusterware coupled with RAC• Replaces earlier dependency on third-party clusterware• Oracle CRS replaces the Oracle Cluster Manager (ORACM) in

Oracle9i RAC• CRS must be installed prior to the installation of Oracle RAC

Page 25: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

CRS Installation – Key Steps

• Voting Disk – about 20MB (Oracle9i Quorum Disk)Maintains the node heartbeat and avoids the node split-

brain syndrome

• Oracle Cluster Registry – about 100MBStores cluster configuration and cluster database

information

• Private Interconnect Information Select the network interface for internode communicationA Gigabit Ethernet interface is recommended

• Run root.shStart CRS daemon processes – evmd, cssd, crsd

Page 26: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Oracle Cluster File System

• Shared disk cluster file system for LINUX and Windows

• Improves management of data by eliminating the need to manage raw devices

• Can be downloaded from OTN http://oss.oracle.com/projects/ocfs

• OCFS 2.1.2 provides support on Linux for Oracle Software installation as well

Page 27: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Install the OCFS RPM’s

[root@itlinuxbl54 recyclebin]# rpm -ivh ocfs-support-1.1.5-1.x86_64.rpmPreparing... ########################################### [100%] 1:ocfs-support ########################################### [100%]

[root@itlinuxbl54 recyclebin]# rpm -ivh ocfs-tools-1.0.10-1.x86_64.rpmPreparing... ########################################### [100%] 1:ocfs-tools ########################################### [100%]

[root@itlinuxbl54 recyclebin]# rpm -ivh ocfs-2.4.21-EL-smp-1.0.14-1.x86_64.rpmPreparing... ########################################### [100%] 1:ocfs-2.4.21-EL-smp ########################################### [100%]

Page 28: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

OCFSTOOL – Generate Config

Page 29: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

The OCFS Configuration File

[root@itlinuxbl53 etc]# cat /etc/ocfs.conf## ocfs config# Ensure this file exists in /etc# node_name = itlinuxbl53.hq.emirates.com ip_address = 10.20.176.73 ip_port = 7000 comm_voting = 1 guid = 5D9FF90D969078C471310016353C6B23

Page 30: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

OCFSTOOL – Format Partition

Page 31: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

OCFSTOOL – Mount File System

Page 32: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

OCFSTOOL – Mount File System

Page 33: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

OCFSTOOL – Mount File System

Page 34: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

ASM Architecture

Clustered Pool of Storage

ASM Instance ASM Instance

Clustered Servers

RACDatabase

Oracle

DB Instance

Oracle

DB Instance

Disk Group

Page 35: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Install the ASMLIB RPM’s

[root@itlinuxbl53 recyclebin]# rpm -ivh oracleasm-support-2.0.1-1.x86_64.rpmPreparing... ########################################### [100%] 1:oracleasm-support ###########################################

[100%][[root@itlinuxbl53 recyclebin]# rpm -ivh oracleasm-2.4.21-37.ELsmp-1.0.4-

1.x86_64.rpmPreparing... ########################################### [100%] 1:oracleasm-2.4.21-37.ELs###########################################

[root@itlinuxbl53 recyclebin]# rpm -ivh oracleasmlib-2.0.1-1.x86_64.rpmPreparing... ########################################### [100%] 1:oracleasmlib ###########################################

[100%]

Page 36: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Disks

[root@itlinuxbl53 init.d]# ./oracleasm createdisk VOL1 /dev/sddlmab1Marking disk "/dev/sddlmab1" as an ASM disk: [ OK ]

[root@itlinuxbl53 init.d]# ./oracleasm createdisk VOL2 /dev/sddlmac1Marking disk "/dev/sddlmac1" as an ASM disk: [ OK ]

[root@itlinuxbl53 init.d]# ./oracleasm createdisk VOL3 /dev/sddlmaf1Marking disk "/dev/sddlmaf1" as an ASM disk: [ OK ]

[root@itlinuxbl53 init.d]# ./oracleasm listdisksVOL1VOL2VOL3

[root@itlinuxbl54 init.d]# ./oracleasm scandisksScanning system for ASM disks: [ OK ]

Page 37: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

The Cluster Verify Utility(cluvfy)

• Perform pre-installation and post-installation checks at various stages of the RAC installation

• Available in 10g Release 2

./runcluvfy.sh comp nodereach -n itlinuxbl53,itlinuxbl54 –verbose

./runcluvfy.sh stage -pre crsinst -n itlinuxbl53,itlinuxbl54 –verbose

./runcluvfy.sh comp nodecon -n itlinuxbl53,itlinuxbl54 –verbose

./runcluvfy.sh stage -post hwos -n itlinuxbl53 -verbose

Page 38: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Install the cvuqdisk RPM for cluvfy

[root@itlinuxbl53 root]# cd /opt/oracle/cluster_cd/clusterware/rpm

[root@itlinuxbl53 rpm]# ls

cvuqdisk-1.0.1-1.rpm

[root@itlinuxbl53 rpm]# export CVUQDISK_GRP=dba

[root@itlinuxbl53 rpm]# rpm -ivh cvuqdisk-1.0.1-1.rpmPreparing... ###########################################

[100%] 1:cvuqdisk ###########################################

[100%]

Page 39: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g Clusterware Installation

Page 40: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Prerequisites Validation

Page 41: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring the 10g RAC Cluster

Page 42: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring the 10g RAC Cluster

Page 43: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring the Network Interfaces

Page 44: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Oracle Cluster Registry (OCR)

Page 45: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Mirroring the OCR

Page 46: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Voting Disk

Page 47: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g Clusterware OUI – Remote Installation

Page 48: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g Clusterware – root.sh

Page 49: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuration Assistants

Page 50: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC phase one complete!

Page 51: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Verifying the Oracle Clusterware Installation

Check node reachability

[oracle@itlinuxbl53 bin]$ ./olsnodes -n

itlinuxbl53 1

itlinuxbl54 2

Check for Clusterware processes

ps –ef |grep crs

ps –ef |grep css

ps –ef |grep evm

Check the health of the CRS stack

./crsctl check crs

Page 52: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC Software Installation

Page 53: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC Installation

Page 54: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC Software Installation

Page 55: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC Software Installation

Page 56: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC Software Installation

Page 57: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC Software Installation Remote Node Installation

Page 58: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

10g RAC Software Installation

Page 59: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 60: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring ASM

Page 61: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Instances

Page 62: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Instances

Page 63: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Instances

Page 64: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Instances

Page 65: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Disk Groups

Page 66: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Disk Groups

Page 67: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Disk Groups

Page 68: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Disk Groups

Page 69: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the ASM Disk Groups

Page 70: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 71: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

DBCA is also Cluster aware

Page 72: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 73: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 74: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 75: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 76: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 77: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 78: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 79: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Creating the RAC Database using DBCA

Page 80: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Enabling Flashback & Archive logging

•Archive log files preferably need to be located on shared storage – in this case the ASM Disk Group

SQL> alter system set db_recovery_file_dest_size=2G scope=both sid='*';

SQL> alter system set db_recovery_file_dest='+DG1' scope=both sid='*';

SQL> alter system set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST' scope=both sid='*';

SQL> shutdown immediate;

Note: shutdown the other instances as well

Page 81: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Enabling Flashback & Archive logging

• Connect to one of the instances in the RAC cluster and mount the instance

SQL> startup mount;SQL> alter database archivelog;SQL> alter database open;

• Startup other instances in the RAC cluster as well

SQL> archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 15Next log sequence to archive 16Current log sequence 16

Page 82: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Services

• Logically group consumers who share common attributes like workload, a database schema or some common application functionality

• Manage client load balancing• Manage server-side load balancing• Connect-time failover with TAF• Controlled by tnsnames.ora parameters FAILOVER=ON,

FAILOVER_MODE, METHOD• Managed via DBCA or SRVCTL commands

Page 83: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring Services

Page 84: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring Services

Page 85: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring Services

Page 86: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring Services

Page 87: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Configuring Services

Page 88: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Managing services (srvctl)racdb2:/opt/oracle/product/10.2.0/db/bin>srvctl status asm -n itlinuxbl53ASM instance +ASM1 is running on node itlinuxbl53.

racdb2:/opt/oracle/product/10.2.0/db/bin>srvctl config database -d racdbitlinuxbl53 racdb1 /opt/oracle/product/10.2.0/dbitlinuxbl54 racdb2 /opt/oracle/product/10.2.0/db

racdb2:/var/opt/oracle>srvctl start database -d racdbracdb2:/var/opt/oracle>srvctl status database -d racdbInstance racdb1 is running on node itlinuxbl53Instance racdb2 is running on node itlinuxbl54

racdb2:/var/opt/oracle>srvctl config service -d racdbracdb_blade53 PREF: racdb1 AVAIL: racdb2racdb_blade54 PREF: racdb2 AVAIL: racdb1

racdb2:/var/opt/oracle>srvctl status service -d racdb -s racdb_blade53Service racdb_blade53 is running on instance(s) racdb1

Page 89: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Transparent Application Failover (TAF)

• TAF defined by FAILOVER_MODE parameter

• TYPE=SESSION

- User does not need to reconnect

- Session failed over to another available instance in the list

- But SQL statements in progress will have to be reissued

• TYPE=SELECT

- Query will be restarted after failover

- Rows not fetched before failover will be retrieved

Page 90: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Transparent Application Failover (TAF)

Connection modes METHOD=BASIC or PRECONNECT

• BASIC - After failover connection must reconnect to next address in the list- Additional time to failover

• PRECONNECT - Session is opened against all addresses in the list- Only one is used – others remain connected- Faster failover with preconnected sessions- More memory resources consumed by preconnected sessions on other nodes

Page 91: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

tnsnames.ora for RAC Client-side load balancing

ERP = (DESCRIPTION = (LOAD_BALANCE = ON) (FAILOVER=ON)(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = rac1vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = rac2vip)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = ERP.WORLD) (FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))

Server-side load balancing

*.REMOTE_LISTENERS=RACDB_LISTENERS – init.ora parameter

RACDB_LISTENERS=(DESCRIPTION=(ADDRESS=(PROTOCOL = TCP)(HOST = rac1vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST =rac2vip)(PORT = 1521))

Page 92: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Recovery and RACSQL> INSERT INTO SH.MYOBJECTS SELECT * FROM DBA_OBJECTS ;

SQL> DELETE FROM SH.MYOBJECTS;

SQL> COMMIT;

Now get the log sequence ….

SQL> SELECT SEQUENCE#, THREAD#, STATUS FROM V$LOG;

SEQUENCE# THREAD# STATUS---------- ---------- ----------------

9 1 INACTIVE 10 1 CURRENT 4 2 ACTIVE 5 2 CURRENT

Page 93: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Recovery and RAC (contd)RMAN> LIST BACKUP OF DATABASE SUMMARY;

List of Backups===============Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag------- -- -- - ----------- --------------- ------- ------- ---------- ---12 B F A DISK 05-FEB-06 1 1 NO BACKUP_RACDB.HQ.EM_020506082809

Connect to instance racdb2 ……

RMAN> LIST BACKUP OF DATABASE SUMMARY;

List of Backups===============Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag------- -- -- - ----------- --------------- ------- ------- ---------- ---12 B F A DISK 05-FEB-06 1 1 NO BACKUP_RACDB.HQ.EM_020506082809

Since the same control files are used by both instances RACDB1 and RACDB2 (same db RACDB) the output is the same on both sides.

Page 94: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Recovery and RAC (contd)

srvctl stop database -d RACDBsrvctl start database -d RACDB -o mount

export ORACLE_SID=racdb1

run { set until logseq 10 thread 1; set autolocate on; allocate channel c1 type disk; restore database ; recover database ; release channel c1;}

Page 95: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Recovery and RAC (contd)

Starting restore at 05-FEB-06

channel c1: starting datafile backupset restorechannel c1: specifying datafile(s) to restore from backup setrestoring datafile 00001 to +DG1/racdb/datafile/system.256.1…….. ……..piece handle=+DG1/racdb/backupset/2006_02_05/nnndf0_tag20060205t101703_0.665.7 tag=TAG20060205T101703channel c1: restore completeFinished restore at 05-FEB-06

Starting recover at 05-FEB-06starting media recovery

archive log thread 1 sequence 9 is already on disk as file +DG1/racdb/archivelog/2006_02_05/thread_1_seq_9.653.7archive log thread 2 sequence 4 is already on disk as file +DG1/racdb/archivelog/2006_02_05/thread_2_seq_4.662.7

RMAN> sql ' alter database open resetlogs';

Page 96: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Create the directory structure for the database files and archive log files on the OCFS file system

$ cd /ocfs/oradata/

$ mkdir gavin

$ cd /ocfs/oradata/gavin

$ mkdir arch

Page 97: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Backup the current control file to trace

SQL> alter database backup controlfile to trace;

• Edit the CREATE CONTROLFILE script to change the location of all the datafiles and redo log files to the OCFS file system

Page 98: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

CREATE CONTROLFILE REUSE DATABASE "GAVIN" NORESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 454LOGFILE GROUP 1 '/ocfs/oradata/gavin/redo01.log' SIZE 10M, GROUP 2 '/ocfs/oradata/gavin/redo02.log' SIZE 10M, GROUP 3 '/ocfs/oradata/gavin/redo03.log' SIZE 10M-- STANDBY LOGFILEDATAFILE '/ocfs/oradata/gavin/system01.dbf', '/ocfs/oradata/gavin/undotbs01.dbf', '/ocfs/oradata/gavin/sysaux01.dbf', '/ocfs/oradata/gavin/users01.dbf', '/ocfs/oradata/gavin/example01.dbf'CHARACTER SET WE8ISO8859P1;

Page 99: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Shutdown the database and copy the files from the original location to the OCFS location

$ cd /u01/ORACLE/gavin/

$ ls

arch control03.ctl redo02.log system01.dbf users01.dbf

control01.ctl example01.dbf redo03.log temp01.dbf

control02.ctl redo01.log sysaux01.dbf undotbs01.dbf

$ cp *.* /ocfs/oradata/gavin

Page 100: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Change the location of the control files in the init.ora

*.control_files='/ocfs/oradata/gavin/control01.ctl','/ocfs/oradata/gavin/control02.ctl','/ocfs/oradata/gavin/control03.ctl‘

• Run the script to recreate the controlfile

SQL> startup nomount;

SQL> @crectl

Page 101: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

•Note that the new location of the datafiles of the database is now the shared OCFS file system

SQL> select name from v$datafile;

NAME

--------------------------------------------------------------------------------

/ocfs/oradata/gavin/system01.dbf

/ocfs/oradata/gavin/undotbs01.dbf

/ocfs/oradata/gavin/sysaux01.dbf

/ocfs/oradata/gavin/users01.dbf

/ocfs/oradata/gavin/example01.dbf

Page 102: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Create the cluster specific data dictionary views by running

the catclust.sql script

SQL> @?/rdbms/admin/catclust.sql

Page 103: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Each instance in the cluster needs to have access to its own thread of online redo log files.

• Create another thread of online log files

SQL> alter database add logfile thread 2 2 group 4 ('/ocfs/oradata/gavin/redo04.log') size 10m, 3 group 5 ('/ocfs/oradata/gavin/redo05.log') size 10m, 4 group 6 ('/ocfs/oradata/gavin/redo06.log') size 10m;Database altered.

• Enable the thread

SQL> alter database enable public thread 2;Database altered.

Page 104: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Each instance needs to have its own dedicated undo tablespace as well

SQL> create undo tablespace undotbs2 datafile

2 '/ocfs/oradata/gavin/undotbs02.dbf' size 200m;

Tablespace created

Page 105: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Make the following changes to the Init.ora parameter file:

ADD the following entries

*.cluster_database=TRUE*.cluster_database_instances=2gavin1.instance_name=gavin1gavin2.instance_name=gavin2gavin1.instance_number=1gavin2.instance_number=2gavin1.thread=1gavin2.thread=2gavin1.undo_tablespace=UNDOTBS1gavin2.undo_tablespace=UNDOTBS2*.remote_listener='LISTENERS_GAVIN'

Page 106: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

Make the following changes to the Init.ora parameter file:

EDIT the following entries

gavin.__db_cache_size=171966464gavin.__java_pool_size=8388608gavin.__large_pool_size=4194304gavin.__shared_pool_size=75497472

Change to ...

*.__db_cache_size=171966464*.__java_pool_size=8388608*.__large_pool_size=4194304*.__shared_pool_size=75497472

Page 107: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Change the archive log destination to the shared disk as all instances need access to the archive log files generated by each individual instance.

*.log_archive_dest_1='LOCATION=/ocfs/oradata/gavin/arch/‘

• Create the password file on each node

$ cd $ORACLE_HOME/dbs

$ orapwd file=orapwgavin1 password=oracle

Page 108: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Add the following lines to the tnsnames.ora file on BOTH NODES

LISTENERS_GAVIN =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = hqlinuxrac101.hq.emirates.com)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = hqlinuxrac102.hq.emirates.com)(PORT = 1521))

)

Page 109: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Create the spfile which will be used by both instances on the shared disk storage as well

SQL> create spfile='/ocfs/oradata/gavin/spfilegavin.ora' from 2 pfile='initgavin.ora';

• Create the init.ora for the instance gavin1 – only add one line with the SPFILE value pointing to the spfile we created on the OCFS file system

$ cat initgavin1.ora

SPFILE=/ocfs/oradata/gavin/spfilegavin.ora

Note: Do the same on the other node for the instance gavin2

Page 110: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Start the instance on both nodes – first on Hqlinux05 and then on Hqlinux06

SQL> select name from v$datafile;NAME--------------------------------------------------------------------------------/ocfs/oradata/gavin/system01.dbf/ocfs/oradata/gavin/undotbs01.dbf/ocfs/oradata/gavin/sysaux01.dbf/ocfs/oradata/gavin/users01.dbf/ocfs/oradata/gavin/example01.dbf/ocfs/oradata/gavin/undotbs02.dbf

SQL> select host_name from v$instance;HOST_NAME----------------------------------------------------------------hqlinux06.hq.emirates.com

Page 111: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Migrate a Single-instance database to RAC

• Using the SRVCTL commands to configure services

$ srvctl add database -d gavin -o /opt/oracle/product10g/10.1.0.3

$ srvctl add instance -d gavin -i gavin1 -n hqlinux05

$ srvctl add instance -d gavin -i gavin2 -n hqlinux06

$ srvctl status instance -d gavin -i gavin1

Instance gavin1 is running on node hqlinux05

$ srvctl status instance -d gavin -i gavin2

Instance gavin2 is running on node hqlinux06

Page 112: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Thanks for attending!!

Contact me:Email: [email protected]: + 971507843900AQ&Q U E S T I O N SQ U E S T I O N S

A N S W E R SA N S W E R S

GAVIN SOORMATechnical Team Manager,DatabasesEmirates Airline, DubaiContact me at : 971507843900

[email protected]

Page 113: A Practical Guide to Oracle 10g RAC Its REAL Easy! Gavin Soorma, Emirates Airline, Dubai Session# 106

Acknowledgements & Thanks

• 10g RAC – Madhu Tumma• High Availability with RAC, Flashback and Data

Guard – Matthew Hart & Scott Jesse• A Rough Guide to RAC – Julian Dyke• Oracle 10g Linux Administration – Edward Whalen