g release 2 enterprise edition using snapshot standby ... · abstract the purpose of this paper is...

57
. . . . . . . . Oracle Database 11 g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 Francisco Martín Riccio Chávez In collaboration with the IBM Oracle International Competency Center September 2010 © Copyright IBM Corporation, 2010. All Rights Reserved. All trademarks or registered trademarks mentioned herein are the property of their respective holders

Upload: vanduong

Post on 29-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

. . . . . . . .

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power

Systems running AIX and IBM System Storage DS4800

Francisco Martín Riccio Chávez In collaboration with the

IBM Oracle International Competency Center September 2010

© Copyright IBM Corporation, 2010. All Rights Reserved. All trademarks or registered trademarks mentioned herein are the property of their respective holders

Table of Contents Table of Contents........................................................................................................................ii Abstract........................................................................................................................................1 Prerequisites ...............................................................................................................................1 Introduction .................................................................................................................................1

About real-time apply ...............................................................................................................................1 About using RMAN to create a duplicate database from an active database ......................................... 2 About snapshot standby database .......................................................................................................... 2 About IBM Power Systems ...................................................................................................................... 2 About IBM System Storage DS4800 ....................................................................................................... 3

Hardware requirements ..............................................................................................................4 Data Guard requirements ........................................................................................................................ 4

Software requirements ...............................................................................................................5 Operating system..................................................................................................................................... 5 IBM DS Storage System Manager Software ........................................................................................... 5 Oracle Database 11g Release 2.............................................................................................................. 5

Test environment ........................................................................................................................5 Installing Oracle Database 11.2.0.1 ...........................................................................................6

Pre-installation tasks................................................................................................................................ 6 Validating our server is a POWER4 processor-based sever ............................................ 6 Validating size of physical memory (RAM) and swap space. ........................................... 6 Validating system architecture. ......................................................................................... 7 Validating disk space requirements................................................................................... 7 Validating operating system, file sets and patches ........................................................... 7 Creating users and groups ................................................................................................ 8 Setting shell limits for the Oracle software owner ............................................................. 8 Setting system configuration parameters.......................................................................... 9 Verifying asynchronous input output processes.............................................................. 10 Setting Oracle inventory location..................................................................................... 11 Setting up network files ................................................................................................... 11

Installing Oracle Database 11g Release 2 (11.2.0.1)............................................................................ 11 Post-installation tasks ............................................................................................................................ 19

Creating database “IBM”..........................................................................................................20 Configuring Oracle Data Guard ...............................................................................................30

Active duplicate from active database ................................................................................................... 30 Both servers must be able to ping each other,................................................................ 30 Creating entries in the tnsnames.ora .............................................................................. 30 Manually register the database service in the listener .................................................... 32 Creating password file..................................................................................................... 34 Creating a contingency instance ..................................................................................... 35

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation

Start to duplicate the sides .............................................................................................. 35 Configure Data Guard............................................................................................................................ 38

Configuration of both instances....................................................................................... 38 Creating standby redo log groups ................................................................................... 39 Starting Real Time Apply................................................................................................. 41 Doing a switchover between nodes................................................................................. 43

Using snapshot standby database..........................................................................................46 Configuring the snapshot standby database ......................................................................................... 46

Convert the active standby database to the snapshot standby database....................... 46 Open the snapshot standby database as read write....................................................... 46

Working snapshot standby database..................................................................................................... 47 We can do the test in our contingency database ............................................................ 47

Converting the snapshot standby back to a physical standby database............................................... 47 Converting the snapshot standby database.................................................................... 47

Summary....................................................................................................................................49 References.................................................................................................................................50

Oracle documentation............................................................................................................................ 50 IBM documentation................................................................................................................................ 50 IBM and Oracle Web sites ..................................................................................................................... 50

About the author .......................................................................................................................52 Trademarks and special notices..............................................................................................53

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation

Abstract The purpose of this paper is to assist those who will be implementing a snapshot standby Oracle Database environment on an IBM Power Systems™ server running AIX® 5.3 with IBM System Storage™ products. The information provided here is based on test experiences from testing done at the IBM Oracle International Competency Center, and is based on available documentation from IBM and Oracle.

