Saturday, October 6, 2012

Hardware / Software Requirement for RAC



Hardware Req. for RAC Setup: Requirement for RHEL 5.3
1.       Minimum P-IV processor
2.       Minimum 1.5 GB RAM for cluster on each node
3.       2 NIC Cards (1st – private network, 2nd – Public network)
4.       Shared Storage (SAN/NAS/ISCSI)
5.       Secondary Storage (Internal HDD)

Mount Point
Min Requirement
Recommended
/
1 GB
2-3 GB
/var
300 MB
1 GB
/tmp
1 GB
2-3 GB
/boot
100 MB
512 MB
/usr
3 GB
5-6 GB
/swap
Double the RAM
Double the RAM
/grid (To store Grid infrastructure)
2-4 GB
5-6 GB
/oraeng (To store RDBMS s/w)
4 GB
6-8 GB
/opt
-
-
/disk1 (optional)
-
-
/disk2(optional)
-
-
/disk3(optional)
-
-

Software Requirements:
1.       Same version & bit architecture (32-bit/64-bit) of o/s on all the nodes
a.        64-bit à 32 bit/64 bit
b.       32-bit à32 bit
2.       Same version of Clusterware s/w on all the nodes
3.       Same or lower version of RDBMS software on all the nodes


Types of Storage:


Types of Storage:

NAS: Network Attached Storage: It supports file level I/O


SAN – Storage Area Network


NAS
SAN
S à Ö
S à Ö
P à ´
P à Ö
Aà Ö
Aà Ö
Mà Ö
Mà Ö





ISCSI – Internal Small Computer System Interface


I/O performance: NAS < ISCSI < SAN

Types of Clusters



Types of Clusters:

1.       Operating system level
2.       Hardware level
3.       Network level
4.       Application level
a.        Failover cluster
b.       Parallel cluster
c.        Hybrid cluster

Failover Cluster:


Ex: VCS (VERITAS Cluster System)

Disadvantages of failover cluster:
1.       More downtime for the users
2.       No load balancing
3.       Wastage of resources
4.       Max it support 2 node cluster setup


Parallel cluster or scalable high performance cluster:

In 9i, it supports 67 nodes per cluster
In 10g, it supports 100 nodes per cluster
In 11g, it supports 100+ nodes per cluster

Advantages:
1.       Zero or negligible downtime for the users
2.       Better load balancing
3.       No wastage of resources
4.       It supports multiple nodes per cluster
5.       Best example oracle RAC




Hybrid Cluster:

It is a combination for both parallel & failover cluster
Ex: Data guard in RAC environment


Types of Cluster Software:

Types

Vendor
1.       Hp Service Guard
2.       Sun Cluster
Kernel level
HP
Oracle SUN
3.       VERITAS cluster (failover + parallel)
4.       Oracle RAC (Truly Parallel)
User / Application level
Symantec
Oracle


Real Application Cluster - RAC




Global cache is maintained by
1.       In 8i, OPS (Oracle parallel Server)
2.       From 9i, it is maintained by GRD (Global Resource directory)
Global Resource directory (GRD) = Global cache service (GCS) + Global Enqueue Services (GES)
                                                GRD = GCS + GES

RAC is not software; it is a concept in which multiple instances (each on separate node) and can access a common (single) database

Advantages of RAC:
1.       It offers SPAM
a.        S à Scalability
b.       Pà Performance
c.        Aà Availability
d.       Mà Manageability
2.       It Supports HA (high availability) operations to the services like VIPs, Scan IPs etc
3.       Automatic error Detection
4.       Automatic restart of failed services
5.       It supports TAF – Transparent Application Failover

Cluster Component:

1.       Clusterware Software
2.       Private Interconnect
3.       Shared Storage


Clusterware software:

It coordinates and manages all the cluster nodes of a cluster by treating all the nodes as a single large logical server

Version
Name of Cluster S/W
9i
Oracle cluster manager (Supports only Linux/windows)
10.1
Oracle CRS (cluster ready Service)
a.        Supports all the o/s
b.       Mandatory for building 10g RAC Setup
10.2
Oracle CRS is renamed to ORACLE CLUSTERWARE
a.        Supports HA operations
b.       High performance
11.2
a.        Grid Infrastructure
b.       Combination of Clusterware binaries and ASM binaries


