* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download E D H A
Microsoft SQL Server wikipedia , lookup
Oracle Database wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Relational model wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Concurrency control wikipedia , lookup
Database model wikipedia , lookup
ENABLE DATABASE HIGH AVAILABILITY USING DB2 HADR AND TIVOLI SA MP IN AN SAP ENVIRONMENT Patrick Zeng Wayne Ha IBM Toronto Lab AUGUST 30, 2007 IBM Software Group Toronto Lab 1 28 August 2007 Copyright 2007 IBM Corporation. All Rights Reserved. Neither this documentation nor any part of it may be copied or reproduced in any form or by any means or translated into another language, without the prior consent of the IBM Corporation. IBM makes no warranties or representations with respect to the content hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. IBM assumes no responsibility for any errors that may appear in this document. The information contained in this document is subject to change without any notice. IBM reserves the right to make any such changes without obligation to notify any person of such revision or changes. IBM makes no commitment to keep the information contained herein up to date. References in this publication to IBM products or services do not imply that IBM intends to make them available in all countries in which IBM operates. IBM, the IBM logo, DB2, DB2 Universal Database, AIX and Tivoli are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc., in the United States, other countries, or both. SAP is registered trademarks of SAP AG. Linux is a trademark of Linus Torvalds in the United States, other countries, or both. Windows is a trademark of Microsoft Corporation in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of others. IBM Software Group Toronto Lab 2 28 August 2007 Table of Contents 1. INTRODUCTION ................................................................................................................................ 5 2. PLANNING........................................................................................................................................... 8 2.1 2.2 2.3 2.4 3. PREPARATION................................................................................................................................. 11 3.1 3.2 3.3 3.4 3.5 4. CONFIGURATION OF THE TEST SYSTEM ........................................................................................... 8 REFERENCE DOCUMENTS ................................................................................................................ 8 HARDWARE REQUIREMENTS ........................................................................................................... 9 SOFTWARE REQUIREMENTS........................................................................................................... 10 BASIC NETWORK SETUP ................................................................................................................ 11 FILE SYSTEMS SETUP .................................................................................................................... 11 RSH SETUP ..................................................................................................................................... 11 CREATING OPERATING SYSTEM USERS AND GROUPS MANUALLY ................................................ 12 INSTALL JDK ................................................................................................................................ 12 INSTALLATION ............................................................................................................................... 13 4.1 DOWNLOAD THE DB2 9 AND SA MP SOFTWARE ......................................................................... 13 4.2 INSTALL DB2 ................................................................................................................................ 13 4.3 EXPORT SAP TRANSPORT DIRECTORY.......................................................................................... 14 4.4 INSTALL SAP SCS INSTANCE ....................................................................................................... 14 4.5 EXPORT FILE SYSTEMS TO DATABASE INSTANCE SERVER ............................................................ 15 4.6 INSTALL DATABASE INSTANCE ON PRIMARY DATABASE SERVER .................................................. 17 4.7 INSTALL SAP CENTRAL INSTANCE ............................................................................................... 17 4.8 SET UP HADR............................................................................................................................... 19 4.9 ENABLE DB2 AUTOMATIC CLIENT REROUTE FOR SAP SYSTEM (ABAP+JAVA).......................... 26 4.9.1 Set up Client Reroute ............................................................................................................ 27 4.9.2 Client Reroute for SAP Java Application ............................................................................. 30 4.9.3 Test Failover......................................................................................................................... 31 4.9.4 Remove Client Reroute configuration................................................................................... 32 4.10 INSTALL SA MP SOFTWARE AND LICENSE ................................................................................... 33 4.11 SET UP THE CLUSTER..................................................................................................................... 34 4.11.1 Download the latest DB2 HA script patch............................................................................ 34 4.11.2 Copy the Setup Files and Scripts to a Local Directory......................................................... 35 4.11.3 Creating File sapdb2policy.conf........................................................................................... 35 4.11.4 Setting up the Cluster Using sapdb2policy.sh ...................................................................... 36 4.12 ENABLE SAP WITH VIRTUAL DATABASE HOST NAME AND IP ADDRESS...................................... 40 4.12.1 Change the default profile .................................................................................................... 41 4.12.2 Change node directory entry on all SAP instances............................................................... 42 4.12.3 Change the JDBC URL......................................................................................................... 43 5. RUNNING SAP WITH HADR AND SA MP................................................................................... 44 5.1 VERIFY THE SETUP PRIOR TO TESTING ........................................................................................... 44 5.2 CONTROLLED FAILOVER TEST ...................................................................................................... 47 5.3 INSTANCE FAILURE TEST .............................................................................................................. 50 5.4 NODE FAILURE TEST ..................................................................................................................... 52 5.5 MISCELLANEOUS OPERATIONS IN SA MP ENVIRONMENT ............................................................. 55 5.5.1 To display the cluster nodes status ....................................................................................... 55 5.5.2 To display the cluster domain status..................................................................................... 55 5.5.3 To display the cluster resource group status ........................................................................ 56 5.5.4 To start or stop DB2 instance manually ............................................................................... 56 5.5.5 To switch HADR role (controlled failover) .......................................................................... 56 5.5.6 To disable or enable SA MP control..................................................................................... 56 5.5.7 To uninstall cluster ............................................................................................................... 57 IBM Software Group Toronto Lab 3 28 August 2007 APPENDIX A. REFERENCE ................................................................................................................... 61 IBM Software Group Toronto Lab 4 28 August 2007 Table of Figures FIGURE 1. TOPOLOGY OF THE TEST SYSTEM ................................................................................................... 8 FIGURE 2. INSTALLING SAP CENTRAL SERVICES INSTANCE (SCS) .............................................................. 15 FIGURE 3. INSTALLING SAP DATABASE INSTANCE ON THE PRIMARY DATABASE SERVER ............................ 17 FIGURE 4. INSTALLING SAP CENTRAL INSTANCE ......................................................................................... 18 FIGURE 5. INSTALLING SAP DATABASE INSTANCE ON THE STANDBY DATABASE SERVER ............................ 19 FIGURE 6. CHOOSING HOMOGENEOUS SYSTEM COPY METHOD ON STANDBY DATABASE SERVER................. 20 FIGURE 7. MODIFY PARAMETERS TO MATCH THE ONES ON THE PRIMARY SERVER ........................................ 21 FIGURE 8. PROMPT FOR THE DATABASE RESTORE DURING THE SAP SYSTEM COPY ON STANDBY SERVER .... 22 FIGURE 9. THE JAVA DATASOURCE CONFIGURATION ................................................................................... 30 FIGURE 11 USE VIRTUAL HOST NAME OR IP ADDRESS IN JDBC URL ........................................................... 43 FIGURE 12 DB SERVER FIELD SHOWS THE VIRTUAL HOST NAME .................................................................. 46 FIGURE 13 THE HOST FIELD SHOWS VIRTUAL HOST NAME ............................................................................ 47 FIGURE 14 STANDBY DATABASE TAKES OVER TO BECOME PRIMARY DATABASE .......................................... 50 IBM Software Group Toronto Lab 5 28 August 2007 1. Introduction This article describes how to enable database high availability (HA) using IBM® DB2® for Linux®, UNIX® and Windows® (DB2 V8 or DB2 9) High Availability and Disaster Recovery (HADR) capability in an SAP ABAP and Java™ dual stack environment, as well as how to enable automatic failover using IBM Tivoli® System Automation for Multiplatforms (SA MP) in such an HA system. DB2 HADR DB2 HADR is a database replication feature that provides a high availability solution for both partial and complete site failures. HADR protects against data loss by replicating data changes from a source database, called the primary, to a target database, called the standby. In case of a failure the takeover by the standby database only takes some seconds since the standby database server is already up and running. The only work to be done is to reconnect all clients to the standby server. In contrast to high availability clusters managed by a cluster management software like SA MP or HACMP, this setup does not require a shared storage device. Both servers have their own storage, DB2 software and database. Further, the servers can reside at different locations since they do not require any shared storage. So even if the primary server gets destroyed, for example by fire, the second database server at another location will be able to take over the role as primary database server. Tivoli SA MP IBM Tivoli SA MP is a high-availability cluster solution which provides several monitoring mechanisms to detect system failures and a set of rules to initiate the correct action without any user intervention. The set of rules is called a policy, which describes the relationships between applications or resources. This provides SA MP with extensive up-to-date information about the system landscape so that it can restart the resource on the current node or move the whole application to another cluster node. SA MP is only available on AIX® and Linux for now. With the release of DB2 9, SAP is partnering with IBM to provide SAP customers with a free two-node license of SA MP for the IBM DB2 database server. SAP has also published an installation guide “IBM DB2 High Availability Solution: IBM Tivoli System Automation for Multiplaforms” on how to set up a database cluster using SA MP. For details please see SAP Note 930487 “DB6: Using DB2 9 with SAP Software”. This article focuses on the HADR solution which is unique to DB2. Since DB2 HADR does not come with the system monitoring and automatic failover capability, SA MP can be used to compliment HADR. We will use the scripts provided by SAP to set up the cluster on DB2 HADR system. DB2 Automatic Client Reroute vs. Virtual Host / IP Address This article also discusses two different approaches for SAP applications (ABAP+Java) to reconnect to the new active database after a failover. One approach is to use DB2 Automatic Client Reroute (ACR) feature, and the other approach is to use virtual host and IP address to the database server. SAP NetWeaver supports the database reconnect feature. If a connection to the database server gets disconnected, the corresponding work process tries to reconnect to the database as soon as it is available again. The SAP NetWeaver Application server will be up during the whole database takeover phase. With the DB2 client reroute feature, the work processes will try to connect to the alternate server. With the SA MP setup, the virtual IP address of the database server will be moved to the new primary database server. IBM Software Group Toronto Lab 6 28 August 2007 As a result all work processes will reconnect to the new primary database server. Due to this database reconnect feature, a database server failure and a subsequent failover is almost transparent to the clients. However, the running transactions of the work processes are terminated and rolled back, and the transaction has to be resubmitted. Details of procedures and examples of output are provided for readers to follow each step carefully and be able to compare with their own experience. IBM Software Group Toronto Lab 7 28 August 2007 2. Planning The test system for this article will consist of two database servers for the HADR setup, one SAP NetWeaver Central Instance and one or multiple clients. 2.1 Configuration of the Test System The diagram below shows the topology of the test system that is set up in this article. Host C – altena (9.26.53.33) SAP Central Instance (ABAP+Java) Client Machines Virtual database server host – sapaaa (9.26.4.134) Log shipping Host S – achern (9.26.4.94) Standby database Host P – amberg (9.26.4.92) Primary database Figure 1. Topology of the Test System 2.2 Reference Documents The following sections provide information about additional documentation that might help you understand the technology before you proceed with the system installation and configuration described in this article. SAP Documentation IBM Software Group Toronto Lab 8 28 August 2007 Document Installation Guide – SAP NetWeaver 2004s SR2 <ABAP; ABAP+Java; Java> on <OS>: IBM DB2 Universal Database for UNIX and Windows URL https://websmp208.sap-ag.de/instguidesnw70 -> Installation Database Upgrade Guide – Migration to Version 9 of IBM DB2 for Linux, UNIX, and Windows service.sap.com/instguides -> Other Documentation -> Database Upgrade -> DB2 UDB Installation Guide – IBM DB2 High Availability Solution: IBM Tivoli System Automation for Multiplaforms Service.sap.com/notes -> Note 930487 - DB6: Using DB2 9 with SAP Software -> Attachments or https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/l ibrary/uuid/77d60365-0d01-0010-30a6-99af49495c82 SAP Notes OSS Note Number 960843 930487 938522 899322 101809 816773 166481 709140 716927 Description DB6: Installation SA MP DB6: Using DB2 9 with SAP Software DB6: Migration to Version 9 of DB2 DB6: DB2 9 Standard Parameter Settings DB6: Supported Fix Packs for DB2 UDB for UNIX and Windows DB6: Installing an SAP OEM license Overview of RDBMS DVDs from DB2 UDB for UNIX and Windows Recommended JDK and VM Settings for the WebAS630/640/7.0 Recommended Settings for the AIX JVM DB2 Documentation Document IBM DB2 Database for Linux, UNIX, and Windows Information Center URL http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp 2.3 Hardware Requirements Hardware requirements used for set up the test system for this article: IBM Software Group Toronto Lab 9 28 August 2007 Hardware Component Database Servers Requirement Two separate servers for the database. One is used for primary database and the other is used for standby database. Both servers must meet the DB2 requirements as described in the IBM documentation DB2 Installation Prerequisites for AIX, which you can find at: www.ibm.com/software/data/db2/udb/sysreqs.html SAP Server Check Installation Guide “SAP NetWeaver 2004s SR2 ABAP+Java on AIX: IBM DB2 Universal Database for UNIX and Windows” 2.4 Software Requirements Software requirements used for set up the test system for this article: Software Component DB2 9 for AIX SA MP for AIX SAP NetWeaver 2004s AIX JDK Requirement Download the latest SAP DB2 9 FP3 Image SA MP v2.1 FP6, which should be included in the DB2 9 FP3 Image from SAP Otherwise can be downloaded from ftp://ftp.software.ibm.com/software/tivoli_support/patches/patches_2.1.0/2.1.0TIV-ITSAMP-FP0006 SR2 and up AIX 5.3 TL05 Please see also: www.ibm.com/software/data/db2/udb/sysreqs.html and http://www-1.ibm.com/support/docview.wss?rs=71&uid=swg21165448 java version "1.4.2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2) Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX 5L for PowerPC (64 bit JVM) build caix64142-20060824 (SR6) (JIT enabled: jitc)) See also SAP Note 709140 “Recommended JDK and VM Settings for the WebAS630/640/7.0” If your SAP system is running on DB2 V8, the installation steps described in this article will work too. However, you will need to download DB2 9 image from SAP service marketplace in order to get the Tivoli SA MP software, license and the installation script. IBM Software Group Toronto Lab 10 28 August 2007 3. Preparation If you are going to enable HA for an existing SAP system, you can skip the following preparation steps. 3.1 Basic Network Setup Make sure that all three hosts (P - amberg), (S - achern), (C - altena) will be able to communicate with each other via TCP/IP protocol. Add the appropriate IP address to the hostname mappings in the /etc/hosts file of each host. Sample content of /etc/hosts on (P - amberg), (S - achern), and (C - altena): 9.26.53.33 altena 9.26.4.92 amberg 9.26.4.94 achern Adding static IP address to hostname mappings to the hosts file removes the systems’ DNS servers as a single point of failure. Should DNS fail, the cluster systems can still resolve the addresses of the other machines via the hosts file. Note that adding this information on the client is not recommended because of the maintenance overhead of updating all clients’ hosts files should the mappings change. On (P - amberg), (S - achern), (C - altena), test that you can ping from each node to all other nodes successfully using the following commands: # ping altena # ping amberg # ping achern 3.2 File Systems Setup Set up required file systems by following the installation guide “SAP NetWeaver 2004s SR2 ABAP+Java on AIX: IBM DB2 Universal Database for UNIX and Windows”. 3.3 rsh Setup On AIX, rsh should be running automatically as part of the operating system. On (P - amberg), (S - achern), (C - altena), check the following: Confirm that rsh is running: # lssrc -t shell Service Command shell /usr/sbin/rshd Description rshd Status active If it is not running, ensure that the following line in /etc/inetd.conf is uncommented: shell stream IBM Software Group Toronto Lab tcp6 nowait root /usr/sbin/rshd 11 rshd 28 August 2007 The remote shell can then be started with the command: #startsrc –t shell 3.4 Creating Operating System Users and Groups Manually Check the installation guide “SAP NetWeaver 2004s SR1 ABAP+Java on AIX: IBM DB2 Universal Database for UNIX and Windows” for the users and groups requirement. The user IDs and group IDs should be identical across all three servers. For this article, the script below is used to create users and groups in batch on (P - amberg), (S - achern) and (C - altena): # cat addusers.sh rmuser ahaadm rmuser db2aha rmuser sapaha rmuser sapahadb rmgroup rmgroup rmgroup rmgroup sapsys dbahaadm dbahactl dbahamnt mkgroup mkgroup mkgroup mkgroup id=300 id=301 id=302 id=303 sapsys dbahaadm dbahactl dbahamnt useradd useradd useradd useradd -c -c -c -c passwd pwdadm passwd pwdadm passwd pwdadm passwd pwdadm ahaadm -c ahaadm db2aha -c db2aha sapaha -c sapaha sapahadb -c sapahadb "SAP "SAP "SAP "SAP System Administrator" Database Administrator" Database Connect User" Database Connect User" -m -m -m -m -d -d -d -d /home/ahaadm /db2/db2aha /home/sapaha /home/sapahadS -g -g -g -g sapsys -G dbahactl dbahaadm dbahamnt -G sapsys dbahamnt -G sapsys -u -u -u -u 301 302 303 304 -s -s -s -s /bin/csh /bin/csh /bin/csh /bin/csh ahaadm db2aha sapaha sapahadb 3.5 Install JDK A JDK is required by the SAP installation program (sapinst) and SAP Java server. You should check SAP Note 709140 “Recommended JDK and VM Settings for the WebAS630/640/7.0” for a proper JDK. On (P - amberg), (S - achern), (C - altena): # java -version java version "1.4.2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2) Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX 5L for PowerPC (64 bit JVM) build caix6414220060824 (SR6) (JIT enabled: jitc)) IBM Software Group Toronto Lab 12 28 August 2007 4. Installation If you are going to enable HA for an existing SAP system, you can skip the steps from 4.1 to 4.8. 4.1 Download the DB2 9 and SA MP Software To be able to install the latest version of DB2 9 and SA MP, download the required software DVD image from SAP Service Marketplace at: service.sap.com/swdc → Download → Database Patches (from other vendors) → DB2 for UNIX and Windows → DB2 9 software download The SA MP software and setup scripts are bundled with the DB2 9 installation image. In order to have the latest SA MP Software and setup script, you need to download the image from DB2 9 FixPack 3 (FP3) and up. Also, the license file for SA MP is packed together with DB2 9 licenses. Please check SAP Note 816773 for how to download and install DB2 and SA MP license. If you have already ordered DB2 9 Software DVD from SAP, you do not need to download it again. And you can install the DB2 and SA MP software directly from a mounted DVD. 4.2 Install DB2 If you have downloaded the image from SAP service marketplace, you need to use “unzip” tool to unzip the image. And then run command chmod +x –R . in the unzip directory because unzip tool does not set execute permissions on the extracted files . If you have ordered the DB2 DVD, you can mount the DVD and install from there. On the database servers (P - amberg) and (S - achern), you need to install ESE product. # <mount point>/DB2_LUW_RDBMS_V9_GA_AIX__HP__SOL/AIX_64/ESE/disk1/db2_install Default directory for installation of products - /opt/IBM/db2/V9.1 *********************************************************** Do you want to choose a different directory to install [yes/no] ? no Specify one or more of the following keywords, separated by spaces, to install DB2 products. CLIENT RTCL ESE Enter "help" to redisplay product names. Enter "quit" to exit. *********************************************************** ESE … The execution completed successfully. For more information see the DB2 installation log at "/tmp/db2_install.log.409638". IBM Software Group Toronto Lab 13 28 August 2007 In the future SAP NetWeaver release, DB2 installation will be embedded in the SAP installation, and it will probably be installed into a different directory. On the SAP server (C - altena), you just need to install CLIENT product. # <mount point>/DB2_LUW_RDBMS_V9_GA_AIX__HP__SOL/AIX_64/ESE/disk1/db2_install Default directory for installation of products - /opt/IBM/db2/V9.1 *********************************************************** Do you want to choose a different directory to install [yes/no] ? yes Enter full path name for the install directory -----------------------------------------------/opt/IBM/db2/V9.1_CLIENT Specify one or more of the following keywords, separated by spaces, to install DB2 products. CLIENT RTCL ESE Enter "help" to redisplay product names. Enter "quit" to exit. *********************************************************** CLIENT … The execution completed successfully. For more information see the DB2 installation log at "/tmp/db2_install.log.553766". Starting from SAP NetWeaver 2004s SR3, you are no longer required to install DB2 Client software on SAP application servers. Instead, SAP installation will automatically install DB2 CLI Driver in the SAP Global directory and it will be shared by all SAP application servers. 4.3 Export SAP Transport Directory If you have an existing SAP transport directory (/usr/sap/trans) on other server, you need to mount it on the SAP server (C - altena). Check the installation guide “SAP NetWeaver 2004s SR2 ABAP+Java on AIX: IBM DB2 Universal Database for UNIX and Windows”. 4.4 Install SAP SCS Instance Follow the installation guide “SAP NetWeaver 2004s SR2 ABAP+Java on AIX: IBM DB2 Universal Database for UNIX and Windows” to install SAP SCS Instance on (C - altena). IBM Software Group Toronto Lab 14 28 August 2007 Figure 2. Installing SAP Central Services Instance (SCS) 4.5 Export File Systems to Database Instance Server Export the directory (for example <sapmnt>/<SAPSID>/exe) with read or read-write access for the host on which the additional instance runs. IBM Software Group Toronto Lab 15 28 August 2007 On SAP server (C - altena), add the following lines in /etc/exports file: /sapmnt/AHA/profile -root=amberg:achern,access=amberg:achern /sapmnt/AHA/global -root=amberg:achern,access=amberg:achern /sapmnt/AHA/exe -root=amberg:achern,access=amberg:achern Then run the following commands: # exportfs -a # exportfs /sapmnt/AHA/profile -root=amberg:achern,access=amberg:achern /sapmnt/AHA/global -root=amberg:achern,access=amberg:achern /sapmnt/AHA/exe -root=amberg:achern,access=amberg:achern On database server (P - amberg) and (S - achern), add the following entries in the /etc/filesystems: /sapmnt/AHA/exe: dev vfs nodename mount options account = = = = = = "/sapmnt/AHA/exe" nfs altena true bg,soft,intr false /sapmnt/AHA/global: dev vfs nodename mount options account = = = = = = "/sapmnt/AHA/global" nfs altena true bg,soft,intr false /sapmnt/AHA/profile: dev vfs nodename mount options account = = = = = = "/sapmnt/AHA/profile" nfs altena true bg,soft,intr false Create the sample script and run the following commands: # cat mkdir mkdir mkdir mkdir sapmount.sh /sapmnt/AHA /sapmnt/AHA/profile /sapmnt/AHA/global /sapmnt/AHA/exe mount /sapmnt/AHA/profile mount /sapmnt/AHA/global mount /sapmnt/AHA/exe # sapmount.sh # mount node -------altena altena altena mounted --------------/sapmnt/AHA/profile /sapmnt/AHA/global /sapmnt/AHA/exe IBM Software Group Toronto Lab mounted over --------------/sapmnt/AHA/profile /sapmnt/AHA/global /sapmnt/AHA/exe 16 vfs -----nfs3 nfs3 nfs3 date -----------Nov 21 15:36 Nov 21 15:36 Nov 21 15:36 options --------------bg,soft,intr,rw bg,soft,intr,rw bg,soft,intr,rw 28 August 2007 4.6 Install Database Instance on primary database server If you are enabling HA for an existing SAP system, you can skip this step. Follow the installation guide “SAP NetWeaver 2004s SR2 ABAP+Java on AIX: IBM DB2 Universal Database for UNIX and Windows” to install SAP Database Instance on (P - amberg). Figure 3. Installing SAP Database Instance on the primary database server 4.7 Install SAP Central Instance If you are enabling HA for an existing SAP system, you can skip this step. Follow the installation guide “SAP NetWeaver 2004s SR2 ABAP+Java on AIX: IBM DB2 Universal Database for UNIX and Windows” to install SAP Central Instance on (C - altena). IBM Software Group Toronto Lab 17 28 August 2007 Figure 4. Installing SAP Central Instance Once the central instance installation is completed successfully, you have a working SAP system. You can now perform necessary post-installation steps according to the installation guide. After that you can stop SAP, turn on DB2 log archiving, and perform a full offline database backup. On the database server (P - amberg), db2 update db cfg for AHA using LOGARCHMETH1 DISK:/db2/AHA/log_archive/ db2 backup db aha to /db2/backup compress IBM Software Group Toronto Lab 18 28 August 2007 4.8 Set up HADR Use Homogeneous System Copy method to install standby database instance on (S - achern): Figure 5. Installing SAP Database Instance on the standby database server IBM Software Group Toronto Lab 19 28 August 2007 Choose the “Homogenous System Copy (Database copy method)” so that you can restore the DB2 backup from primary database server to standby database server. Figure 6. Choosing Homogeneous System Copy method on standby database server IBM Software Group Toronto Lab 20 28 August 2007 At the “Parameter Summary” page, you might want to revise the “Database Communication” parameters to match the ones set on the primary database server (P - amberg). Figure 7. Modify Parameters to match the ones on the primary server IBM Software Group Toronto Lab 21 28 August 2007 sapinst will prompt you to restore the database backup: Figure 8. Prompt for the database restore during the SAP system copy on standby server At this point, you can safely abort the SAPinst by clicking the Cancel button, and continue with the database restore. Because once the database is restored successfully, it is not necessary to continue on the steps afterwards such as “Create secure store”, “Post load activities”, and so on. These steps were performed during the primary database instance installation on (P - amberg). IBM Software Group Toronto Lab 22 28 August 2007 On (S - achern), restore the database backup: achern:db2aha 59> db2start 01/11/2007 16:17:50 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful. achern:db2aha 61> db2 restore db aha from /db2/backup DB20000I The RESTORE DATABASE command completed successfully. achern:db2aha 62> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias Database name Local database directory Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number = = = = = = = = = AHA AHA /db2/AHA b.00 SAP database AHA Indirect 0 achern:db2aha 65> db2 get db cfg for aha|grep -i Rollforward Rollforward pending = DATABASE Note: during the database instance installation on standby server (S - achern), the DBHOST in SAP DEFAULT.PFL was changed to hostname of standby server “achern”. altena:ahaadm 41> grep -i dbhost DEFAULT.PFL #SAPDBHOST = amberg SAPDBHOST = achern #j2ee/dbhost = amberg j2ee/dbhost = achern This does not affect the normal SAP startup. We will change it to virtual host name later on when we set up the database virtual host. Now we are ready to set up HADR. First of all, you need to add two TCP/IP ports in the /etc/services file on both (P - amberg) and (S achern). These ports are used by the primary and standby database to communicate each other, and they must not be used by any other services on the servers. amberg:db2aha 3> grep HADR /etc/services AHA_HADR_1 54711/tcp AHA_HADR_2 54712/tcp IBM Software Group Toronto Lab 23 28 August 2007 On (P - amberg), create the sample script and run it: amberg:db2aha 51> cat primary_hadr_cfg.sql ---- Update HADR configuration parameters on primary database UPDATE DB CFG FOR AHA USING HADR_LOCAL_HOST amberg; UPDATE DB CFG FOR AHA USING HADR_LOCAL_SVC AHA_HADR_1; UPDATE DB CFG FOR AHA USING HADR_REMOTE_HOST achern; UPDATE DB CFG FOR AHA USING HADR_REMOTE_SVC AHA_HADR_2; UPDATE DB CFG FOR AHA USING HADR_REMOTE_INST db2aha; UPDATE DB CFG FOR AHA USING HADR_SYNCMODE SYNC; UPDATE DB CFG FOR AHA USING HADR_TIMEOUT 120; UPDATE DB CFG FOR AHA USING indexrec RESTART logindexbuild ON; amberg:db2aha 52> db2 -tvf primary_hadr_cfg.sql UPDATE DB CFG FOR AHA USING HADR_LOCAL_HOST amberg DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_LOCAL_SVC AHA_HADR_1 DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_REMOTE_HOST achern DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_REMOTE_SVC AHA_HADR_2 DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_REMOTE_INST db2aha DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_SYNCMODE SYNC DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_TIMEOUT 120 DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING indexrec RESTART logindexbuild ON DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. amberg:db2aha 54> db2 get db cfg for aha|grep HADR HADR database role HADR local host name (HADR_LOCAL_HOST) HADR local service name (HADR_LOCAL_SVC) HADR remote host name (HADR_REMOTE_HOST) HADR remote service name (HADR_REMOTE_SVC) HADR instance name of remote server (HADR_REMOTE_INST) HADR timeout value (HADR_TIMEOUT) HADR log write synchronization mode (HADR_SYNCMODE) IBM Software Group Toronto Lab 24 = = = = = = = = STANDARD amberg AHA_HADR_1 achern AHA_HADR_2 db2aha 120 SYNC 28 August 2007 On (S - achern), create the sample script and run it: achern:db2aha 67> cat standby_hadr_cfg.sql ---- Update HADR configuration parameters on standby database UPDATE DB CFG FOR AHA USING HADR_LOCAL_HOST achern; UPDATE DB CFG FOR AHA USING HADR_LOCAL_SVC AHA_HADR_2; UPDATE DB CFG FOR AHA USING HADR_REMOTE_HOST amberg; UPDATE DB CFG FOR AHA USING HADR_REMOTE_SVC AHA_HADR_1; UPDATE DB CFG FOR AHA USING HADR_REMOTE_INST db2aha; UPDATE DB CFG FOR AHA USING HADR_SYNCMODE SYNC; UPDATE DB CFG FOR AHA USING HADR_TIMEOUT 120; UPDATE DB CFG FOR AHA USING indexrec RESTART logindexbuild ON; achern:db2aha 68> db2 -tvf standby_hadr_cfg.sql UPDATE DB CFG FOR AHA USING HADR_LOCAL_HOST achern DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_LOCAL_SVC AHA_HADR_2 DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_REMOTE_HOST amberg DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_REMOTE_SVC AHA_HADR_1 DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_REMOTE_INST db2aha DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_SYNCMODE SYNC DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING HADR_TIMEOUT 120 DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. UPDATE DB CFG FOR AHA USING indexrec RESTART logindexbuild ON DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. achern:db2aha 70> db2 get db cfg for aha|grep HADR HADR database role HADR local host name (HADR_LOCAL_HOST) HADR local service name (HADR_LOCAL_SVC) HADR remote host name (HADR_REMOTE_HOST) HADR remote service name (HADR_REMOTE_SVC) HADR instance name of remote server (HADR_REMOTE_INST) HADR timeout value (HADR_TIMEOUT) HADR log write synchronization mode (HADR_SYNCMODE) = = = = = = = = STANDARD achern AHA_HADR_2 amberg AHA_HADR_1 db2aha 120 SYNC Now you can start HADR on standby server (S - achern): achern:db2aha 71> db2 start hadr on db aha as standby DB20000I The START HADR ON DATABASE command completed successfully. IBM Software Group Toronto Lab 25 28 August 2007 Once you have started HADR on the standby server, you should start HADR on primary server on (P amberg). Also, use db2pd command to verify that HADR role is Primary and state is Peer: amberg:db2aha 60> db2 start hadr on db aha as primary DB20000I The START HADR ON DATABASE command completed successfully. amberg:db2aha 61> db2pd -db ahP -hadr Database Partition 0 -- Database AHP -- Active -- Up 0 days 00:02:09 HADR Information: Role State Primary Peer SyncMode HeartBeatsMissed Sync 0 LogGapRunAvg (bytes) 45975416 ConnectStatus ConnectTime Timeout Connected Thu Jan 11 20:41:32 2007 (1168566092) 120 LocalHost amberg LocalService AHA_HADR_1 RemoteHost achern RemoteService AHA_HADR_2 PrimaryFile PrimaryPg S0000002.LOG 0 PrimaryLSN 0x00000002219E0000 StandByFile StandByPg S0000001.LOG 16379 StandByLSN 0x00000002219DFFFB RemoteInstance db2aha Now the HADR peer has been established. 4.9 Enable DB2 Automatic Client Reroute for SAP System (ABAP+Java) For the customers that do not plan to use cluster software such as SA MP, they can use DB2 Automatic Client Reroute (ACR) feature to redirect the SAP applications to the new primary database after the failover in an HADR environment. The automatic client reroute feature allows client applications to recover from a loss of communication with the server so that they can continue to work with minimal interruption. After a loss of communication, the client application attempts to reconnect to the server. If this fails, the client is then rerouted to an alternate server location. The UPDATE ALTERNATE SERVER FOR DATABASE command is used to define the alternate server location on a particular database. The alternate hostname and port number is given as part of the command. The location is stored in the system database directory file at the server. After you have specified the alternate server location on a particular database at the server instance, the alternate server location information is returned to the client as part of the connection process. If communication between the client and the server is lost for any reason, the DB2 client will attempt to reestablish the connection by using the alternate server information. The DB2 client will attempt to reconnect with the original server and the alternate server, alternating the attempts between the two servers. Once a connection is successful, the SQLCODE -30108 is returned to indicate that a database connection has been re-established following the communication failure. The hostname/IP address and service name/port number are returned as well. You can use automatic client reroute with high availability disaster recovery (HADR) to make client applications connect to the new primary database after a takeover operation. IBM Software Group Toronto Lab 26 28 August 2007 However, if automatic client reroute is used in the HADR system, you need to ensure that only one database is running as a primary database. After the standby database has been changed to a primary, if the original primary database is also restarted and opened, either as a standard database by issuing “STOP HADR”, or as a primary database by issuing “START HADR ON DATABASE database-alias AS PRIMARY BY FORCE” option, both copies of your database will be operating independently. This is sometimes referred to as split brain or dual primary. In this case, each database can accept connections and perform transactions, and neither receives and replays the updates made by the other. As a result, the two copies of the database will become inconsistent with each other. Therefore, if the cluster software is used, SAP recommends using a virtual IP address and virtual host name of the database server for redirecting SAP application, which will be discussed in Section 4.12. 4.9.1 Set up Client Reroute Update the alternate server information for the primary and standby database so that DB2 can reroute the applications in case one of them is down. On the primary database (P - amberg) : amberg:db2aha 61> DB2 UPDATE ALTERNATE SERVER FOR DATABASE AHA USING HOSTNAME achern PORT 40000 DB20000I The UPDATE ALTERNATE SERVER FOR DATABASE command completed successfully. amberg:db2aha 53> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias Database name Local database directory Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number IBM Software Group Toronto Lab = = = = = = = = = AHA AHA /db2/AHA b.00 SAP database AHA Indirect 0 achern 40000 27 28 August 2007 On the standby database (S - achern): achern:db2aha 61> DB2 UPDATE ALTERNATE SERVER FOR DATABASE AHA USING HOSTNAME amberg PORT 40000 DB20000I The UPDATE ALTERNATE SERVER FOR DATABASE command completed successfully. achern:db2aha 69> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias Database name Local database directory Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number IBM Software Group Toronto Lab = = = = = = = = = AHA AHA /db2/AHA b.00 SAP database AHA Indirect 0 amberg 40000 28 28 August 2007 On the SAP server (C - altena), make a first connection in order to retrieve the alternate server information from the database server and save it to the local database directory: altena:ahaadm 51> db2 list node directory Node Directory Number of entries in the directory = 1 Node 1 entry: Node name Comment Directory entry type Protocol Hostname Service name = = = = = = NODEAHA LOCAL TCPIP amberg sapdb2AHA altena:ahaadm 6> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias Database name Node name Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number = = = = = = = = = AHA AHA NODEAHA b.00 Remote database AHA Remote -1 altena:ahaadm 7> db2 connect to aha user sapaha Enter current password for sapaha: Database Connection Information Database server SQL authorization ID Local database alias = DB2/AIX64 9.1.0 = SAPAHA = AHA altena:ahaadm 8> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias Database name Node name Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number IBM Software Group Toronto Lab = = = = = = = = = AHA AHA NODEAHA b.00 Remote database AHA Remote -1 achern 40000 29 28 August 2007 4.9.2 Client Reroute for SAP Java Application SAP Java server uses DB2 JCC T4 driver to connect to DB2 database. You can check this configuration using the SAP Java Configtool. altena:ahaadm 52> pwd /usr/sap/AHA/DVEBMGS03/j2ee/configtool altena:ahaadm 54> ./configtool.sh Figure 9. The Java Datasource Configuration Here the datasource attribute “jdbc/pool/AHA/Url” is set to “jdbc:db2://amberg:40000/AHA:deferPrepares=0;”, which is using the DB2 JCC T4 URL format. However, DB2 Universal JDBC Driver client reroute support is only available starting from DB2 9 FixPack 3 when a JCC T4 URL driver is used. Therefore, you have to upgrade the DB2 software to DB2 9 FixPack 3 in order to use client reroute for SAP Java application server. In DB2 9 FixPack 3, two new properties “clientRerouteAlternateServerName” and “clientRerouteAlternatePortNumber” are introduced to specify alternate server information. They are obtained by JCC driver automatically from the database upon a successful connection, and then kept in the memory. Therefore they are transient unless an external JNDI store is used to store the alternate server information. Please also note, the database server specified in the SAP J2EE secure store must be the current primary database server when you start up SAP. Otherwise the first connection to the standby database will fail and receive the SQL1776 error. IBM Software Group Toronto Lab 30 28 August 2007 4.9.3 Test Failover Start up SAP, and then you should be able to log on SAP GUI to work with ABAP applications, and open the URL http://altena:50300/index.html on a web browser to work with Java applications. On the primary database server (P - amberg), you can see both SAP ABAP (disp+work) applications and Java (db2jcc_application) applications are connecting to the database. amberg:db2aha 2> db2 list applications Auth Id -------SAPAHADB SAPAHA SAPAHA SAPAHA SAPAHA SAPAHA DB2AHA SAPAHADB SAPAHADB SAPAHADB Application Name -------------db2jcc_applica disp+work disp+work disp+work disp+work disp+work db2evmg_DB2DET db2taskd db2stmm db2jcc_applica Appl. Handle ---------187 178 177 176 175 174 173 172 171 170 Application Id DB # of Name Agents ---------------------------------------------------- -------- ----9.26.53.33.60136.070531183916 AHA 1 9.26.53.33.60100.070531183312 AHA 1 9.26.53.33.60092.070531183212 AHA 1 9.26.53.33.60084.070531183112 AHA 1 9.26.53.33.60082.070531183112 AHA 1 9.26.53.33.60074.070531183012 AHA 1 *LOCAL.DB2.070531183033 AHA 1 *LOCAL.DB2.070531183031 AHA 1 *LOCAL.DB2.070531183030 AHA 1 9.26.53.33.60072.070531183029 AHA 1 On the standby database server (S - achern), only the HADR log replay process is running. achern:db2aha 74> db2 list applications Auth Id Application Name -------- -------------db2replay Appl. Application Id Handle ---------- ---------------------------------------------------16 *LOCAL.DB2.070112014114 DB # of Name Agents -------- ----AHA 1 Now if you do a controlled takeover on the standby server (S - achern): achern:db2aha 9> db2 takeover hadr on db aha DB20000I The TAKEOVER HADR ON DATABASE command completed successfully. After a short while, you should see both SAP ABAP (disp+work) applications and Java (db2jcc_application) applications have been reconnected to the new primary database on (S - achern). achern:db2aha 5> db2 list applications Auth Id Application Name -------- -------------SAPAHA disp+work SAPAHA disp+work SAPAHADB db2jcc_applica SAPAHADB db2jcc_applica SAPAHA disp+work DB2AHA db2evmg_DB2DET SAPAHA db2taskd SAPAHA db2stmm SAPAHA disp+work Appl. Handle ---------273 272 271 267 266 265 264 263 262 Application Id DB # of Name Agents ---------------------------------------------------- -------- ----9.26.53.33.60191.070531184612 AHA 1 9.26.53.33.60184.070531184512 AHA 1 9.26.53.33.60180.070531184440 AHA 1 9.26.53.33.60173.070531184405 AHA 1 9.26.53.33.60169.070531184359 AHA 1 *LOCAL.DB2.070531184401 AHA 1 *LOCAL.DB2.070531184359 AHA 1 *LOCAL.DB2.070531184358 AHA 1 9.26.53.33.60166.070531184357 AHA 1 Now the database server on (P - amberg) becomes the standby database, and you will be able to continue working on either SAP GUI or Java application through the web browser. amberg:db2aha 18> db2 list applications Auth Id Application Name -------- -------------db2replay IBM Software Group Toronto Lab Appl. Application Id Handle ---------- ---------------------------------------------------1528 *LOCAL.DB2.061214204823 31 DB # of Name Agents -------- ----AHA 1 28 August 2007 4.9.4 Remove Client Reroute configuration For the rest of the article, we will demonstrate how to use virtual database host for redirecting SAP applications. Therefore we need to remove the client reroute configuration. Since we have already moved the primary database to host (S - achern) in a previous test, let us move the primary database back to host (P - amberg) first. amberg:db2aha 9> db2 takeover hadr on db aha DB20000I The TAKEOVER HADR ON DATABASE command completed successfully. On (P - amberg), reset the alternate server information: amberg:db2aha 57> db2 UPDATE ALTERNATE SERVER FOR DATABASE AHA USING HOSTNAME NULL port 0 DB20000I The UPDATE ALTERNATE SERVER FOR DATABASE command completed successfully. amberg:db2aha 58> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias Database name Local database directory Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number = = = = = = = = = AHA AHA /db2/AHA b.00 SAP database AHA Indirect 0 On (S - achern), reset the alternate server information: achern:db2aha 34> db2 UPDATE ALTERNATE SERVER FOR DATABASE AHA USING HOSTNAME NULL port 0 DB20000I The UPDATE ALTERNATE SERVER FOR DATABASE command completed successfully. achern:db2aha 35> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias Database name Local database directory Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number IBM Software Group Toronto Lab = = = = = = = = = AHA AHA /db2/AHA b.00 SAP database AHA Indirect 0 32 28 August 2007 On (C - altena), reset the alternate server information by making an explicit connection: altena:ahaadm 1> db2 list db directory System Database Directory Number of entries in the directory = 2 Database 1 entry: Database alias Database name Node name Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number = = = = = = = = = AHA AHA NODEAHA b.00 Remote database AHA Remote -1 amberg 40000 altena:ahaadm 2> db2 connect to aha user sapaha Enter current password for sapaha: Database Connection Information Database server SQL authorization ID Local database alias = DB2/AIX64 9.1.3 = SAPAHA = AHA altena:ahaadm 3> db2 list db directory System Database Directory Number of entries in the directory = 2 Database 1 entry: Database alias Database name Node name Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number = = = = = = = = = AHA AHA NODEAHA b.00 Remote database AHA Remote -1 4.10 Install SA MP Software and License SA MP software is included in the DB2 9 image downloaded from SAP Service Marketplace. Again, if you have ordered DB2 9 DVD, you can install SA MP from a mounted DVD directly. On (P - amberg) and (S - achern), check for prerequisites then install SA MP. IBM Software Group Toronto Lab 33 28 August 2007 Run prereqSAM to check prerequisites: # cd <mount point>/DB2_LUW_RDBMS_V9_GA_AIX__HP__SOL/AIX_64/SA_MP/software # ls AIX README docs installSAM licenseAIX prereqSAM uninstallSAM # ./prereqSAM prereqSAM: All prerequisites for the ITSAMP installation are met on operating system: AIX 5300-05 Run installSAM to install SA MP with no license check: # ./installSAM --noliccheck prereqSAM: All prerequisites for the ITSAMP installation are met on operating system: AIX 5300-05 installSAM: Packages will be installed from directory: /net2/julip/Images/DB2_images/DB2_ga/V91/DB2_LUW_RDBMS_V9_GA_AIX__HP__SOL/AIX_6 4/SA_MP/software/AIX installSAM: License file not found. installSAM: The following package is not installed yet and needs to be installed: /net2/julip/Images/DB2_images/DB2_ga/V91/DB2_LUW_RDBMS_V9_GA_AIX__HP__SOL/AIX_6 4/SA_MP/software/AIX/sam.core installSAM: Installing System Automation on platform: AIX installSAM: Installing sam.core etc… Once the software is installed, install the license on (P - amberg) and (S - achern): # samlicm -i sam21.lic # samlicm -s Product ID: 101 Creation date: Thu Jul 7 20:00:00 EDT 2005 Expiration date: Thu Dec 31 18:59:59 EST 2037 4.11 Set up the Cluster The following steps only need to be done on the primary database server (P - amberg). 4.11.1 Download the latest DB2 HA script patch If you are using DB2 V8 or DB2 9 release older than FixPack 3, you need to download the updated DB2 HA scripts from ftp://ftp.software.ibm.com/software/data/db2/linux/db2salinux.tar.gz. Uncompress the file and then replace the files in the current DB2 installation path <db2_install_path>/ha/tsa. IBM Software Group Toronto Lab 34 28 August 2007 amberg:/opt/IBM/db2/V9.1/ha/tsa# ls das_monitor.ksh db2_stop.ksh das_start.ksh getstatus das_stop.ksh hadr_monitor.ksh db2_monitor.ksh hadr_start.ksh db2_start.ksh hadr_stop.ksh mount_monitor.ksh mount_start.ksh mount_stop.ksh regdb2salin reghadrsalin unregdb2salin unreghadrsalin amberg:/opt/IBM/db2/V9.1/ha/tsa# gunzip -c /mnt/julip/users/ha/hadr/db2salinux.tar.gz | tar -xvf x db2 x db2/das_monitor.ksh, 1835 bytes, 4 media blocks. x db2/das_start.ksh, 1719 bytes, 4 media blocks. x db2/das_stop.ksh, 2091 bytes, 5 media blocks. x db2/db2_monitor.ksh, 2754 bytes, 6 media blocks. x db2/db2_start.ksh, 5092 bytes, 10 media blocks. x db2/db2_stop.ksh, 2834 bytes, 6 media blocks. x db2/getstatus, 30528 bytes, 60 media blocks. x db2/hadr_monitor.ksh, 7739 bytes, 16 media blocks. x db2/hadr_start.ksh, 10318 bytes, 21 media blocks. x db2/hadr_stop.ksh, 4527 bytes, 9 media blocks. x db2/mount_monitor.ksh, 3010 bytes, 6 media blocks. x db2/mount_start.ksh, 3128 bytes, 7 media blocks. x db2/mount_stop.ksh, 3216 bytes, 7 media blocks. x db2/regdb2salin, 38430 bytes, 76 media blocks. x db2/reghadrsalin, 16295 bytes, 32 media blocks. x db2/unregdb2salin, 7693 bytes, 16 media blocks. x db2/unreghadrsalin, 3607 bytes, 8 media blocks. amberg:/opt/IBM/db2/V9.1/ha/tsa# mv db2/* . 4.11.2 Copy the Setup Files and Scripts to a Local Directory The SA MP software is bundled with DB2 9 DVD images and you can find the SA MP Installation script in the following directory on the DVD: /<platform>/SA_MP/scripts/ You should also check SAP Note 960843 and 930487 to download the newer version of the script and the installation guide. Before you set up the cluster, you have to log on as root user, and copy all files located in this directory to a local directory, for example, /samp_setup, as follows: amberg:/home/isisroot# mkdir samp_setup amberg:/home/isisroot# cp /mnt/julip/Images/DB2_images/DB2_ga/V91/DB2_LUW_RDBMS_V9_GA_AIX__HP__SOL/AIX_64 /SA_MP/scripts/* samp_setup 4.11.3 Creating File sapdb2policy.conf Run the sapdb2gen.sh command to create the sapdb2policy.conf file. IBM Software Group Toronto Lab 35 28 August 2007 amberg:/home/isisroot# cd samp_setup amberg:/home/isisroot/samp_setup/samp# ./sapdb2gen.sh ############################################################################### # Generating SAP DB2 cluster configuration file # ############################################################################### Enter the type of the cluster: SAMP (only) / HADR (with samp) [TSA_CLUSTER_TYPE] (default: SAMP) : HADR Enter the shell command for remote command execution (ssh/rsh) [TSA_REMOTE_CMD] (default: rsh) : rsh Enter the SAP System ID [SAP_SID] : AHA Enter the hostnames of the cluster separated by a comma (e.g.: db2_sa_mp1,db2_sa_mp2) [TSA_HOSTNAME_LIST] : amberg,achern Enter the virtual hostname of the cluster [DB2_HA_HOSTNAME] : sapaaa These physical network interfaces were found on node amberg: Device IP Address Mask ------------------------------------------------------en0 9.26.4.92 255.255.254.0 Enter the comma separated list of network interfaces for node amberg (e.g.: eth0,eth1) [DB2_NETWORK_INTERFACE_LIST] (detected: en0) : en0 These physical network interfaces were found on node achern: Device IP Address Mask ------------------------------------------------------en0 9.26.4.94 255.255.254.0 Enter the comma separated list of network interfaces for node achern (e.g.: eth0,eth1) [DB2_NETWORK_INTERFACE_LIST] (detected: en0) : en0 Enter the tie breaker IP address [TSA_TIEBREAKER_IP_ADDRESS] (detected: 9.26.4.1) : 9.26.4.1 Enter the location of the downloaded SA MP license file [TSA_LICENSE_FILE] (default: /home/root/sam21.lic) : /mnt/julip/Images/DB2_images/licenses/V91/sam21.lic Enter the installation directory of DB2 software [DB2_INST_DIR] (detected: /usr/opt/db2_08_01) : /opt/IBM/db2/V9.1FP3 Enter the name of the TSA operators group: [TSA_USER_GROUP_NAME] (default: sagrp) : Enter the id of the TSA operators group: [TSA_USER_GROUP_ID] (default: 222) : 223 Enter the HADR synchronisation mode (expected values: SYNC, NEARSYNC or ASYNC) [DB2_HADR_SYNC_MODE] (default: NEARSYNC) : Generation finished successfully! Note: by default the script will choose the gateway IP address as the network tiebreaker for SA MP cluster. 4.11.4 Setting up the Cluster Using sapdb2policy.sh IBM Software Group Toronto Lab 36 28 August 2007 Run the sapdb2policy.sh command to set up the SA MP cluster. This command takes the input file sapdb2policy.conf created in the previous section. The following is the sample run log. amberg:/home/isisroot/samp_setup/db2# ./sapdb2policy.sh -f sapdb2policy.conf -create ./sapdb2policy.sh -create version 2.00 started on ... Tue Jul 10 11:25:02 EDT 2007 Setup Type: SA MP with HADR The following SAM license is installed on node amberg: Product ID: 101 Creation date: Thu Jul 7 20:00:00 EDT 2005 Expiration date: Thu Dec 31 18:59:59 EST 2037 The following SAM license is installed on node achern: Product ID: 101 Creation date: Thu Jul 7 20:00:00 EDT 2005 Expiration date: Thu Dec 31 18:59:59 EST 2037 Create domain sap_ahadb2 on nodes amberg achern On host amberg execute with rsh command: /usr/bin/preprpnode amberg achern On host achern execute with rsh command: /usr/bin/preprpnode amberg achern mkrpdomain sap_ahadb2 amberg achern RC=0 Start domain sap_ahadb2 startrpdomain sap_ahadb2 RC=0 List Domain: Name OpState RSCTActiveVersion MixedVersions TSPort GSPort sap_ahadb2 Online 2.4.6.2 No 12347 12348 List Nodes: Name OpState RSCTVersion achern Online 2.4.6.2 amberg Online 2.4.6.2 Create and activate the network TieBreaker for IP address 9.26.4.1 mkrsrc IBM.TieBreaker Name="nettb" Type="EXEC" DeviceInfo="PATHNAME=/usr/sbin/rsct/bin/samtb_net Address=9.26.4.1 Log=1" PostReserveWaitTime=30 RC=0 chrsrc -c IBM.PeerNode OpQuorumTieBreaker="nettb" RC=0 Activated TieBreaker for IP address 9.26.4.1 cd /opt/IBM/db2/V9.1FP3/ha/tsa/; ./regdb2salin -a db2aha -d Not a terminal Not a terminal Distributing policy to node achern via rsh... Distributing policy to node amberg via rsh... RC=0 Checking DB2_USER_LIST and DB2_GROUP_LIST on all nodes. Checking TSA_USER_LIST on all nodes. Change group owner to sagrp for RSCT trace files on node amberg. Change group owner to sagrp for RSCT trace files on node achern. Create dynamic DB2 equivalency virpubnic mkequ -D "Name='en0' && NodeNameList={'amberg'} || Name='en0' && NodeNameList={'achern'}" virpubnic IBM.NetworkInterface RC=0 Calling post setup script. ./sapdb2post.sh -create IBM Software Group Toronto Lab 37 28 August 2007 ./sapdb2post.sh -create version 2.00 started on ... Tue Jul 10 11:26:33 EDT 2007 INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /db2/db2aha/.dbenv_amberg.sh to 1 on node amberg! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /db2/db2aha/.dbenv_amberg.csh to 1 on node amberg! INFO: Successfully updated environment variable CT_MANAGEMENT_SCOPE /db2/db2aha/.dbenv_amberg.sh to 2 on node amberg! INFO: Successfully updated environment variable CT_MANAGEMENT_SCOPE /db2/db2aha/.dbenv_amberg.csh to 2 on node amberg! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /db2/db2aha/.dbenv_achern.sh to 1 on node achern! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /db2/db2aha/.dbenv_achern.csh to 1 on node achern! INFO: Successfully updated environment variable CT_MANAGEMENT_SCOPE /db2/db2aha/.dbenv_achern.sh to 2 on node achern! INFO: Successfully updated environment variable CT_MANAGEMENT_SCOPE /db2/db2aha/.dbenv_achern.csh to 2 on node achern! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /home/ahaadm/.dbenv_amberg.sh to 1 on node amberg! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /home/ahaadm/.dbenv_amberg.csh to 1 on node amberg! INFO: Successfully updated environment variable CT_MANAGEMENT_SCOPE /home/ahaadm/.dbenv_amberg.sh to 2 on node amberg! INFO: Successfully updated environment variable CT_MANAGEMENT_SCOPE /home/ahaadm/.dbenv_amberg.csh to 2 on node amberg! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /home/ahaadm/.dbenv_achern.sh to 1 on node achern! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /home/ahaadm/.dbenv_achern.csh to 1 on node achern! INFO: Successfully updated environment variable CT_MANAGEMENT_SCOPE /home/ahaadm/.dbenv_achern.sh to 2 on node achern! INFO: Successfully updated environment variable CT_MANAGEMENT_SCOPE /home/ahaadm/.dbenv_achern.csh to 2 on node achern! Copied Copied Copied Copied Copied Copied in file in file in file in file in file in file in file in file in file in file in file in file in file in file in file in file ./startdb to /sapmnt/AHA/exe/startdb on node amberg successfully. ./startdb to /sapmnt/AHA/exe/startdb on node achern successfully. ./stopdb to /sapmnt/AHA/exe/stopdb on node amberg successfully. ./stopdb to /sapmnt/AHA/exe/stopdb on node achern successfully. ./sampdbcmd to /sapmnt/AHA/exe/sampdbcmd on node amberg successfully. ./sampdbcmd to /sapmnt/AHA/exe/sampdbcmd on node achern successfully. startdb/stopdb replaced successfully! Copied Copied Copied Copied Copied Copied ./startj2eedb to /sapmnt/AHA/exe/startj2eedb on node amberg successfully. ./startj2eedb to /sapmnt/AHA/exe/startj2eedb on node achern successfully. ./stopj2eedb to /sapmnt/AHA/exe/stopj2eedb on node amberg successfully. ./stopj2eedb to /sapmnt/AHA/exe/stopj2eedb on node achern successfully. ./sampdbcmd to /sapmnt/AHA/exe/sampdbcmd on node amberg successfully. ./sampdbcmd to /sapmnt/AHA/exe/sampdbcmd on node achern successfully. startj2eedb/stopj2eedb replaced successfully! Database virtual hostname or virtual IP address successfully updated in SAP profile /sapmnt/AHA/profile/DEFAULT.PFL. Post Installation completed successfully. ./sapdb2post.sh -create finished on ... Tue Jul 10 11:27:39 EDT 2007 RC=0 Create resource group for DB2 instance db2aha on node amberg Distributing policy to node achern via rsh... About to register db2aha with TSA Checking cluster validity... Stopping instance db2aha... IBM Software Group Toronto Lab 38 28 August 2007 Checking resources able to host instance db2aha (partition 0) Checking amberg ... Making resource group db2_db2aha_amberg_0-rg ... Making DB2 resource db2_db2aha_amberg_0-rs ... Online resource group db2_db2aha_amberg_0-rg ... db2_db2aha_amberg_0-rg is now online Done, instance is now HA RC=0 Create resource group for DB2 instance db2aha on node achern Distributing policy to node amberg via rsh... About to register db2aha with TSA Checking cluster validity... Stopping instance db2aha... Checking resources able to host instance db2aha (partition 0) Checking achern ... Making resource group db2_db2aha_achern_0-rg ... Making DB2 resource db2_db2aha_achern_0-rs ... Online resource group db2_db2aha_achern_0-rg ... db2_db2aha_achern_0-rg is now online Done, instance is now HA RC=0 Start database servers: Database server on node amberg already started! Database server on node achern already started! Checking Database Roles ... Primary Server: amberg Standby Server: achern Activate databases: Activated database AHA on node achern! Activated database AHA on node amberg! Wait for HADR cluster to become Peer state HADR cluster is in Peer state. cd /usr/sbin/rsct/sapolicies/db2/; ./reghadrsalin -a db2aha -b db2aha -d aha -i 9.26.4.134 -n 255.255.254.0 Not a terminal Not a terminal About to register db2hadr_aha with TSA ... Creating HADR resource group ... Making resource group db2hadr_aha-rg ... Making resource db2hadr_aha-rs ... Making IP resource db2hadr_aha-rs_ip ... Online resource group db2hadr_aha-rg ... Done, HADR is now registered with the TSA framework RC=0 Setup completed successfully. ./sapdb2policy.sh -create finished on ... Tue Jul 10 11:30:01 EDT 2007 Once the cluster setup is completed successfully, you can check the status of cluster resources using command “lssam”: IBM Software Group Toronto Lab 39 28 August 2007 amberg:/home/isisroot/samp_setup/db2# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Online IBM.Application:db2hadr_aha-rs:achern '- Offline IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Online IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:amberg The lssam output above indicates that both db2aha instance on amberg and achern are up and running (online). Under the HADR resource group db2hadr_aha-rg, the resource db2hadr_aha-rs and db2hadr_ahars_ip are online on achern, which means the HADR primary database resides on achern and therefore the virtual IP address of the database server is also assigned to achern. 4.12 Enable SAP with Virtual Database Host Name and IP Address In this section, we will validate the HA failover using virtual IP address. Note: if you have multiple NIC on a single host, you should use Linux Bonding driver or AIX EtherChannel to create a single interface. Consult the following document for detail: For AIX EtherChannel http://www-03.ibm.com/support/techdocs/atsmastr.nsf/WebIndex/TD101260 For Linux Bonding http://linux-net.osdl.org/index.php/Bonding IBM Software Group Toronto Lab 40 28 August 2007 4.12.1 Change the default profile This step is already done by sapdb2policy.sh in step 4.11.4. On (C - altena), the host name “SAPDBHOST” and “j2ee/dbhost” in the default profile are replaced with the virtual host name. In this example, the virtual host name is “sapaaa”. altena:ahaadm 4> pwd /sapmnt/AHA/profile altena:ahaadm 5> cat DEFAULT.PFL SAPSYSTEMNAME = AHA SAPGLOBALHOST = altena #----------------------------------------------------------------------# SAP Central Service Instance for J2EE #----------------------------------------------------------------------j2ee/scs/host = altena j2ee/scs/system = 02 j2ee/ms/port = 3902 login/system_client = 001 #SAPDBHOST = achern SAPDBHOST = sapaaa j2ee/dbtype = db6 j2ee/dbname = AHA #j2ee/dbhost = achern j2ee/dbhost = sapaaa IBM Software Group Toronto Lab 41 28 August 2007 4.12.2 Change node directory entry on all SAP instances We need to uncatalog and recatalog the TCPIP node with the virtual host name on all SAP application servers. altena:db2aha 4> db2 uncatalog node NODEAHA DB20000I The UNCATALOG NODE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. altena:db2aha 5> db2 catalog tcpip node NODEAHA remote sapaaa server sapdb2AHA DB20000I The CATALOG TCPIP NODE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. altena:db2aha 45> db2 list node directory Node Directory Number of entries in the directory = 1 Node 1 entry: Node name Comment Directory entry type Protocol Hostname Service name = = = = = = NODEAHA LOCAL TCPIP sapaaa sapdb2AHA altena:db2aha 48> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias Database name Node name Database release level Comment Directory entry type Catalog database partition number Alternate server hostname Alternate server port number = = = = = = = = = AHA AHA NODEAHA b.00 Remote database AHA Remote -1 altena:db2aha 46> db2 connect to aha user sapaha Enter current password for sapaha: Database Connection Information Database server SQL authorization ID Local database alias altena:db2aha 47> = DB2/AIX64 9.1.0 = SAPAHA = AHA db2 "select * from svers" VERSION ------------------------------------------------------------------------------700 1 record(s) selected. IBM Software Group Toronto Lab 42 28 August 2007 4.12.3 Change the JDBC URL If you are running a SAP Java server, you need to change the database JDBC URL by replace the database hostname with the virtual database host name or IP address. altena:ahaadm 52> pwd /usr/sap/AHA/DVEBMGS03/j2ee/configtool altena:ahaadm 54> ./configtool.sh Figure 10 Use virtual host name or IP address in JDBC URL In this case, the original database host name “amberg” is replaced with the virtual host name “sapaaa”. Save the change and restart the Java instance. IBM Software Group Toronto Lab 43 28 August 2007 5. Running SAP with HADR and SA MP Now that we have finished the setup for SAP, HADR and SA MP, we will verify the setup prior to running some testing. 5.1 Verify the setup prior to testing On (P - amberg), get the SA MP status to confirm that HADR is online (role = primary): amberg:/home/isisroot/samp_setup/db2# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Offline IBM.Application:db2hadr_aha-rs:achern '- Online IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Online IBM.ServiceIP:db2hadr_aha-rs_ip:amberg Since (P – amberg) is online, the virtual IP address is assigned to NIC on (P - amberg): amberg:/home/isisroot# ifconfig -a en0: flags=4e080863,80<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64B IT,PSEG,CHAIN> inet 9.26.4.92 netmask 0xfffffe00 broadcast 9.26.5.255 inet 9.26.4.134 netmask 0xfffffe00 broadcast 9.26.5.255 etc... On (P - amberg), db2pd output shows its HADR role is Primary and state is Peer: amberg:db2aha 76> db2pd -hadr -d aha Database Partition 0 -- Database AHP -- Active -- Up 0 days 01:21:23 HADR Information: Role State Primary Peer SyncMode HeartBeatsMissed Sync 0 LogGapRunAvg (bytes) 0 ConnectStatus ConnectTime Timeout Connected Thu Dec 21 09:46:15 2006 (1166712375) 120 LocalHost amberg LocalService AHA_HADR_1 RemoteHost achern etc... RemoteService AHA_HADR_2 IBM Software Group Toronto Lab 44 RemoteInstance DB2AHA 28 August 2007 On (C - altena), start SAP if it is not done yet: altena:ahaadm 15> startsap Checking db Database -----------------------------ABAP Database is running Starting SAP-Collector Daemon -----------------------------*********************************************************************** * This is Saposcol Version COLL 20.89 700 - AIX v6.35 5L-64 bit 051206 * Usage: saposcol -l: Start OS Collector * saposcol -k: Stop OS Collector * saposcol -d: OS Collector Dialog Mode * saposcol -s: OS Collector Status * The OS Collector (PID 144140) is already running ..... ************************************************************************ saposcol already running Starting SAP Instance SCS02 -----------------------------Startup-Log is written to /home/ahaadm/startsap_SCS02.log Instance Service on host altena started Instance on host altena started Starting SAP Instance DVEBMGS03 -----------------------------Startup-Log is written to /home/ahaadm/startsap_DVEBMGS03.log Instance Service on host altena started Instance on host altena started On (P - amberg), we can get a list the DB2 applications started by SAP: amberg:db2aha 109> db2 list applications Auth Id -------SAPAHADB SAPAHADB SAPAHADB SAPAHADB SAPAHADB SAPAHA SAPAHA SAPAHA SAPAHA SAPAHA Application Name -------------db2jcc_applica db2jcc_applica db2jcc_applica db2jcc_applica db2jcc_applica disp+work disp+work disp+work disp+work disp+work Appl. Handle ---------148 147 146 145 144 135 134 132 133 131 Application Id DB # of Name Agents ---------------------------------------------------- -------- ----9.26.53.33.50207.061221190937 AHA 1 9.26.53.33.50206.061221190936 AHA 1 9.26.53.33.50201.061221190917 AHA 1 9.26.53.33.50196.061221190911 AHA 1 9.26.53.33.50194.061221190908 AHA 1 9.26.53.33.50158.061221190823 AHA 1 9.26.53.33.50157.061221190823 AHA 1 9.26.53.33.50154.061221190823 AHA 1 9.26.53.33.50156.061221190823 AHA 1 9.26.53.33.50155.061221190823 AHA 1 On SAP GUI, we see the DB Server field shows the virtual host name sapaaa: IBM Software Group Toronto Lab 45 28 August 2007 Figure 11 DB Server field shows the virtual host name IBM Software Group Toronto Lab 46 28 August 2007 The Java stack also shows the virtual host name sapaaa: Figure 12 The Host field shows virtual host name 5.2 Controlled Failover Test In this test, we will invoke the SA MP “rgreq -o move” command to switch the role of HADR primary and standby databases. On (P - amberg), run the following command to move the primary role on (P - amberg) to (S - achern) (ignore the returned token in the returned message): amberg:/home/isisroot/samp_setup/db2# rgreq -o move -n amberg db2hadr_aha-rg Action on resource group "db2hadr_aha-rg" returned Token "0x00000020000000000000000020c3caa0" . IBM Software Group Toronto Lab 47 28 August 2007 On (P - amberg) or (S - achern), after the role is switched, the “lssam” command shows that now (P amberg) is offline and (S - achern) is online: amberg:/home/isisroot/samp_setup/db2# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Online IBM.Application:db2hadr_aha-rs:achern '- Offline IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Online IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:amberg On (P - amberg), the db2pd command confirms that its HADR role is now Standby: amberg:db2aha 126> db2pd -hadr -d aha Database Partition 0 -- Database AHP -- Active -- Up 0 days 05:05:55 HADR Information: Role State Standby Peer SyncMode HeartBeatsMissed Sync 0 LogGapRunAvg (bytes) 1323 ConnectStatus ConnectTime Timeout Connected Thu Dec 21 09:46:15 2006 (1166712375) 120 LocalHost amberg LocalService AHA_HADR_1 RemoteHost achern RemoteService AHA_HADR_2 PrimaryFile PrimaryPg S0000016.LOG 16128 PrimaryLSN 0x000000025D8A8A4F StandByFile StandByPg S0000016.LOG 16128 StandByLSN 0x000000025D8A8A4F RemoteInstance DB2AHA On (P - amberg), the output of “list application” also confirms that it is HADR Standby database: amberg:db2aha 128> db2 list applications Auth Id Application Name -------- -------------db2replay Appl. Application Id Handle ---------- ---------------------------------------------------196 *LOCAL.DB2.061221194553 DB # of Name Agents -------- ----AHA 1 On (S - achern), the output of ifconfig command shows that the virtual IP address is now assigned to NIC on (S - achern): achern:db2aha 77> ifconfig -a en0: flags=4e080863,80<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG,CHAIN> inet 9.26.4.94 netmask 0xfffffe00 broadcast 9.26.5.255 inet 9.26.4.134 netmask 0xfffffe00 broadcast 9.26.5.255 etc... IBM Software Group Toronto Lab 48 28 August 2007 On (S - achern), the output of “list application” command also shows that its role is HADR Primary database: achern:db2aha 78> db2 list applications Auth Id Application Name -------- -------------SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHADB db2jcc_applica Appl. Handle ---------159 162 161 157 160 158 156 154 152 155 Application Id DB # of Name Agents ---------------------------------------------------- -------- ----9.26.53.33.50434.061221194843 AHA 1 9.26.53.33.50437.061221194843 AHA 1 9.26.53.33.50436.061221194843 AHA 1 9.26.53.33.50432.061221194843 AHA 1 9.26.53.33.50435.061221194843 AHA 1 9.26.53.33.50433.061221194843 AHA 1 9.26.53.33.50427.061221194743 AHA 1 9.26.53.33.50422.061221194723 AHA 1 9.26.53.33.50418.061221194643 AHA 1 9.26.53.33.50426.061221194738 AHA 1 By now you should be able to continue to work on the SAP GUI or to access SAP Java server without any disruption. IBM Software Group Toronto Lab 49 28 August 2007 The following window shows the contents of db2diag.log where it shows: • • • Standby has completed takeover (now primary). Standby Finished. Primary Started. Figure 13 Standby database takes over to become Primary database 5.3 Instance Failure Test In this test, we will use the db2_kill command to kill the DB2 instance on primary. SA MP will detect that the primary server is down and attempt to bring it up again. On (S - achern), use the db2_kill command to kill the DB2 instance: achern:db2aha 22> db2_kill ipclean: Removing DB2 engine and client's IPC resources for db2aha. achern:db2aha 24> db2 list applications SQL1032N No start database manager command was issued. SQLSTATE=57019 IBM Software Group Toronto Lab 50 28 August 2007 On (S - achern), keep running the db2pd command to check HADR status. Initially, HARD is down just after the db2_kill command was invoked: achern:db2aha 92> db2pd -hadr -d aha Database Partition 0 -- Database AHP -- Active -- Up 0 days 00:00:01 HADR Information: HADR is not active. Within a minute, DB2 instance is started and HADR is activated and its state changes to LocalCatchup: achern:db2aha 94> db2pd -hadr -d aha Database Partition 0 -- Database AHP -- Active -- Up 0 days 00:00:05 HADR Information: Role State Primary LocalCatchup SyncMode HeartBeatsMissed Sync 0 LogGapRunAvg (bytes) 0 ConnectStatus ConnectTime Timeout Connected Thu Dec 21 15:33:10 2006 (1166733190) 120 LocalHost achern LocalService AHA_HADR_2 RemoteHost amberg RemoteService AHA_HADR_1 PrimaryFile PrimaryPg S0000016.LOG 16242 PrimaryLSN 0x000000025D91A5ED StandByFile StandByPg S0000016.LOG 16242 StandByLSN 0x000000025D91A5ED RemoteInstance DB2AHA Later on, HADR state is changed to Peer: achern:db2aha 96> db2pd -hadr -d aha Database Partition 0 -- Database AHP -- Active -- Up 0 days 00:00:14 HADR Information: Role State Primary Peer SyncMode HeartBeatsMissed Sync 0 LogGapRunAvg (bytes) 0 ConnectStatus ConnectTime Timeout Connected Thu Dec 21 15:33:10 2006 (1166733190) 120 LocalHost achern LocalService AHA_HADR_2 RemoteHost amberg RemoteService AHA_HADR_1 PrimaryFile PrimaryPg S0000016.LOG 16242 PrimaryLSN 0x000000025D91A5ED StandByFile StandByPg S0000016.LOG 16242 StandByLSN 0x000000025D91A5ED IBM Software Group Toronto Lab 51 RemoteInstance DB2AHA 28 August 2007 The output of “list application” also confirms that HADR Primary database is now back up on (S - achern): achern:db2aha 99> db2 list applications Auth Id Application Name -------- -------------SAPAHADB db2jcc_applica SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work DB2AHA db2taskd DB2AHA db2stmm Appl. Handle ---------16 14 13 12 10 9 Application Id DB # of Name Agents ---------------------------------------------------- -------- ----9.26.53.33.50672.061221203423 AHA 1 9.26.53.33.50668.061221203343 AHA 1 9.26.53.33.50667.061221203343 AHA 1 9.26.53.33.50666.061221203343 AHA 1 *LOCAL.DB2.061221203311 AHA 1 *LOCAL.DB2.061221203310 AHA 1 The following SA MP status shows the status of “db2_db2aha_achern” resource was changed to “Offline” after the instance was killed, and was turned back “Online” by SA MP. amberg:/home/isisroot/samp_setup/db2# lssam Pending online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Offline IBM.Application:db2_db2aha_achern_0-rs '- Offline IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Unknown IBM.Application:db2hadr_aha-rs |- Unknown IBM.Application:db2hadr_aha-rs:achern '- Offline IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Online IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:amberg amberg:/home/isisroot/samp_setup/db2# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Online IBM.Application:db2hadr_aha-rs:achern '- Offline IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Online IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:amberg By now you should be able to continue to work on the SAP GUI or to access SAP Java server without any disruption. 5.4 Node Failure Test In this test, we use the “shutdown –Fr now” command to simulate a hardware failure. IBM Software Group Toronto Lab 52 28 August 2007 Current SA MP status shows that the current HADR primary server is on (S - achern): amberg:/home/isisroot# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Online IBM.Application:db2hadr_aha-rs:achern '- Offline IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Online IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:amberg Now shutdown the server (S - achern) with option force and reboot now: achern:/home/isisroot# shutdown -Fr now SHUTDOWN PROGRAM Thu Dec 21 16:02:15 EST 2006 File /usr/sap/sapservices not found. 0513-044 The sshd Subsystem was requested to stop. Wait for 'Rebooting...' before stopping. Error reporting has stopped. etc... On (P - amberg), run “lssam” several times until you see the status of db2hadr_aha-rs on (P – amberg) changes from offline to online: amberg:/home/isisroot# lssam Failed offline IBM.ResourceGroup:db2_db2aha_achern_0-rg Control=StartInhibited Nominal=Online '- Failed offline IBM.Application:db2_db2aha_achern_0-rs '- Failed offline IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Request=Lock Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Failed offline IBM.Application:db2hadr_aha-rs:achern '- Online IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Failed offline IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Online IBM.ServiceIP:db2hadr_aha-rs_ip:amberg IBM Software Group Toronto Lab 53 28 August 2007 On (P - amberg), the db2pd command shows that its HADR role is now Primary. But its state is Disconnected (Standby is down): amberg:db2aha 130> db2pd -hadr -d aha Database Partition 0 -- Database AHP -- Active -- Up 0 days 06:21:42 HADR Information: Role State Primary Disconnected SyncMode HeartBeatsMissed Sync 0 LogGapRunAvg (bytes) 0 ConnectStatus ConnectTime Timeout Disconnected Thu Dec 21 16:03:45 2006 (1166735025) 120 LocalHost amberg LocalService AHA_HADR_1 RemoteHost achern RemoteService AHA_HADR_2 PrimaryFile PrimaryPg S0000016.LOG 16309 PrimaryLSN 0x000000025D95DF4D StandByFile StandByPg S0000000.LOG 0 StandByLSN 0x0000000000000000 RemoteInstance DB2AHA On (P - amberg), the virtual IP address is now assigned to NIC on (P - amberg): amberg:db2aha 132> ifconfig -a en0: flags=4e080863,80<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG,CHAIN> inet 9.26.4.92 netmask 0xfffffe00 broadcast 9.26.5.255 inet 9.26.4.134 netmask 0xfffffe00 broadcast 9.26.5.255 etc... On (P - amberg), the “list application” command shows that it is Primary database: amberg:db2aha 131> db2 list applications Auth Id Application Name -------- -------------SAPAHADB db2jcc_applica SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work SAPAHA disp+work Appl. Handle ---------224 223 221 220 218 222 219 217 216 215 Application Id DB # of Name Agents ---------------------------------------------------- -------- ----9.26.53.33.50845.061221210437 AHA 1 9.26.53.33.50840.061221210353 AHA 1 9.26.53.33.50838.061221210353 AHA 1 9.26.53.33.50837.061221210353 AHA 1 9.26.53.33.50835.061221210353 AHA 1 9.26.53.33.50839.061221210353 AHA 1 9.26.53.33.50836.061221210353 AHA 1 9.26.53.33.50834.061221210353 AHA 1 9.26.53.33.50833.061221210353 AHA 1 9.26.53.33.50832.061221210352 AHA 1 By now you should be able to continue to work on the SAP GUI or to access SAP Java server without any disruption. Since we shutdown (S - achern) with option reboot, after a few minutes, (S - achern) will be up again, and SA MP will restart the database and HADR on (S – achern). IBM Software Group Toronto Lab 54 28 August 2007 On (P - amberg) the lssam command now shows that both (P - amberg) and (S - achern) are up. But the HADR resource db2hadr_aha-rs is online on (P - amberg) and offline on (S - achern), which means the primary database is switched to (P – amberg) and the HADR state is back to Peer. amberg:/home/isisroot# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Offline IBM.Application:db2hadr_aha-rs:achern '- Online IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Online IBM.ServiceIP:db2hadr_aha-rs_ip:amberg amberg:db2aha 50> db2pd -hadr -d aha Database Partition 0 -- Database AHP -- Active -- Up 0 days 04:21:32 HADR Information: Role State Primary Peer SyncMode HeartBeatsMissed Sync 0 LogGapRunAvg (bytes) 1917 ConnectStatus ConnectTime Timeout Connected Tue Jun 5 15:55:06 2007 (1181073306) 120 LocalHost amberg LocalService AHA_HADR_1 RemoteHost achern RemoteService AHA_HADR_2 PrimaryFile PrimaryPg S0000065.LOG 12694 PrimaryLSN 0x000000023CAB63DE StandByFile StandByPg S0000065.LOG 12694 StandByLSN 0x000000023CAB6396 RemoteInstance db2aha 5.5 Miscellaneous Operations in SA MP environment 5.5.1 To display the cluster nodes status amberg:/home/isisroot# lsrpnode Name OpState RSCTVersion amberg Online 2.4.6.2 achern Online 2.4.6.2 5.5.2 To display the cluster domain status amberg:/home/isisroot# lsrpdomain Name OpState RSCTActiveVersion MixedVersions TSPort GSPort sap_ahadb2 Online 2.4.6.2 No 12347 12348 IBM Software Group Toronto Lab 55 28 August 2007 5.5.3 To display the cluster resource group status amberg:/home/isisroot# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Offline IBM.Application:db2hadr_aha-rs:achern '- Online IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Online IBM.ServiceIP:db2hadr_aha-rs_ip:amberg 5.5.4 To start or stop DB2 instance manually Since SA MP monitors DB2 you cannot start or stop DB2 using the DB2 commands db2start or db2stop. In order to start or stop DB2 instance on (P – amberg), you need to take the instance resource group on (P – amberg) online or offline. To start DB2 instance on (P – amberg): amberg:/home/isisroot# chrg -o online db2_db2aha_amberg_0-rg To stop DB2 instance on (P – amberg): amberg:/home/isisroot# chrg -o offline db2_db2aha_amberg_0-rg 5.5.5 To switch HADR role (controlled failover) Since SA MP monitors DB2 you cannot use “db2 takeover hadr” command to fail over, instead you need to move the HADR resource group from one server to another server. amberg:/home/isisroot/samp_setup/db2# rgreq -o move -n amberg db2hadr_aha-rg Note here the option “-n” points to the host name where the primary database server resides on. 5.5.6 To disable or enable SA MP control Sometimes you might need to disable or enable SA MP control, use the command “samctrl –MT” to disable, and “samctrl –MF” to enable. To disable SA MP control: IBM Software Group Toronto Lab 56 28 August 2007 amberg:/home/isisroot# samctrl –MT amberg:/home/isisroot# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Automation=Manual Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Automation=Manual Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Automation=Manual Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Online IBM.Application:db2hadr_aha-rs:achern '- Offline IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Online IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:amberg Once the SA MP control is disabled, you will notice that the “Automation” property of all the resource groups is set to “Manual”. To enable SA MP control: amberg:/home/isisroot# samctrl -MF amberg:/home/isisroot# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Online IBM.Application:db2hadr_aha-rs:achern '- Offline IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Online IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:amberg 5.5.7 To uninstall cluster To uninstall the cluster and to separate the two nodes, use the sapdb2policy.sh script as the following: 1. Log on to the first node where you initially transferred the SA MP scripts to as user root. 2. If the second node becomes the server where the database is running (that is, the single database server), move directory ~/samp_setup to the other node and log on to the other node as user root. 3. Change to the directory using the following command: cd ~/samp_setup 4. Turn all resources and resource groups offline IBM Software Group Toronto Lab 57 28 August 2007 amberg:/home/isisroot/samp_setup/db2# lssam Online IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_achern_0-rs '- Online IBM.Application:db2_db2aha_achern_0-rs:achern Online IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Online '- Online IBM.Application:db2_db2aha_amberg_0-rs '- Online IBM.Application:db2_db2aha_amberg_0-rs:amberg Online IBM.ResourceGroup:db2hadr_aha-rg Nominal=Online |- Online IBM.Application:db2hadr_aha-rs |- Offline IBM.Application:db2hadr_aha-rs:achern '- Online IBM.Application:db2hadr_aha-rs:amberg '- Online IBM.ServiceIP:db2hadr_aha-rs_ip |- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Online IBM.ServiceIP:db2hadr_aha-rs_ip:amberg amberg:/home/isisroot/samp_setup/db2# chrg -o offline db2hadr_aha-rg amberg:/home/isisroot/samp_setup/db2# chrg -o offline db2_db2aha_achern_0-rg amberg:/home/isisroot/samp_setup/db2# chrg -o offline db2_db2aha_amberg_0-rg amberg:/home/isisroot/samp_setup/db2# lssam Offline IBM.ResourceGroup:db2_db2aha_achern_0-rg Nominal=Offline '- Offline IBM.Application:db2_db2aha_achern_0-rs '- Offline IBM.Application:db2_db2aha_achern_0-rs:achern Offline IBM.ResourceGroup:db2_db2aha_amberg_0-rg Nominal=Offline '- Offline IBM.Application:db2_db2aha_amberg_0-rs '- Offline IBM.Application:db2_db2aha_amberg_0-rs:amberg Offline IBM.ResourceGroup:db2hadr_aha-rg Nominal=Offline |- Offline IBM.Application:db2hadr_aha-rs |- Offline IBM.Application:db2hadr_aha-rs:achern '- Offline IBM.Application:db2hadr_aha-rs:amberg '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip |- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:achern '- Offline IBM.ServiceIP:db2hadr_aha-rs_ip:amberg 5. Delete the DB2 resource groups using the following command: IBM Software Group Toronto Lab 58 28 August 2007 amberg:/home/isisroot/samp_setup/db2# ./sapdb2policy.sh -f sapdb2policy.conf -deleteDB2 ./sapdb2policy.sh -deleteDB2 version 2.00 started on ... Tue Jun 12 12:32:27 EDT 2007 Setup Type: SA MP with HADR This will delete all resources starting with db2_db2aha and db2hadr_aha continue [yes|No]? yes Calling post setup script. ./sapdb2post.sh -delete ./sapdb2post.sh -delete version 2.00 started on ... Tue Jun 12 12:32:42 EDT 2007 INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /db2/db2aha/.dbenv_amberg.sh to 0 on node amberg! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /db2/db2aha/.dbenv_amberg.csh to 0 on node amberg! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /db2/db2aha/.dbenv_achern.sh to 0 on node achern! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /db2/db2aha/.dbenv_achern.csh to 0 on node achern! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /home/ahaadm/.dbenv_amberg.sh to 0 on node amberg! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /home/ahaadm/.dbenv_amberg.csh to 0 on node amberg! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /home/ahaadm/.dbenv_achern.sh to 0 on node achern! INFO: Successfully updated environment variable DB6_SAMP_CONTROLLED /home/ahaadm/.dbenv_achern.csh to 0 on node achern! in file in file in file in file in file in file in file in file Database hostname or IP address successfully restored in SAP profiles. SAP profile updates successfully! Post Installation completed successfully. ./sapdb2post.sh -delete finished on ... Tue Jun 12 12:32:54 EDT 2007 RC=0 cd /usr/sbin/rsct/sapolicies/db2/; ./unreghadrsalin -a aha Stopping all online resource groups managing HADR database aha... Removing all online resources managing HADR database aha... Removing all resource groups managing HADR database aha... Please run getstatus to see current state of cluster RC=0 rsh amberg cd /usr/sbin/rsct/sapolicies/db2/; ./unregdb2salin -a db2aha RC=0 2>&1;echo RC=0 rsh achern cd /usr/sbin/rsct/sapolicies/db2/; ./unregdb2salin -a db2aha RC=0 2>&1;echo RC=0 rmequ -s "Name like 'virpubnic'" RC=0 Setup completed successfully. ./sapdb2policy.sh -deleteDB2 finished on ... Tue Jun 12 12:34:01 EDT 2007 amberg:/home/isisroot/samp_setup/db2# lssam lssam: 2622-541 No resource groups defined or cluster is offline! 6. Delete the cluster using the following command: IBM Software Group Toronto Lab 59 28 August 2007 amberg:/home/isisroot/samp_setup/db2# lsrpdomain Name OpState RSCTActiveVersion MixedVersions TSPort GSPort sap_ahadb2 Online 2.4.6.2 No 12347 12348 amberg:/home/isisroot/samp_setup/db2# lsrpnode Name OpState RSCTVersion achern Online 2.4.6.2 amberg Online 2.4.6.2 amberg:/home/isisroot/samp_setup/db2# ./sapdb2policy.sh -f sapdb2policy.conf deleteCluster ./sapdb2policy.sh -deleteCluster version 2.00 started on ... Tue Jun 12 13:53:16 EDT 2007 Setup Type: SA MP with HADR This will delete the complete cluster sap_ahadb2 continue [yes|No]? yes rmrpdomain sap_ahadb2 RC=0 Setup completed successfully. ./sapdb2policy.sh -deleteCluster finished on ... Tue Jun 12 13:53:47 EDT 2007 amberg:/home/isisroot/samp_setup/db2# lsrpdomain amberg:/home/isisroot/samp_setup/db2# lsrpnode lsrpnode: 2602-021 There are no nodes in the peer domain or an online peer domain does not exist. Once the cluster has been uninstalled and the node where you performed the steps mentioned here is able to run DB2. Since the virtual host name and virtual IP address are no longer valid, you have to replace all references to it with the host name or IP address of the single database server. The sapdb2policy.sh script already updated the references in the SAP profile, the db2cli.ini file, and sapdb2policy.sh restores the SAP startdb/stopdb scripts when you deleted the DB2 resource group. In addition, you have to replace all references listed for manual actions as described in section 4.12. IBM Software Group Toronto Lab 60 28 August 2007 Appendix A. Reference Use DB2 V8.2 High Availability Disaster Recovery (HADR) in an SAP implementation http://www.ibm.com/developerworks/db2/library/techarticle/dm-0508zeng/ Automating DB2 HADR Failover on Linux using Tivoli System Automation for Multiplatforms ftp://ftp.software.ibm.com/software/data/pubs/papers/hadr_tsa.pdf Data Recovery and High Availability Guide and Reference, DB2 Version 9, IBM ftp://ftp.software.ibm.com/ps/products/db2/info/vr9/pdf/letter/en_US/db2hae90.pdf Forum: SAP on DB2 UDB for Unix and Windows (DB6) https://www.sdn.sap.com/irj/sdn/forum?forumID=187 IBM Software Group Toronto Lab 61 28 August 2007