Prerequisites Good knowledge of Oracle Database (installation, configuration, backup & recovery) Knowledge of IBM AIX operating system

Introduction This paper will discuss the necessary steps to prepare a successful installation of Oracle Database 11g Release 2 Enterprise Edition on AIX 5.3, build the contingency environment (physical standby database) and convert it into a snapshot standby database environment.

For this project we have used “real-time apply”, this feature is new in Oracle Database 10g, the RMAN feature “duplicate from active database” and the “snapshot standby database” feature are also used and are both new features in Oracle Database 11g..

The objective of this document is to document how to:

• set up the primary and physical standby connected with Dark Fiber communication interface,

• make sure the both of the databases are in sync,

• switch the role of the servers: primary to physical standby and vice versa.

About real-time apply The “real-time apply” feature allows us to get our production environment synchronized with the contingency environment through committed transactions. We don’t have to wait for archive’s redo log to be received if our production environment has problems due to memory, main board, storage, or CPU failures, etc.

Following are the benefits of Real Time Apply1:

• Quicker Switchover and Failover Operations.

• Instantly up-to-date Results after you open a Physical Standby Database READ ONLY

• Up to Date Reporting on a Logical Standby Database and Phyiscal Standby Database using Active Data Guard (New Feature in Oracle 11g).

1 Metalink ID Document: 828274.1

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 1

• The Ability to leverage larger Logfiles. Having larger Logfiles with Real Time Apply is desirable because the Apply service will stay in a Logfile longer and the overhead of the Switch will have less Impact on the Realtime Apply Processing.

About using RMAN to create a duplicate database from an active database An active database can be duplicated without using a previous backup. This method is suitable for creating a duplicate database or physical standby database. This feature is new in Oracle Database 11g.

About snapshot standby database A snapshot standby database allows us to use our contingency standby database (where this database has the same data as the primary database) as a test database. We can open the contingency standby database and we can execute operations (DML, DDL, etc) and in parallel our standby database continues receiving the redo entries from the primary database. When our test is finished, Data Guard cancels all of our test operations (DML, DDL, etc), converts the database back into a standby database and starts to apply the redo entries from the primary database to the standby database.

About IBM Power Systems This project was run on an IBM POWER4® processor-based system. Current IBM Power Systems servers are based on the POWER7® processor.

New POWER7 processor-based systems represent a true leap forward to more intelligent systems that minimize complexity, automate processes, and reduce energy consumption, downtime and other operational costs. On a smarter planet, these are the only benchmarks that matter. Featuring an innovative multi-core, 45 nanometer design, running at speeds of over 4.1 GHz, with up to 8-cores per socket, and four threads per core, POWER7 systems combined with IBM systems software, middleware and storage, deliver unprecedented performance for both transactional and throughput computing.

A totally integrated approach to the design, development, and testing of each and every Power server ensures the resiliency required for today’s IT infrastructure. All POWER7 and POWER6® server models include innovative reliability, availability and serviceability features that help you avoid unplanned downtime. And, with Capacity on Demand, Hot-Node Add and Hot-Memory Add—Power Systems enterprise servers ensure you can keep your most important applications available, even as you add capacity to handle new business demands. Power Systems are also optimized with the ability to securely run multiple applications on AIX, IBM i and Linux® operating systems on a single server—so you can manage fewer systems with lower cost and higher utilization. No longer do you need to manage complex and energy inefficient server farms with each server dedicated to a single application or operating environment. Now you can consolidate workloads and significantly reduce costs throughout your infrastructure, while dramatically improving your ability to meet changing processing demands.

Power Systems software™ options enable you to manage both physical and virtual environments, including the capability to control data center energy usage and orchestrate processing resources to

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 2

better meet business goals. And, Power solutions are designed to provide you with a roadmap to continuous availability of mission-critical applications—even when an expected or unexpected interruption occurs.

Figure 1: IBM Power Systems