Oracle Homes
10.1
ASM_HOME (ASM)
CRS_HOME (Clusterware)
ORACLE_HOME (RDBMS)
10.2
CRS_HOME
ORACLE_HOME (Clusterware + ASM)
11.2
GRID_HOME (Clusterware + ASM)
ORACLE_HOME (RDBMS)


High Availability


Availability:

1.       Low Availability:                   Some downtime + Data loss               (Incomplete Recovery)
2.       Medium Availability:            Some downtime + No Data loss        (Complete Recovery)
3.       High Availability:                   No Downtime + No Data loss             (Complete Recovery)

Low Availability: 
ICR - Loss of redo log files or current control file.

Medium Availability: 
It is a complete recovery example Data guard
Max. Performance: This is the default mode
Max Availability:   Guarantee data availability by compromising database availability
Max Protection:   Guarantee database availability by compromising data availability





High Availability: Its means No downtime & no data loss
                                 Example RAC (it gives the solution for instance crash)
Data guard: Data Availability
RAC: Instance Availability
MAA à Maximum Availability Architecture = Data guard + RAC 

Saturday, February 11, 2012

Cross platform migration using RMAN Transportable tablespace (on linux AS4)




OTA to CSR Database

Connect to ota database
[oracle@virt1 ~]$ su - ota
Password:

[ota@virt1 ~]$ sqlplus " / as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 7 12:48:15 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.
Total System Global Area  457179136 bytes
Fixed Size                  1219976 bytes
Variable Size             109052536 bytes
Database Buffers          343932928 bytes
Redo Buffers                2973696 bytes
Database mounted.

SQL> alter database open read only;
Database altered.

SQL> select platform_id,platform_name from v$database;

PLATFORM_ID PLATFORM_NAME
----------- --------------------------------------------------
         10 Linux IA (32-bit)


SQL> select PLATFORM_NAME, ENDIAN_FORMAT from V$TRANSPORTABLE_PLATFORM;
PLATFORM_NAME                                      ENDIAN_FORMAT
-------------------------------------------------- --------------
Solaris[tm] OE (32-bit)                            Big
Solaris[tm] OE (64-bit)                            Big
Microsoft Windows IA (32-bit)                      Little
Linux IA (32-bit)                                  Little
AIX-Based Systems (64-bit)                         Big
HP-UX (64-bit)                                     Big
HP Tru64 UNIX                                      Little
HP-UX IA (64-bit)                                  Big
Linux IA (64-bit)                                  Little
HP Open VMS                                        Little
Microsoft Windows IA (64-bit)                      Little
IBM zSeries Based Linux                            Big
Linux 64-bit for AMD                               Little
Apple Mac OS                                       Big
Microsoft Windows 64-bit for AMD                   Little
Solaris Operating System (x86)                     Little
IBM Power Based Linux                              Big
17 rows selected.

Check the ENDIAN_FORMAT on target server for migration compatibility, if compatible then


SQL> set serveroutput on
SQL> declare
  2  db_ready boolean;
  3  begin
  4  db_ready := dbms_tdb.check_db('Linux IA (32-bit)');
  5  end;
  6  /
PL/SQL procedure successfully completed.

SQL> set serveroutput on
SQL> declare
  2  external boolean;
  3  begin
  4  external := dbms_tdb.check_external;
  5  end;
  6  /
The following directories exist in the database:
SYS.ADMIN_DIR, SYS.WORK_DIR, SYS.DATA_PUMP_DIR, SYS.DP_DIR

PL/SQL procedure successfully completed.

Issue the Convert Database Script

