Oracle 10g RAC

download Oracle 10g RAC

of 113

Transcript of Oracle 10g RAC

  • 7/30/2019 Oracle 10g RAC

    1/113

    A Practical Guide to Oracle 10g RAC

    Its REAL Easy!

    Gavin Soorma,

    Emirates Airline, DubaiSession# 106

  • 7/30/2019 Oracle 10g RAC

    2/113

    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

  • 7/30/2019 Oracle 10g RAC

    3/113

    What Is a RAC Cluster? Nodes

    Interconnect

    Shared disk subsystem

    Instances

    Database

    NodeNode

    Interconnect

    Disks

  • 7/30/2019 Oracle 10g RAC

    4/113

    Database vs InstanceRAC Cluster consists of .

    One or more instances

    One Database residing on shared storage

    Node 1

    Instance 1

    Node 2

    Instance 2Interconnect

    SharedStorage

    LocalDisk

    LocalDisk

    Database

  • 7/30/2019 Oracle 10g RAC

    5/113

    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-costcomputers

    Enable Grid Computing

    DBAs have their own vested interests!

  • 7/30/2019 Oracle 10g RAC

    6/113

    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

  • 7/30/2019 Oracle 10g RAC

    7/113

    A RAC Database whats 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 tablespaceper 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

  • 7/30/2019 Oracle 10g RAC

    8/113

    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

  • 7/30/2019 Oracle 10g RAC

    9/113

    RAC init.ora Parameters*.db_cache_size=113246208*.java_pool_size=4194304

    *.db_name='racdbracdb2.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'

  • 7/30/2019 Oracle 10g RAC

    10/113

    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 RPMs ASM, OCFS

    Install Clusterware (Cluster Ready Services)

    Install 10g RAC software Create RAC database

    Configure Services and TAF ( Transparent Application Failover)

  • 7/30/2019 Oracle 10g RAC

    11/113

    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

  • 7/30/2019 Oracle 10g RAC

    12/113

    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 criticalcomponent is provided by enabling a second OCR file location

  • 7/30/2019 Oracle 10g RAC

    13/113

    Voting Disk File Contains information about cluster membership

    Used by CRS to avoid split-brain scenarios if any node losescontact over the interconnect

    Mandatory to be located on shared storage

    Typically about 20MB in size

    Can be mirrored in Oracle 10g Release 2

  • 7/30/2019 Oracle 10g RAC

    14/113

    Shared Storage ConsiderationsMandatory for:

    Datafiles, Redo Log Files, Control Files, SPFile

    Optional for:

    Archive logfiles, Executables, Binaries, Network Configurationfiles

    Supported shared storage

    NAS (network attached storage)

    SAN ( storage area network)Supported file storage

    Raw volumes

    Cluster File System

    ASM

  • 7/30/2019 Oracle 10g RAC

    15/113

    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 orCluster File System (OCFS)

  • 7/30/2019 Oracle 10g RAC

    16/113

    Network Requirements

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

    The public network adapter must support TCP/IP

    For the private network, the interconnect must preferably be aGigabit Ethernet switch that supports UDP. This is used forCache Fusion inter-node connection

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

  • 7/30/2019 Oracle 10g RAC

    17/113

    IP Address RequirementsFor 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 privateinterface

    Virtual IP addresses is used in the network config files

  • 7/30/2019 Oracle 10g RAC

    18/113

    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 addressas 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 timeoutbefore getting an error message or TCP reset from nodes thathave died

  • 7/30/2019 Oracle 10g RAC

    19/113

    Sample /etc/hosts fileracdb1:/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 itlinuxbl53

    10.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

  • 7/30/2019 Oracle 10g RAC

    20/113

    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 theauthorized_keys file

    Finally all nodes will have the same authorized_keys file

  • 7/30/2019 Oracle 10g RAC

    21/113

    Setting up User EquivalenceITLINUXBL53ssh-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

  • 7/30/2019 Oracle 10g RAC

    22/113

    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)

  • 7/30/2019 Oracle 10g RAC

    23/113

    Case Study Environment Operating System: LINUX X86_64 RHEL 3AS

    Hardware: HP BL25P Blade Servers with 2 CPUs (AMD 64 bitprocessors) and 4 GB of RAM

    Oracle Software: Oracle Database 10g Enterprise EditionRelease 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

  • 7/30/2019 Oracle 10g RAC

    24/113

    Oracle 10g CRS Install Oracle 10g Clusterware Cluster Ready Services

    Oracles own full-stack clusterware coupled with RAC

    Replaces earlier dependency on third-party clusterware Oracle CRS replaces the Oracle Cluster Manager (ORACM) in

    Oracle9iRAC

    CRS must be installed prior to the installation of Oracle RAC

  • 7/30/2019 Oracle 10g RAC

    25/113

    CRS Installation Key Steps Voting Disk about 20MB (Oracle9i Quorum Disk)

    Maintains the node heartbeat and avoids the node split-brainsyndrome

    Oracle Cluster Registry about 100MB

    Stores cluster configuration and cluster database information

    Private Interconnect Information

    Select the network interface for internode communicationA Gigabit Ethernet interface is recommended

    Run root.sh

    Start CRS daemon processes evmd, cssd, crsd

  • 7/30/2019 Oracle 10g RAC

    26/113

    Oracle Cluster File System Shared disk cluster file system for LINUX and Windows

    Improves management of data by eliminating the need to manageraw devices

    Can be downloaded from OTN

    http://oss.oracle.com/projects/ocfs

    OCFS 2.1.2 provides support on Linux for Oracle Softwareinstallation as well

    http://oss.oracle.com/projects/ocfshttp://oss.oracle.com/projects/ocfs
  • 7/30/2019 Oracle 10g RAC

    27/113

    Install the OCFS RPMs[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.rpm

    Preparing... ########################################### [100%]1:ocfs-2.4.21-EL-smp ########################################### [100%]

  • 7/30/2019 Oracle 10g RAC

    28/113

    OCFSTOOL Generate Config

  • 7/30/2019 Oracle 10g RAC

    29/113

    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

  • 7/30/2019 Oracle 10g RAC

    30/113

    OCFSTOOL Format Partition

  • 7/30/2019 Oracle 10g RAC

    31/113

    OCFSTOOL Mount File System

  • 7/30/2019 Oracle 10g RAC

    32/113

    OCFSTOOL Mount File System

  • 7/30/2019 Oracle 10g RAC

    33/113

    OCFSTOOL Mount File System

  • 7/30/2019 Oracle 10g RAC

    34/113

    ASM Architecture

    ClusteredPool of Storage

    ASM Instance ASM Instance

    ClusteredServers

    RACDatabase

    Oracle

    DB Instance

    Oracle

    DB Instance

    Disk Group

  • 7/30/2019 Oracle 10g RAC

    35/113

    Install the ASMLIB RPMs[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%]

  • 7/30/2019 Oracle 10g RAC

    36/113

    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 ]

  • 7/30/2019 Oracle 10g RAC

    37/113

    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,itlinuxbl54verbose

    ./runcluvfy.sh stage -pre crsinst -n itlinuxbl53,itlinuxbl54verbose

    ./runcluvfy.sh comp nodecon -n itlinuxbl53,itlinuxbl54verbose

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

  • 7/30/2019 Oracle 10g RAC

    38/113

    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%]

  • 7/30/2019 Oracle 10g RAC

    39/113

    10g Clusterware Installation

  • 7/30/2019 Oracle 10g RAC

    40/113

    Prerequisites Validation

  • 7/30/2019 Oracle 10g RAC

    41/113

    Configuring the 10g RAC Cluster

  • 7/30/2019 Oracle 10g RAC

    42/113

    Configuring the 10g RAC Cluster

  • 7/30/2019 Oracle 10g RAC

    43/113

    Configuring the Network Interfaces

  • 7/30/2019 Oracle 10g RAC

    44/113

    Oracle Cluster Registry (OCR)

  • 7/30/2019 Oracle 10g RAC

    45/113

    Mirroring the OCR

  • 7/30/2019 Oracle 10g RAC

    46/113

    Voting Disk

  • 7/30/2019 Oracle 10g RAC

    47/113

    10g Clusterware OUI Remote Installation

  • 7/30/2019 Oracle 10g RAC

    48/113

    10g Clusterware root.sh

  • 7/30/2019 Oracle 10g RAC

    49/113

    Configuration Assistants

  • 7/30/2019 Oracle 10g RAC

    50/113

    10g RAC phase one complete!

  • 7/30/2019 Oracle 10g RAC

    51/113

    Verifying the Oracle ClusterwareInstallationCheck node reachability

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

    itlinuxbl53 1

    itlinuxbl54 2

    Check for Clusterware processes

    psef |grep crs

    psef |grep css

    psef |grep evm

    Check the health of the CRS stack

    ./crsctl check crs

  • 7/30/2019 Oracle 10g RAC

    52/113

    10g RAC Software Installation

  • 7/30/2019 Oracle 10g RAC

    53/113

    10g RAC Installation

  • 7/30/2019 Oracle 10g RAC

    54/113

    10g RAC Software Installation

  • 7/30/2019 Oracle 10g RAC

    55/113

    10g RAC Software Installation

  • 7/30/2019 Oracle 10g RAC

    56/113

    10g RAC Software Installation

  • 7/30/2019 Oracle 10g RAC

    57/113

    10g RAC Software InstallationRemote Node Installation

  • 7/30/2019 Oracle 10g RAC

    58/113

    10g RAC Software Installation

  • 7/30/2019 Oracle 10g RAC

    59/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    60/113

    Configuring ASM

  • 7/30/2019 Oracle 10g RAC

    61/113

    Creating the ASM Instances

  • 7/30/2019 Oracle 10g RAC

    62/113

    Creating the ASM Instances

  • 7/30/2019 Oracle 10g RAC

    63/113

    Creating the ASM Instances

  • 7/30/2019 Oracle 10g RAC

    64/113

    Creating the ASM Instances

  • 7/30/2019 Oracle 10g RAC

    65/113

    Creating the ASM Disk Groups

  • 7/30/2019 Oracle 10g RAC

    66/113

    Creating the ASM Disk Groups

  • 7/30/2019 Oracle 10g RAC

    67/113

    Creating the ASM Disk Groups

  • 7/30/2019 Oracle 10g RAC

    68/113

    Creating the ASM Disk Groups

  • 7/30/2019 Oracle 10g RAC

    69/113

    Creating the ASM Disk Groups

  • 7/30/2019 Oracle 10g RAC

    70/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    71/113

    DBCA is also Cluster aware

  • 7/30/2019 Oracle 10g RAC

    72/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    73/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    74/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    75/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    76/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    77/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    78/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    79/113

    Creating the RAC Database using DBCA

  • 7/30/2019 Oracle 10g RAC

    80/113

    Enabling Flashback & Archive

    logging

    Archive log files preferably need to be located onshared storage in this case the ASM Disk Group

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

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

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

    SQL> shutdown immediate;

    Note: shutdown the other instances as well

  • 7/30/2019 Oracle 10g RAC

    81/113

    Enabling Flashback & Archive

    logging

    Connect to one of the instances in the RAC cluster and mountthe instance

    SQL> startup mount;

    SQL> alter database archivelog;

    SQL> alter database open;

    Startup other instances in the RAC cluster as well

    SQL> archive log list

    Database log mode Archive Mode

    Automatic archival Enabled

    Archive destination USE_DB_RECOVERY_FILE_DEST

    Oldest online log sequence 15

    Next log sequence to archive 16

    Current log sequence 16

  • 7/30/2019 Oracle 10g RAC

    82/113

    Services Logically group consumers who share common attributes like

    workload, a database schema or some common applicationfunctionality

    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

  • 7/30/2019 Oracle 10g RAC

    83/113

    Configuring Services

  • 7/30/2019 Oracle 10g RAC

    84/113

    Configuring Services

  • 7/30/2019 Oracle 10g RAC

    85/113

    Configuring Services

  • 7/30/2019 Oracle 10g RAC

    86/113

    Configuring Services

  • 7/30/2019 Oracle 10g RAC

    87/113

    Configuring Services

  • 7/30/2019 Oracle 10g RAC

    88/113

    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/db

    itlinuxbl54 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

  • 7/30/2019 Oracle 10g RAC

    89/113

    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

  • 7/30/2019 Oracle 10g RAC

    90/113

    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 onother nodes

  • 7/30/2019 Oracle 10g RAC

    91/113

    tnsnames.ora for RACClient-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))

  • 7/30/2019 Oracle 10g RAC

    92/113

    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

  • 7/30/2019 Oracle 10g RAC

    93/113

    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.

  • 7/30/2019 Oracle 10g RAC

    94/113

    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;}

  • 7/30/2019 Oracle 10g RAC

    95/113

    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.7

    archive 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';

  • 7/30/2019 Oracle 10g RAC

    96/113

    Migrate a Single-instance database to

    RAC

    Create the directory structure for the database files and archivelog files on the OCFS file system

    $ cd /ocfs/oradata/

    $ mkdir gavin

    $ cd /ocfs/oradata/gavin

    $ mkdir arch

  • 7/30/2019 Oracle 10g RAC

    97/113

    Migrate a Single-instance database toRAC Backup the current control file to trace

    SQL> alter database backup controlfile to trace;

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

  • 7/30/2019 Oracle 10g RAC

    98/113

    Migrate a Single-instance database toRACCREATE CONTROLFILE REUSE DATABASE "GAVIN" NORESETLOGS ARCHIVELOG

    MAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100

    MAXINSTANCES 8MAXLOGHISTORY 454LOGFILEGROUP 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;

  • 7/30/2019 Oracle 10g RAC

    99/113

    Migrate a Single-instance database toRAC 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.dbfcontrol02.ctl redo01.log sysaux01.dbf undotbs01.dbf

    $ cp *.* /ocfs/oradata/gavin

  • 7/30/2019 Oracle 10g RAC

    100/113

    Migrate a Single-instance database toRAC 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

  • 7/30/2019 Oracle 10g RAC

    101/113

    Migrate a Single-instance database toRACNote that the new location of the datafiles of the database is nowthe 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

  • 7/30/2019 Oracle 10g RAC

    102/113

    Migrate a Single-instance database toRAC Create the cluster specific data dictionary views by running

    the catclust.sql script

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

  • 7/30/2019 Oracle 10g RAC

    103/113

    Migrate a Single-instance database toRAC 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 22 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.

  • 7/30/2019 Oracle 10g RAC

    104/113

    Migrate a Single-instance database toRAC 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

  • 7/30/2019 Oracle 10g RAC

    105/113

    Migrate a Single-instance database toRAC 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'

  • 7/30/2019 Oracle 10g RAC

    106/113

    Migrate a Single-instance database toRACMake the following changes to the Init.ora parameter file:

    EDIT the following entries

    gavin.__db_cache_size=171966464

    gavin.__java_pool_size=8388608

    gavin.__large_pool_size=4194304

    gavin.__shared_pool_size=75497472

    Change to ...

    *.__db_cache_size=171966464

    *.__java_pool_size=8388608

    *.__large_pool_size=4194304

    *.__shared_pool_size=75497472

  • 7/30/2019 Oracle 10g RAC

    107/113

    Migrate a Single-instance database toRAC 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

  • 7/30/2019 Oracle 10g RAC

    108/113

    Migrate a Single-instance database to

    RAC

    Add the following lines to the tnsnames.ora file onBOTH 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))

    )

  • 7/30/2019 Oracle 10g RAC

    109/113

    Migrate a Single-instance database toRAC 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' from2 pfile='initgavin.ora';

    Create the init.ora for the instance gavin1 only add

    one line with the SPFILE value pointing to the spfilewe created on the OCFS file system

    $ cat initgavin1.oraSPFILE=/ocfs/oradata/gavin/spfilegavin.ora

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

  • 7/30/2019 Oracle 10g RAC

    110/113

    Migrate a Single-instance database toRAC 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

  • 7/30/2019 Oracle 10g RAC

    111/113

    Migrate a Single-instance database toRAC 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 gavin2Instance gavin2 is running on node hqlinux06

  • 7/30/2019 Oracle 10g RAC

    112/113

    Thanks for attending!!

    Contact me:Email: [email protected]: + 971507843900

    Q U E S T I O N SA N S W E R S

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

    [email protected]

    mailto:[email protected]:[email protected]
  • 7/30/2019 Oracle 10g RAC

    113/113

    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