About IBM System Storage DS4800 The IBM System Storage DS3000 and DS4000® families are designed to provide fast, reliable and efficient networked storage.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 3

The DS4800 is affordable for small and medium businesses and scalable by supporting up to 224 Fibre Channel (FC) or SATA drives. It supports multiple RAID levels (0, 1, 3, 5, 10) and its components can be replaced without stopping the DS4800. It can also provide up to 1724 MBps of sustained applications through the eight channels.

Figure 2: IBM System Storage DS4800

As shown in 2, IBM System Storage DS4800 has 2 U rack-mount enclosures with 12 easily accessible drive bays. It supports dual-ported and hot-swappable SAS disk at 10,000 and 15,000 rpm speeds. It is also scalable to 3.6 TB of storage capacity with 300 GB hot-swappable SAS disks.

Hardware requirements

Data Guard requirements An Oracle Data Guard configuration consists of the following components:

1. Two servers (primary, contingency), running Oracle Database server(s). 2. Communication between both sides (If distance between both sides is 10 Km the communication

should be by dark fiber).

Figure 3: Oracle Data Guard architecture

This project was run with two POWER4 processor-based Power Systems servers with AIX 5.3 and connected by dark fiber.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 4

Software requirements In an Oracle Data Guard implementation, different kinds of software need to be downloaded and installed on both sides.

Operating system IBM AIX 5.3 is the operating system used in tests described in this paper.

IBM DS Storage System Manager Software IBM DS Storage System Manager is used to manage the DS3200, DS3300 and DS3400 via the graphical user interface. The DS3000 Storage Manager software is required for managing the DS3200 and DS3400 models with controller firmware version 06.17.xx.xx and the DS3300 model with controller firmware version 06.50.xx.xx.

The DS4000 Storage Manager can be downloaded from the IBM Systems support Web site:

http://www-947.ibm.com/systems/support/supportsite.wss/docdisplay?lndocid=MIGR-5082143&brandind=5000028

The IBM DS Storage System Manager Software packages are available for AIX®, Microsoft® Windows® (32-bit and 64-bit version), Linux, and other platforms.

Note for IBM System Storage DS4000 users: The DS3000 Storage Manager manages only DS3000 systems. With the DS4000 Storage Manager (version 9.23 or above) you will be able to manage both DS3000 and DS4000 storage systems with an Enterprise Management Window.

Oracle Database 11g Release 2 Oracle Database 11g Release 2 (11.2.0.1) is the current release of Oracle’s database product and is available on 64-bit AIX platforms as of December, 2009.

For the latest information on Oracle product certification, please visit the My Oracle Support web site:

https://support.oracle.com/CSP/ui/flash.html

This software can be downloaded from the Oracle Technology Network (OTN) or the DVDs can be requested from Oracle Support.

For additional information on pricing, please refer to:

http://www.oracle.com/corporate/pricing/technology-price-list.pdf

Test environment Our servers had the following configuration:

Primary Side: Hostname is banco1 with IP: 10.18.1.5.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 5

Contingency Side: Hostname is banco2 with IP: 10.18.1.6.

Both servers have installed IBM AIX 5.3 and they are connected by dark fiber. Our sample database has the name IBM.

Installing Oracle Database 11.2.0.1 Before installing Oracle Database 11.2.0.1 on both servers, there are several important tasks that need to be done on both servers.

Pre-installation tasks

Validating our server is a POWER4 processor-based sever

We can validate the type of processor with the command: lsconfig

Validating size of physical memory (RAM) and swap space.

We must have at least 1 GB of memory (RAM). It can be validated with the command: lsattr -E -l sys0 -a realmem

Swap space should have the following relationship to available memory:

Available RAM Swap space required

Between 1 GB and 2 GB 1.5 times the size of RAM

Between 2 GB and 16 GB Equal to the size of RAM

More than 16 GB 16 GB

It can be validated with the command: lsps –a

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 6

Validating system architecture.

AIX 5.3 must be run in 64-bit mode. This can be validated with the command: getconf HARDWARE_BITMAP