[ota@virt1 ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 7 13:33:03 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: OTA (DBID=1634082786)

RMAN> convert database on target platform
2> convert script '/u01/csr/migration/convertscript.rman'
3> transport script '/u01/csr/migration/transportscript.sql'
4> new database 'csr'
5> format '/u01/csr/migration/%U';

Starting convert at 07-FEB-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=153 devtype=DISK

Directory SYS.ADMIN_DIR found in the database
Directory SYS.WORK_DIR found in the database
Directory SYS.DATA_PUMP_DIR found in the database
Directory SYS.DP_DIR found in the database

User SYS with SYSDBA and SYSOPER privilege found in password file
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00004 name=/u01/ota/oradata/users01.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00005 name=/u01/ota/oradata/index01.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00001 name=/u01/ota/oradata/system01.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00002 name=/u01/ota/oradata/undotbs01.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00003 name=/u01/ota/oradata/sysaux01.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
Run SQL script /u01/csr/migration/transportscript.sql on the target platform to create database
Edit init.ora file /u01/csr/migration/init_00n2nlqf_1_0.ora. This PFILE will be used to create the database on the target platform
Run RMAN script /u01/csr/migration/convertscript.rman on target platform to convert datafiles
To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on the target platform
To change the internal database identifier, use DBNEWID Utility
Finished backup at 07-FEB-12

Now copy all datafiles, convertscript.rman, transportscript.sql & parameter file gererated by convert script to the target machine.

Move to pfile copied from source machine to $ORACLE_HOME/dbs location and edit the environment specific parameters

[oracle@virt1 migration]$ mv init_00n2nlqf_1_0.ora $ORACLE_HOME/dbs/initcsr.ora
[oracle@virt1 migration]$ cd $ORACLE_HOME/dbs


[oracle@virt1 dbs]$ vi initcsr.ora
# Please change the values of the following parameters:
  control_files            = "/u01/csr/migration/cf_D-CSR_id-1634082786_00n2nlqf"
  background_dump_dest     = "/u00/app/oracle/admin/csr/bdump"
  user_dump_dest           = "/u00/app/oracle/admin/csr/udump"
  core_dump_dest           = "/u00/app/oracle/admin/csr/cdump"
  audit_file_dest          = "/u00/app/oracle/admin/csr/adump"
  db_name                  = "CSR"

# Please review the values of the following parameters:
  __shared_pool_size       = 92274688
  __large_pool_size        = 4194304
  __java_pool_size         = 4194304
  __streams_pool_size      = 8388608
  __db_cache_size          = 343932928
  remote_login_passwordfile= "EXCLUSIVE"
  db_domain                = "omeir.global"
  dispatchers              = "(PROTOCOL=TCP) (SERVICE=csrXDB)"

# The values of the following parameters are from source database:
  processes                = 150
  sga_target               = 457179136
  db_block_size            = 8192
  compatible               = "10.2.0.1.0"
# log_archive_dest_1       = "LOCATION=/u01/ota/oradata/arch"
  log_archive_format       = "csr_%t_%s_%r.arc"
  db_file_multiblock_read_count= 16
  undo_management          = "AUTO"
  undo_tablespace          = "UNDOTBS1"
  job_queue_processes      = 10
  open_cursors             = 300
  pga_aggregate_target     = 152043520


Start the database in nomount state to create the dummy controlfile;

[oracle@virt1 oradata]$ sqlplus " /as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 7 14:25:24 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  457179136 bytes
Fixed Size                  1219976 bytes
Variable Size             109052536 bytes
Database Buffers          343932928 bytes
Redo Buffers                2973696 bytes

SQL> CREATE CONTROLFILE REUSE SET DATABASE "CSR" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 2336
LOGFILE
  GROUP 1 '/u01/csr/oradata/redo01.log' SIZE 10M,
  GROUP 2 '/u01/csr/oradata/redo02.log' SIZE 10M,
  GROUP 3 '/u01/csr/oradata/redo03.log' SIZE 10M
DATAFILE
  '/u01/csr/oradata/system01.dbf',
  '/u01/csr/oradata/undotbs01.dbf',
  '/u01/csr/oradata/sysaux01.dbf',
  '/u01/csr/oradata/users01.dbf',
  '/u01/csr/oradata/index01.dbf'
CHARACTER SET WE8ISO8859P1
;

Control file created.


Now edit the file Convertscript.rman and make necessary changes with respect to the target machine & execute this script.

[oracle@virt1 migration]$ rman target / nocatalog @convertscript.rman
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 7 14:31:32 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: CSR (DBID=1634082786, not open)
using target database control file instead of recovery catalog

RMAN> RUN {
2>
3>   CONVERT DATAFILE '/u01/ota/oradata/users01.dbf'
4>   FROM PLATFORM 'Linux IA (32-bit)'
5>   FORMAT '/u01/csr/migration/data_D-OTA_I-1634082786_TS-USERS_FNO-4_06n2nlqg';
6>
7>
8>   CONVERT DATAFILE '/u01/ota/oradata/index01.dbf'
9>   FROM PLATFORM 'Linux IA (32-bit)'
10>   FORMAT '/u01/csr/migration/data_D-OTA_I-1634082786_TS-INDX_FNO-5_07n2nlqg';
11>
12>
13>   CONVERT DATAFILE '/u01/ota/oradata/system01.dbf'
14>   FROM PLATFORM 'Linux IA (32-bit)'
15>   FORMAT '/u01/csr/migration/data_D-OTA_I-1634082786_TS-SYSTEM_FNO-1_08n2nlqg';
16>
17>
18>   CONVERT DATAFILE '/u01/ota/oradata/undotbs01.dbf'
19>   FROM PLATFORM 'Linux IA (32-bit)'
20>   FORMAT '/u01/csr/migration/data_D-OTA_I-1634082786_TS-UNDOTBS1_FNO-2_09n2nlqh';
21>
22>
23>   CONVERT DATAFILE '/u01/ota/oradata/sysaux01.dbf'
24>   FROM PLATFORM 'Linux IA (32-bit)'
25>   FORMAT '/u01/csr/migration/data_D-OTA_I-1634082786_TS-SYSAUX_FNO-3_0an2nlqh';
26>
27>
28> }
Starting backup at 07-FEB-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/ota/oradata/users01.dbf
converted datafile=/u01/csr/migration/data_D-OTA_I-1634082786_TS-USERS_FNO-4_06n2nlqg
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:05:47
Finished backup at 07-FEB-12

Starting backup at 07-FEB-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/ota/oradata/index01.dbf
converted datafile=/u01/csr/migration/data_D-OTA_I-1634082786_TS-INDX_FNO-5_07n2nlqg
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:03:35
Finished backup at 07-FEB-12

Starting backup at 07-FEB-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/ota/oradata/system01.dbf
converted datafile=/u01/csr/migration/data_D-OTA_I-1634082786_TS-SYSTEM_FNO-1_08n2nlqg
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:55
Finished backup at 07-FEB-12

Starting backup at 07-FEB-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/ota/oradata/undotbs01.dbf
converted datafile=/u01/csr/migration/data_D-OTA_I-1634082786_TS-UNDOTBS1_FNO-2_09n2nlqh
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:48
Finished backup at 07-FEB-12

Starting backup at 07-FEB-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=/u01/ota/oradata/sysaux01.dbf
converted datafile=/u01/csr/migration/data_D-OTA_I-1634082786_TS-SYSAUX_FNO-3_0an2nlqh
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:46
Finished backup at 07-FEB-12

Recovery Manager complete.


Now shutdown the csr database, delete the dummy control file, edit the transport sql and specify datafiles, log files in create controlfile section.
And execute the transportscript.sql file

oracle@virt1 oradata]$ sqlplus " /as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 7 14:25:24 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance

SQL> @transportscript.sql

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE SET DATABASE "CSR" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 2336
LOGFILE
  GROUP 1 '/u01/csr/oradata/redo01.log' SIZE 10M,
  GROUP 2 '/u01/csr/oradata/redo02.log' SIZE 10M,
  GROUP 3 '/u01/csr/oradata/redo03.log' SIZE 10M
DATAFILE
  '/u01/csr/oradata/system01.dbf',
  '/u01/csr/oradata/undotbs01.dbf',
  '/u01/csr/oradata/sysaux01.dbf',
  '/u01/csr/oradata/users01.dbf',
  '/u01/csr/oradata/index01.dbf'
CHARACTER SET WE8ISO8859P1
;

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/csr/oradata/temp01.dbf'
     SIZE 1048576000  AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;


set echo off
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prompt * Your database has been created successfully!
prompt * There are many things to think about for the new database. Here
prompt * is a checklist to help you stay on track:
prompt * 1. You may want to redefine the location of the directory objects.
prompt * 2. You may want to change the internal database identifier (DBID)
prompt *    or the global database name for this database. Use the
prompt *    NEWDBID Utility (nid).
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SHUTDOWN IMMEDIATE
STARTUP UPGRADE
@@ ?/rdbms/admin/utlirp.sql
SHUTDOWN IMMEDIATE
STARTUP
-- The following step will recompile all PL/SQL modules.
-- It may take serveral hours to complete.
@@ ?/rdbms/admin/utlrp.sql
set feedback 6;

Now configure the listener & password file.
And use emca to create OEM repositiory  & emctl to configure dbcontrol.