To determine if the system is started in 64-bit mode, enter the following command: bootinfo –K

Both commands must return the value 64.

Validating disk space requirements

We must have 1 GB in the filesystem /tmp and 6.4 GB for the filesystem assigned, in order to install Oracle Enterprise Edition software.

Validating operating system, file sets and patches

We must have AIX 5.3 TL09 SP1 as the minimum level, we can validate this with the following command: oslevel -s. If we have IBM AIX 5.3, we must have the following file sets:

bos.adt.base bos.adt.lib bos.adt.libm bos.perf.libperfstat 5.3.9.0 bos.perf.perfstat bos.perf.proctools rsct.basic.rte rsct.compat.clients.rte x1C.aix50.rte:10.1.0.0

We can validate it if we have the file sets with the following command:

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 7

lslpp -l bos.adt.base bos.adt.lib bos.adt.libm bos.perf.perfstat bos.perf.libperfstat bos.perf.proctools

If we have IBM AIX 5.3, we must have the following patches:

APAR IZ42940 APAR IZ49516 APAR IZ52331

We can validate it if we have the patches with the following command:

instfix -i -k "IZ42940 IZ49516 IZ52331 IZ41855 IZ52319"

Also we need to have the C++ complier: IBM XL C/C++ or GCC 3.4.5

Creating users and groups

Two groups need to be created: dba and oinstall. The dba group is used for Oracle Database authentication and oinstall for Oracle Inventory group. This can be accomplished by the groupadd command, example: groupadd oinstall.

We must have one user as software owner; in our exercise we have created the user oraprd. We use the command smitty user. Smitty is a utility of IBM AIX.

We can create our user and reset its password.

Setting shell limits for the Oracle software owner

The user owner of Oracle software must have the following Shell Limits:

Shell limit Recommended value

Soft File size -1 (Unlimited)

Soft CPU time -1 (Unlimited)

Soft DATA segment -1 (Unlimited)

Soft STACK size -1 (Unlimited)

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 8

Soft Real Memory size -1 (Unlimited)

Process (per user) -1 (Unlimited)

We can see this configuration with the following command: smit user

Setting system configuration parameters

We must verify that the kernel parameters have the following values:

Parameter Recommended value

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 9

maxuprocs (Maximum number of process allowed per user) 2048

ncargs 128

The maximum number of processes should be equal to SUM (PROCESS PARAMETER + PARALLEL_MAX_SERVERS) + 128 (If we know the number of required processes in advance).

We can set up it with the command: smity chgsys

Verifying asynchronous input output processes

We must have enabled the AIO (Asynchronous Input Output) in AIX. We can verify it with the following command: lsattr -El aio0 -a maxreqs

The result should be at least 65536

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 10

Setting Oracle inventory location

When you install Oracle software on the system for the very first time, Oracle will create a file named oraInst.loc under /etc directory. This file will give Oracle information about where the Oracle inventory directory is located and will give the name of the Oracle inventory owner group.

inventory_loc=/u01/app/oraInventory inst_group=oinstall

If a previous inventory directory exists, please make sure that the same Oracle inventory directory is used and all Oracle software users have the write permission to this directory.

Setting up network files

The IP addresses need to be set up.

Then, add the host names and IP addresses to /etc/hosts as shown in the example below.

127.0.0.1 localhost.localdomain localhost 10.18.1.5 banco1.ibm.com banco1

Installing Oracle Database 11g Release 2 (11.2.0.1) 1. Download and unzip aix.ppc64_11gR2_database_1of2.zip and

aix.ppc64_11gR2_database_1of2.zip from technet.oracle.com. 2. Open a session VNC with the following command as user oraprd: vncserver

3. We must run the script rootpre.sh (This .sh file is found in the install directory) with the user root.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 11

4. With our user oraprd, we must run the script runInstaller.sh (found in the install directory) from a session VNC.

5. The first installation screen asks for your email address. You have to provide your email address in order to proceed. If you want to receive security updates from My Oracle Support, you will need to provide the password of your email address (username) for the My Oracle Support web site.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 12

6. The next screen provides us with different installation options. In this example, we will install

only software.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 13

7. The next screen asks us for the different languages supported by the software.

8. The next screen asks us for the software edition (Enterprise Edition, Standard Edition or Standard Edition One).

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 14

9. By clicking the button Select Options, we can disable some extra Enterprise Edition options like Partitioning, OLAP, Application Testing, etc.

10. The next screen asks us where the software will be installed. In our case, in the filesystem u01. Also we are asked where the oraInventory will be installed. (Remember that oraInventory is located where Oracle register has all Oracle software installed on the server).

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 15

11. The next screen asks us about which operative group system has the file oraInventory (in our case oinstall) and which group of users who will have the privilege of SYSDBA.

12. This screen shows the installation process for the Oracle Database installation.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 16

13. This screen shows the installation summary.

14. The following screen shows the installation progress.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 17

15. Once the installation is finished, we will receive a screen to run the script root.sh with the user root.

16. After that, we will receive the screen of success.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 18

Post-installation tasks 1. Oracle recommends root.sh script to be backed up after finishing the database installation. If the

information is needed in the future, the original root.sh script can be easily recovered. 2. We must set up some environmental variables (ORACLE_BASE, ORACLE_HOME and

LIBPATH) for our user oraprd. We do this in the file $HOME/.profile

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 19

Creating database “IBM” 1. In one session, VNC we will create a listener. We will execute the Oracle’s utility netca.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 20

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 21

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 22

2. We will create our database named “IBM” with the Database Configuration Assistant. We will execute the command dbca.

3. In this screen, we will choose the option: create a database.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 23

4. Choose the option: Custom Database.

5. In the next screen we have to give the instance name and the database name, in our exercise both of them are “IBM”.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 24

6. We configure Enterprise Manager.

7. We register the passwords for : SYS, SYSTEM, DBSNMP and SYSMAN.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 25

8. In the following screen we will be asked for the directory set up where our database will be located. In our exercise the database will be located in the filesystem u02.

9. Then we will be asked where our flash recovery area will be located.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 26

10. In this screen, we will have the chance to install some database components.

11. In the following screen, we have to write the instance name and the database name, in our

exercise both of them are IBM.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 27

12. Then, in this screen we must confirm the database creation.

13. We see the creation summary.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 28

14. We see the creation progress.

15. We will set up the variable environment ORACLE_SID and we must do a test to connect to the database.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 29

Configuring Oracle Data Guard At this point, we will set up Oracle Data Guard using “real-time apply” and “active duplicate from active database”.

Active duplicate from active database

Both servers must be able to ping each other,

In the file /etc/hosts of each server, we must register both servers. Example:

127.0.0.1 localhost.localdomain localhost 10.18.1.5 banco1.ibm.com banco1 10.18.1.6 banco2.ibm.com banco2

Creating entries in the tnsnames.ora

We will create a couple of entries in the file tnsnames.ora of both servers. The objective is that each server can do a tnsping of each entry where one entry points to the local server and the other one to the contingency server.

We will use the Oracle tool netmgr (Net Manager).

1. We will create an entry for banco1. .

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 30

2. Then we will enter the IP address and listener port of banco1.

3. We will enter the name of service where the listener of banco1 has been registered. In our case

“IBM” is the service name.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 31

4. Then we repeat the same step to register an entry for banco2 from banco2.

5. Repeat step 1 to step 4 in the server banco1.

Manually register the database service in the listener

We must manually register the database service IBM (named IBM too) in the listener of each server.

We will use the Oracle tool netmgr again.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 32

6. We will go to the option “Listeners” (choose the Listener named LISTENER) and choose the option Database Service (on the right).

7. We then manually register the service in the listener.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 33

8. This step must then be repeated in the other server. 9. Then we must do a reload of the configuration in each listener of each server. We apply the

Oracle command: lsntctl reload

10. Then we must do a test of tnsping in each node for each entry. Example (Execute in each server): tnsping banco1 tnsping banco2

Creating password file

We must validate that our database has the password file. By default, when you use DBCA to create a database, there will be a password file.

In the contingency server we will create the password file due to the fact that we have created the database manually. We will use the Oracle command orapwd for creating the password of our contingency database. Before, we must be in the directory $ORACLE_HOME/dbs and apply the command. The result of this command is the creation of the file orapwIBM

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 34

Creating a contingency instance

We must create a PFILE to create the instance in the contingency server. Steps:

It is located in the directory: $ORACLE_HOME Create a file with the name: initIBM.ora and in this file we must have the following line:

db_name = IBM Then we must create some directories that our primary server will point to in its SPFILE. In

our case we created the following directories:

Startup in state nomount the contingency instance: STARTUP NOMOUNT

Note: /u01/app/oraprd/admin/IBM/adump was our auditing directory.

Start to duplicate the sides

Connect with RMAN to both servers using entries registered in the tnsnames.ora.

Proceed to duplicate the database. To do this, we execute the following command:

RMAN> duplicate target database for standby from active database spfile set db_unique_name='IBM2' set standby_file_management='AUTO' nofilenamecheck;

We indicate to RMAN to clone the spfile and then change the values of the parameters (DB_UNIQUE_NAME, STANDBY_FILE_MANAGEMENT) with their respective values in the contingency server and copy the production database to contingency side. We will see a screen similar to:

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 35

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 36

Next we begin testing the contingency database. To do this we will query the view V$DATABASE in the contingency server and we will see its role of physical standby.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 37

Configure Data Guard

Configuration of both instances 1. We need to define the two gap resolution parameters on both banco1 and banco2.

In banco1:

FAL_SERVER indicates that banco2 (alias of tnsnames references to banco2) will send the missing archive log files to the standby (defined by FAL_CLIENT) which will be banco1 in a scenario where banco2 is primary.

In banco2:

The same but with the values inverted.

2. We must define the different destinations of our archive files. When an archive is created, it must be located on the disk and must be sent to a network with the objective that the contingency server will receive the redo and apply all transactions that belong to the archive that was sent, these do since the first switch logs at the primary site.

The parameters are LOG_ARCHIVE_DEST_n In banco1:

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 38

In banco2:

The constant DB_RECOVERY_FILE_DEST does references to Flash Recovery Area’s directory. 3. One other important parameter is STANDBY_FILE_MANAGEMENT configured to AUTO. It will

let the contingency server automatically create a datafile when we create a datafile in the production database. This was set automatically in our RMAN script but must be set manually in our production database.

4. The parameter STANDBY_ARCHIVE_DEST is deprecated in the version Oracle 11g.

Automatically when the contingency server receives the archives, they are located in the Flash Recovery Area and this takes advantage of the administration of space that Oracle handles.

Creating standby redo log groups

Both instances need new standby type redo log groups, because redo is being sent asynchronously to the standby database as it is generated on the Primary database.

We must create standby redo logs of the same size as our Online Redo Log groups with the following formula:

TOTAL_STANDBY_REDO_LOGS_GROUPS = (#REDO_LOGS_GROUPS x #THREADS) + 1

In our case, we have three redo log groups so we need four standby type redo log groups.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 39

In banco1:

In banco2:

These standby logfiles can be seen with the following query:

SQL> SELECT GROUP#, SEQUENCE#, BYTES FROM V$STANDBY_LOG;

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 40

Starting Real Time Apply

We start Redo Apply in the contingency side with the command:

alter database recover managed standby database using current logfile disconnect;

And if we want to know the status of the processes and sequences of standby database, we query the view V$MANAGED_STANDBY.

select process, status, sequence#, blocks, delay_mins from v$managed_standby;

If we want to stop applying the transactions and archives we execute the following command:

alter database recover managed standby database cancel;

Example:

In Banco1 we generate some log switches:

In Banco2:

In the following example we can see that our sides are synchronized:

Banco1 has actually the sequence 73 (we execute the command archive log list)

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 41

Banco2 has the same sequence:

The field BLOCKS show the progress of the redo that banco2 is receiving from banco1.

We will do some additional tests.

In banco1 we can see that we have the sequence 73 and we generate two more archives. (alter system switch logfile two times), right screen.

In the left screen we can see that banco2 is in the sequence 73 and starts to get archives from banco1 and applying the transactions until banco2 had the same sequence that banco1 (in our case sequence 75).

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 42

Doing a switchover between nodes

We will do a switchover, changing roles between the database servers.

Banco1 will have the role of contingency side and banco2 will have the role of primary side.

Steps:

In banco1:

• Prepare the primary database server to convert it into a contingency role:

ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL WITH SESSION SHUTDOWN;

• SHUTDOWN IMMEDIATE

In banco2:

• Cancel the applying of archives and transactions in contingency side:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT CANCEL;

• Prepare the contingency database server to convert it into a primary role:

ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;

• SHUTDOWN IMMEDIATE;

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 43

Now, we will see the new roles in both sites:

Banco1 is the contingency side:

Banco2 is the primary side:

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 44

Please note applications will loose the connections to the database until the switchover process is completed. The switching over process is a disruptive one for the applications. The clients will failover to the new primary server.

Our applications should have in its tnsnames.ora the following configuration for a failover:

IBM = (DESCRIPTION = (LOAD_BALANCE = OFF) (FAILOVER = YES) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.18.1.5)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.18.1.6)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = IBM) (SERVER = DEDICATED) ) )

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 45

Using snapshot standby database

Configuring the snapshot standby database

Convert the active standby database to the snapshot standby database

Use the SQL command “alter database recover managed standby database cancel” to cancel any further transactions from being applied to the standby database.

Then the SQL command “alter database convert to snapshot standby” to convert the active standby database to the snapshot standby database.

Open the snapshot standby database as read write

Use the SQL command “alter database open” to open the snapshot standby database as read write.

SQL> alter database open;

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 46

Working snapshot standby database

We can do the test in our contingency database

We will create a schema named friccio with a table named mytable. We will validate that this schema does not exist in the primary database (banco1).

Converting the snapshot standby back to a physical standby database

Converting the snapshot standby database

Having finished our test in the contingency database server, we will cancel our test and initialize again the application of archives that weren’t applied during the time of the test.

We must know that while we were doing our test in the snapshot standby database, the database continued receiving archives of the primary side without any apply.

Steps in standby database:

1. SHUTDOWN IMMEDIATE; 2. STARTUP MOUNT 3. ALTER DATABASE CONVERT TO PHYSICAL STANDBY; 4. SHUTDOWN IMMEDIATE; 5. ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE

DISCONNECT;

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 47

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 48

Summary Oracle Database 11g Release 2 offers many new features. This paper covers the creation of a duplicate database from an active database and snapshot standby database features. Creating a duplicate database from an active database allows us to build a contingency site without the need of a previous backup which can be very useful.

Another step that could be considered after you implement the standby database is monitoring the standby database. You could monitor with shell scripts or with ITM (IBM Tivoli Monitoring).

Again, the objective of this document was to document how to:

• set up the primary and physical standby connected with Dark Fiber communication interface,

• make sure the both of the databases are in sync,

• switch the role of the servers: primary to physical stand by and vice versa.

If you have any questions or comments, please contact the IBM Oracle International Competency Center at: [email protected].

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 49

References

Oracle documentation Oracle Database New Features Guide 11g Release 2 (11.2) E10700-02 Oracle Metalink, Document ID: 443720.1

IBM documentation Oracle Database11g R2 Enterprise Edition using Oracle RAC on IBM BladeCenter running

RedHat Enterprise Linux 5 and IBM System Storage DS4800 April 2008, Betty Lee Document ID: WP101223

IBM and Oracle Web sites These Web sites provide useful references to supplement the information contained in this document:

For further information about the real-time apply feature please visit: http://download.oracle.com/docs/cd/E11882_01/server.112/e10700/log_apply.htm#SBYDB0050

For further information about “duplicate from active database”, please refer to this web site: http://download-uk.oracle.com/docs/cd/B28359_01/backup.111/b28273/rcmsynta020.htm

For further information about snapshot standby database, refer to this web site: http://www.oracle.com/technology/obe/11gr2_db_prod/ha/dataguard/usingsnapshot/usingsnapshot.htm

For more information on Oracle Data Guard, please visit: http://www.oracle.com/goto/dataguard http://www.oracle.com/technology/deploy/availability/htdocs/DataGuardOverview.html

For further information on IBM POWER Systems , refer to this web site:

http://www-03.ibm.com/systems/power/

For further information on IBM System Storage DS4800, please refer to the following web site: http://www-03.ibm.com/systems/storage/disk/ds4000/ds4800/index.html

For information on interoperability matrix for IBM System Storage DS4000, please visit: http://www-03.ibm.com/systems/storage/disk/ds4000/interop-matrix.html

For the latest information regarding IBM AIX 5.3 and AIX 6.1 , please refer to: IBM AIX 5.3: http://www-03.ibm.com/systems/power/software/aix/v53/index.html IBM AIX 6.1: http://www-03.ibm.com/systems/power/software/aix/v61/index.html

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 50

IBM RedBooks http://www.redbooks.ibm.com

Oracle Database 11g Enterprise Edition

http://www.oracle.com/database/enterprise_edition.html

My Oracle Support (formerly Oracle Metalink) https://support.oracle.com/CSP/ui/flash.html

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 51

About the author Francisco Riccio Chavez, is a Senior IT Specialist certified on Oracle Database 10g and 11g (Oracle Certified Associate / Oracle Certified Professional), Oracle Database RAC 10g Release 2 Advanced Certified Expert, Managing Oracle Database 10g on Linux Certified Expert and Oracle Database SQL Expert.

He also teaches Oracle’s certification at Peruvian universities.

He works at IBM Global Technology Services – SSO Peru Multicontry SSA LA with the role Team Leader Data Management.

His team is responsible for administering all database platforms (IBM DB2 / Oracle Database / MS SQL Server), Oracle E-Business Suite, and Oracle Application Server in different SO platforms for Peru customers of IBM.

E-mail address: [email protected]

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 52

Trademarks and special notices © Copyright. IBM Corporation 1994-2010. All rights reserved.

References in this document to IBM products or services do not imply that IBM intends to make them available in every country.

IBM. the IBM logo, ibm.com, AIX, BladeCenter, DS4000, DS6000, DS8000, POWER, System Storage, and System x are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both:

Microsoft, Windows, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both.

Linux is a trademark of Linus Torvalds in the United States, other countries, or both.

Other company, product, or service names may be trademarks or service marks of others.

The information provided in this document is distributed “AS IS” without any warranty, either express or implied.

The information in this document may include technical inaccuracies or typographical errors.

Information concerning non-IBM products was obtained from a supplier of these products, published announcement material, or other publicly available sources and does not constitute an endorsement of such products by IBM. Sources for non-IBM list prices and performance numbers are taken from publicly available information, including vendor announcements and vendor worldwide homepages. IBM has not tested these products and cannot confirm the accuracy of performance, capability, or any other claims related to non-IBM products. Questions on the capability of non-IBM products should be addressed to the supplier of those products.

All statements regarding IBM future direction and intent are subject to change or withdrawal without notice, and represent goals and objectives only. Contact your local IBM office or IBM authorized reseller for the full text of the specific Statement of Direction.

Some information addresses anticipated future capabilities. Such information is not intended as a definitive statement of a commitment to specific levels of performance, function or delivery schedules with respect to any future products. Such commitments are only made in IBM product announcements. The information is presented here to communicate IBM's current investment and development activities as a good faith effort to help with our customers' future planning.

Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve throughput or performance improvements equivalent to the ratios stated here.

Photographs shown are of engineering prototypes. Changes may be incorporated in production models.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 53

Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk.

Oracle Database 11g Release 2 Enterprise Edition using Snapshot Standby Database on IBM Power Systems running AIX and IBM System Storage DS4800 http://www.ibm.com/support/techdocs © Copyright 2010, IBM Corporation 54