Front cover

Draft Document for Review August 23, 2006 6:37 pm SG24-7323-00

Using IBM DB2 UDB with IBM System Storage N series
Exploiting Flexclone technology Creating a database on IBM N series Utilizing Snapshot and SnapMirror

Alex Osuna Jawahar Lal Roger Sanders Jeremy Brumer

ibm.com/redbooks

Draft Document for Review August 23, 2006 6:37 pm

7323edno.fm

International Technical Support Organization Using IBM DB2 UDB with IBM System Storage N series August 2006

SG24-7323-00

read the information in “Notices” on page vii. . This document created or updated on August 23. 2006 6:37 pm Note: Before using this information and the product it supports.Use. First Edition (August 2006) This edition applies to the IBM System Storage N series and Data ONTAP Version 7. © Copyright International Business Machines Corporation 2006.fm Draft Document for Review August 23. Government Users Restricted Rights -. All rights reserved. Note to U.S. 2006. duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.7323edno.

. . . . . . . . 31 3. . . . . . . . . . . x Chapter 1. . . . . . . . . . . . . . .5 Creating offline copy . . . . . . . . . . . . . . . . . . . . .1 Select the production database server and database . 32 3. . . . . . . . . . . . . . . 19 1.3 Select a non production server without DB2 UDB installed . . . . . . . . . . . . . . . . . . . . . . . . .2 Environment assumptions . . . . .6 The db2relocatedb command . 35 4. . .7 Advantages of cloning a database using N series FlexClone technology . . . . . . . . . . . . . . . . . . . . . . . . . .1 Create a instance . . . . . . . . . . 29 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 Select a database server. . . 24 Chapter 3. . . . . . . . . . . . . . . . . . . . . . .2. .Draft Document for Review August 23. . . . . . . . . . . . 20 Chapter 2.. .3 Change location of transaction logs . . . . . . . . . . . . .1. . . . . . . . 12 1. . .4 Network and storage infrastructure . . . . . . . . . . . . . . . . . 21 2. . . . . . . . Preparation .2 Create the database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . which has a different DB2 UDB version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. . . . . . . . . 13 1. . 2006. . . . . . .2 Overview of the FlexClone technology . . . . . 21 2. . x Comments welcome. . . . . . . .3 Overview of the SnapMirror technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Configuration used for this publication . . . . . . . . . . . .1 General assumptions . . . . . . . . . . . . .1 Purpose and Scope. 35 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .fm Contents Notices . . . . . . . . . . . . 35 4. . . . . . . . . .1. . . . . . . . . . . .2. . . . . . . . . . . . . . . . . . . . . . . 37 4. . . . . . . . . . . Creating a DB2 UDB Database on a IBM N series . . . . . . . . . . . . . . . . 23 2. . . . . . 36 4. . . . . . . . . . . . . . . . All rights reserved. . . . . . . . . . . . . . . . . . . . . . . ix Become a published author . . . . . . . . 37 © Copyright IBM Corp. . . . . . . . . . . . . . . . .2 Clone an offline database on the same storage system . . . 16 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction . ix The team that wrote this redbook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Select a database server to access the cloned database . . . . . . . . . . . . . . . . . . . . . . . . . . . 2006 6:37 pm 7323toc. . . . . . vii Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Bring the source database offline. . . . . . . . . 14 1. . . . . . . . 37 4. . . . . . .5 The db2inidb command. . . . . 37 4. Cloning a DB2 UDB Database in the N series Environment . 32 3. . . . . . . . . . . . . . . . . . . . . . . . . .3 Security and access issues . . . . 11 1. . . . . . . . . . . . . 22 2. . .4 Switch from circular logging to archive logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1. . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Chapter 4. .4 Ensuring consistency for DB2 UDB database (suspended I/O) . . . . . iii . . . . . . . . . . . . . . . . 31 3. . . . . . .2 Create Snapshot copies of the database FlexVol volumes. . . . . . . 15 1. . . . . . . . . . . . . . . . . . . viii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5. . . . . . . . 43 4. . . . . . . . . .4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 Resume normal database operations (resume writes). 70 4. .7 Configuring the cloned database . . . . .7323toc. . . . . . . . . . . . . . . . . . . . .1. 46 4. . . . . . . . . . .6 Create clone volumes using Snapshot copies.2 Create Snapshot copies of the FlexVol volumes. . . . . . 59 4. . . . . . .5 Create NFS export entries for the cloned volumes. . . . . . . . . . . . . . . . . . . . .9 Verify the database.3. . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . .3 Resume normal database operations (resume writes). . .. .2 Create Snapshot copies of the database FlexVol volumes. . . . 69 4. . . . .4 Clone an offline database to a remote storage system . . . . .2 Bring the source database into a consistent state (suspend writes).4. . . 47 4. . . . . .5 Clone an online database to a remote storage system . . . . . . . . . . . . .4.7 Catalog the source database . . . . .6 Mount the cloned volumes. .4. . . . . . . . . . . . . . . . . . . . . . . . . . 77 5.2 Initialize SnapMirror. . . . . . . . 45 4. . . . .5. 67 4. . . 50 4. . . . . . . 52 4. . . . . . . . . .4.3. . . .3. 62 4. . . . . . . . . . 48 4. . . . . . .3. . . . . . 77 5. . . . . . . . . . . .3 Start the source database . .8 Verify the database. . . .2. . . . . .3. .fm Draft Document for Review August 23. . . . . . . . 2006 6:37 pm 4. . . . . . . . . . . . . . . . . . . .5. . . . 48 4. . .6 Mount the clone volumes. . 72 4. . . . . . . . .3. . . . . .8 Mount the cloned volumes. . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 4. . . 75 Chapter 5.5 Mount the clone volumes. . .2. .4 Create NFS export entries for the cloned volumes. . . . . . . . . . . .3. . . . . . . . . . . . . . 77 5. . . . . . . .9 Configure the cloned database . . . . . . . . . .3 Create clones of the FlexVol volumes. . . . . . . . . . . . . . . . . . . . . .2.3 Create Snapshot copies of the FlexVol volumes. .1. . . . .8 Verify the cloned database. Cloning a DB2 UDB Database in the SAN Environment . . . . . . . . . . . . . . . . . . . . . . . . . .68 4. . . . . . . . . . . . . . .2.5 Update the SnapMirror destination. . 78 5. . . . . . . . . . . . . . . . . . . . . .3 Clone an online database on the same storage system . . . . . . . .6 Configure the cloned database. . . . . . . . . . 47 4. 53 4. . . . . . . . . . . . . . . . . . . . . . 78 5. . . . . . . . . . . . . . . . . . . . 66 4. . . . . . . . . . 41 4. . . . . . . . . . . .1 Bring the database into a consistent state (suspend writes). . . . . . . . . . . . . . . . . .2. .5. . . . . . . . . . . . . . . 71 4. . . 63 4. . . . . . . . . . . . 69 4. . . .4. . . 62 4. . . . . . . . . . . 45 4. . . . 38 4. . . . . . . . . . . . . . . . . . . .5. . . . . .10 Verify the cloned database. . . . . . . . . . . . . . . . . . . 70 4. 78 iv Using IBM DB2 UDB with IBM System Storage N series . . . . . . . . . . . . . 68 4.2. . . . .4. . . . . . . 52 4.3.5. . . . . . . . . .2. . . . . . . .7 Create NFS export entries for the cloned volumes. . . . . . .8 Catalog the source database if necessary . . 40 4. . . . . . . . . . . . . . . .1 Configure and initialize SnapMirror.5. . . . . . . . . . . . . . . 56 4. . . . . . . . . . . . . . . . .1 Bring the source database offline. . . .4 Clone the FlexVol volumes. . .5. . . . . . . .5. . . . . . . .3 Start the source database . . . . . . . . . . . . . . . . . .1 Clone an offline database on the same storage system . . . . . .1 Configure SnapMirror. . . . . . . . . . . . .4. . .5. . . . . . . . . . . . . . . . . . . . . . . . . 46 4. . . . 46 4. .1. . . . . . . . . . .7 Configuring the cloned database . . . . . . . . . .5 Create an export entry for the clone volume. .1.4 Clone the FlexVol volumes. . . .4 Create clone volumes using Snapshot copies. . . 38 4. . . . 67 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .

. .5 Conclusions. .4 Rename the clone database . .5 Create FlexClone volumes using Snapshot copies. . . . 102 5. . . . . . . .6 Mount the FlexClone volume LUNs. .2 Bring the database offline. . . . . . . . . . . . . . . . .4 Clone an online database to a remote storage system . . . . . . . . . .3.3 Clone an offline database to a remote storage system . . . . . . . . . . . . . . . . . . . . . . .4.3 Changing Ownership . .7 Mount the FlexClone volume LUNs. . 95 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 Create new mapping for LUNs that reside on the clone volumes. . .1. . . . . . . 93 5. . . . . . . . . . . . . . 102 5. . . . . . . . . . 97 5. . . . . . . . . . . . . . . .5 Create new mapping for the LUNs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.3 Resume normal database operation (resume writes). . 86 5. . . . . . . . 93 5. 104 5. . . . . . . .4. . . . . . . . .9 Configure the cloned database. . .1. . . . . . . .2. . . . . . . . . . . . . . . . . . . . . .4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Create new mapping for LUNs that reside on the clone volumes. 101 5. . . . . . .6 db2relocatedb command . . . . . . . . . . . . . 94 5. . . .2. 112 A. . . . . . . . . . . . . . . . . . . .7 Configure the cloned database. . . .2 Create Snapshot copies of the FlexVol volumes. . . . . . . . . . . . . . . . . . 86 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 5. .3. . . 88 5. 83 5. . . . . 102 5. . . . . . . . . . . 107 5. . . . 106 5. . . . . .4 Update the SnapMirror destination volumes. . . . . .3. . . 114 A. . . . . . . . . . . . . .4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 5. . . .4. . . . . . 113 A. . . . . .4 Resume normal operations for the database (resume writes). .4. . . . . . . .4. . . . . . . . . . . . . . . . . . . 110 Appendix A. . . .Draft Document for Review August 23. . 115 Appendix B. .fm 5.5 Create new mapping for the LUNs. . . . . . . . . 92 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 A. . . . . 101 5. 98 5. . . . . . . . . . . . . . . . . . . . 113 A. . . . . . . . . . . . . . .3. . . . . .6 Create clone volumes using Snapshot copies. .2 Clone an online database on the same storage system . .2 Define mount options . . . . . .2. . . . 90 5. . . . . . . . . . . .1 Bring the source database into a consistent state (suspend writes). . . . .3 Create Snapshot copies . . . . . . . . . . . . . . 101 5. . . .3 Create Snapshot copies of the FlexVol volumes. . . . . . . . 79 5. . 93 5. . . . . .3. . . . . . . . . . . . . . .4. . .5 Checking whether Database is cataloged. . . . . . . . . . . . .1 Configure and initialize SnapMirror. . . . . . 87 5. . . .4 Clone the FlexVol volumes using Snapshot copies. . . . . . . .3. . .5 Update the SnapMirror destination volumes. . . . . . . . . . . .8 Renaming the cloned database . . . . . . . . Configure a UNIX host to access both the clone and the source Contents v . . .1. . . . . . .3. 92 5. . . . 87 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Create a mount point for each clone volume by executing the following command on the database server: . .2. . . . . . 87 5. . . . . Configure a UNIX host to access both the clone and the source databases in a NAS environment . . . . . . . . . .2 Bring the database into a consistent state (suspend writes). . . . . 2006 6:37 pm 7323toc. .1 Set up and initialize SnapMirror. . . . . .6 Mount the LUNs that reside on the FlexClone volumes. 111 A. . . . . . . . . . . . . . . . . . . . . .7 Configure the cloned database . . . . .4. . . . . . . . . .2.86 5. . . . . . . . . . . . . . .8 Mount the LUN devices. . .3.2. . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . 125 Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 Checking whether database is cataloged . . . . . . 120 B.12 Recatalog the database . . . . . . . . . . . . . . . . . . . . . . . . 121 B. . . . . . . . . . . . . . . . . . . . . . . . 119 B. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Obtain LUN device names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 Refresh Driver. . . . . . . . . . . . . . . . . . . . . 125 How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Mount the LUN devices. . . . . . . . . . . . .9 Changing Ownership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 B. . . . . . . . . 127 vi Using IBM DB2 UDB with IBM System Storage N series . . . . . 125 Other publications . 123 Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 Remove the old mappings . . . . . . . . .3 Create new mappings . . . . 117 B. . . . . . . . . . . . . . . . 122 B. . . . . . . . . . . . .1 List the LUN mappings . . . . . . .5 Create Mount point . 118 B. . . . . . . . . . . . . . .10 Renaming cloned database . . . . . 117 B. . . . . . . . . . . . . . . . . . . . . . . 126 Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 B. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7323toc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .fm Draft Document for Review August 23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Index . 120 B. . . . . . . . . . . . . . . 125 IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 Bring clone online . . . . . . . . . . . . . . . . . . . . 2006 6:37 pm databases in a SAN environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 B. . . . . . . . . . . . . . . . . . . 118 B. . . . . . . . . . . . . . . . . . . . .

You may copy. using. Consult your local IBM representative for information on the products and services currently available in your area. Any functionally equivalent product. MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.S. All rights reserved. to: IBM Director of Licensing. IBM. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. this statement may not apply to you. which illustrate programming techniques on various operating platforms. serviceability. Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. brands. modify. BUT NOT LIMITED TO. for the purposes of developing. IBM has not tested those products and cannot confirm the accuracy of performance. and products. cannot guarantee or imply reliability. program.Draft Document for Review August 23. compatibility or any other claims related to non-IBM products.fm Notices This information was developed for products and services offered in the U. or service is not intended to state or imply that only that IBM product. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. This information contains examples of data and reports used in daily business operations. IBM may not offer the products. therefore. their published announcements or other publicly available sources. EITHER EXPRESS OR IMPLIED. vii . Armonk. the examples include the names of individuals. The furnishing of this document does not give you any license to these patents. or service may be used. therefore. Changes are periodically made to the information herein. or service. program.A. and distribute these sample programs in any form without payment to IBM. 2006. or features discussed in this document in other countries. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. NY 10504-1785 U.S. 2006 6:37 pm 7323spec. Some states do not allow disclaimer of express or implied warranties in certain transactions. program. North Castle Drive. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. companies. it is the user's responsibility to evaluate and verify the operation of any non-IBM product. these changes will be incorporated in new editions of the publication.A. You can send license inquiries. To illustrate them as completely as possible. program. However. IBM may have patents or pending patent applications covering subject matter described in this document. COPYRIGHT LICENSE: This information contains sample application programs in source language. or service that does not infringe any IBM intellectual property right may be used instead. marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written. in writing. The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND. These examples have not been thoroughly tested under all conditions. Information concerning non-IBM products was obtained from the suppliers of those products. services. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. IBM Corporation. Any reference to an IBM product. This information could include technical inaccuracies or typographical errors. INCLUDING. THE IMPLIED WARRANTIES OF NON-INFRINGEMENT. or function of these programs. © Copyright IBM Corp.

Serving Data by Design. Center-to-Edge. UNIX is a registered trademark of The Open Group in the United States and other countries. other countries. viii Using IBM DB2 UDB with IBM System Storage N series . Linux is a trademark of Linus Torvalds in the United States. or both: Eserver® Eserver® Redbooks (logo) developerWorks® AIX® DB2 Universal Database™ DB2® IBM® OS/2® Redbooks™ ™ The following terms are trademarks of other companies: NetApp. other countries. SnapMirror. Microsoft. Inc. 2006 6:37 pm Trademarks The following terms are trademarks of the International Business Machines Corporation in the United States.7323spec. and the Windows logo are trademarks of Microsoft Corporation in the United States.S. Virtual File Manager. other countries. RoboFiler. and other countries. NOW NetApp on the Web. Smart SAN. the bolt design. FilerView. or both.fm Draft Document for Review August 23. Windows. ContentDirector. NetApp ProTech Expert. RoboCache. in the U. NetApp Availability Assurance.Camera-to-Viewer.The evolution of storage. NOW. and Web Filer are trademarks of Network Appliance. or service names may be trademarks or service marks of others. product. ContentFabric. Network Appliance. or both. SecureAdmin. Data ONTAP. Snapshot. All other brands or products are trademarks or registered trademarks of their respective holders and should be treated as such. The Network Appliance logo. Other company.

in areas of database programming. early ship programs. UNIX®. presented at several International DB2 User's Group (IDUG) and regional DB2 User's Group (RUG) conferences. He writes extensively and teaches IBM classes worldwide on all areas of storage. designing.. Currently he is working on his MBA degree from Kenan Flagler Business School UNC Chapel Hill. Jawahar Lal is a Alliance engineer for IBM DB2 at Network Appliance™ Inc. He is an IBM DB2 UDB Certified DBA and holds 4 other certification from IBM and Oracle.3 Extended Edition). authored DB2 tutorials for IBM's developerWorks® Web site. Tucson Arizona. administration. Poughkeepsie Center. He has been designing and developing databases and database applications for more than 20 years and has been working with DB2 Universal Database™ and its predecessors since it was first introduced on the IBM PC (as part of OS/2® 1. 2006 6:37 pm 7323pref. RTP. North Carolina. He has been involved with storage for over 26 years and the I/T industry for over 28 years. Advanced Technical Support.1 for Linux®. All rights reserved. and Windows®). ix . He holds a Masters degree in Computer Science from University of Rajasthan. He has written articles for IDUG Solutions Journal and Certification Magazine. taught classes on DB2 Fundamentals and Database Administration (DB2 8.Draft Document for Review August 23. Inc. He has been involved in storage and IT industry over 11 years.fm Preface This Book describes the process used to create a clone of an IBM® DB2® UDB database using FlexClone technology. Before joining the ITSO he was a Systems Engineer with Tivoli. 2006. planning. Poughkeepsier. It also covers creating a database clone on a disaster recovery site that has replicated data using Data ONTAP™ SnapMirror™ technology. Microsoft® and Redhadt. He holds over 10 certifications from IBM. Roger Sanders is a Senior Manager . The team that wrote this redbook This redbook was produced by a team of specialists from around the world working at the International Technical Support Organization. He writes extensively on storage and databases integration. modeling. performance tuning and storage integration. and is the author of nine books on DB2 and one book on © Copyright IBM Corp.Jaipur (India).IBM Alliance Engineering with Network Appliance. and Systems Engineering. North Carolina. in areas of service. Alex Osuna is a Project Leader at the International Technical Support Organization.

Find out more about the residency program. Jeremy Brumer has been working with the DB2 system verification test department in the IBM Toronto Lab for the last six years. and apply online at: ibm.com Mail your comments to: IBM Corporation. Business Partners. Roger is also a member of the DB2 Certification Exam development team and the author of a regular column (Distributed DBA) in DB2 Magazine. Your efforts will help increase product acceptance and customer satisfaction.fm Draft Document for Review August 23. 2006 6:37 pm ODBC. As a bonus.7323pref. You'll have the opportunity to team with IBM technical professionals.com/redbooks/residencies. International Technical Support Organization Dept. and increase your productivity and marketability. while getting hands-on experience with leading-edge technologies. Send us your comments about this or other Redbooks in one of the following ways: Use the online Contact us review redbook form found at: ibm. and Clients.ibm. you'll develop a network of contacts in IBM development labs.to six-week residency program! Help write an IBM Redbook dealing with specific products or solutions. His areas of expertise include high availability solutions. browse the residency index. and DB2's integration with N-series.html Comments welcome Your comments are important to us! We want our Redbooks™ to be as helpful as possible. Become a published author Join us for a two.com/redbooks Send your comments in an email to: redbooks@us. NY 12601-5400 x Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . HYTD Mail Station P099 2455 South Road Poughkeepsie.

either by physically copying the data or by performing what is known as a redirected restore. and report generation. © Copyright IBM Corp. Traditional methods of cloning a database pose various challenges. Database cloning is performed frequently by database administrators to provide near-production data for various business needs such as application development. Introduction Database cloning is process by which you can create an exact copy of a DB2 database. In this era of high system availability. QA testing. 11 . and unlike the traditional database clone. FlexClone is an advanced and proven technology that helps database and system administrators to deliver a near-instantaneous point-in-time copy of the production database. it consumes no extra disk space at the time of creation. The database cloning process is completed in few seconds. with virtually no performance impact on the production system. including system downtime and degraded system performance during the cloning process Figure 1-1. Therefore. The clone database is similar to the production database in all aspects. Additionally. a large amount of storage space is required to store each clone. the ability to create a usable database clone quickly and with virtually no impact on the production system is extremely important. Furthermore. the maintenance overhead can be enormous if each cloned database requires a frequent data refresh.Draft Document for Review August 23. organizations can't afford extended downtime and degraded performance for their production systems. 2006.fm 1 Chapter 1. All rights reserved. 2006 6:37 pm 7323ch01.

It also covers creating a database clone on a disaster recovery site that has replicated data using Data ONTAP SnapMirror technology.1 Purpose and Scope This Book describes the process used to create a clone of an IBM DB2 UDB database using FlexClone technology. 2006 6:37 pm Cloning Before: FlexClone Production Challenges Mirrored Copy Copies consume lots of disk – < 10% unique data … Dev 1 Dev 2 Dev N Copies take a lot of time – Slower time to market … Test 1 Test 2 Test N Figure 1-1 Cloning before FlexClone 1. Creating a clone of an offline DB2 UDB database on same aggregate. Specifically. Creating a clone of an online DB2 UDB database on a remote (disaster recovery) site 12 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .fm Draft Document for Review August 23. the following topics are covered in this document: Creating an IBM DB2 UDB database on a IBM N Series storage system.7323ch01. Creating a clone of an offline DB2 UDB database on a remote (disaster recovery) site. Creating a clone of an online DB2 UDB database on same aggregate.

With FlexClone. a FlexClone volume has all the features and capabilities of a regular FlexVol volume. it takes only a few seconds to create a clone of a FlexVol volume. allowing both the original FlexVol volume and the FlexClone volume to share common data. including the ability to be grown or shrunk and the ability to be the source of another FlexClone volume.fm 1. Introduction 13 . A FlexClone volume is a writable point-in-time image of a FlexVol volume or another FlexClone volume.2 Overview of the FlexClone technology FlexClone Figure 1-2 is a powerful new feature that adds a new level of agility and efficiency to storage operations by allowing an individual to create an instant clone of a flexible volume (FlexVol volume). 2006 6:37 pm 7323ch01. and cost. storing only the data that changes between the original volume and the clone.Draft Document for Review August 23. Figure 1-2 FlexClonel Chapter 1. In addition. This provides a huge potential saving in storage space. and such a volume can be created without interrupting access to the parent volume the clone is based on. The clone volume uses space very efficiently. resources. A database clone can be created simply by creating a clone of the FlexVol volumes that are used for the database's data and transaction logs.

3 Overview of the SnapMirror technology Data ONTAP SnapMirror technology provides an efficient way to transfer data from one IBM N Series storage system to another. A SnapMirror source and its corresponding destination can reside on the same storage system or on two separate storage systems that are miles apart (provided that both storage systems are able to communicate with each other over a network). With asynchronous SnapMirror.fm Draft Document for Review August 23. 14 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . each write is acknowledged as soon as it is written to NVRAM at the source. even if the destination has not yet received and/or processed the request.conf file that resides on the destination storage system. 2006 6:37 pm 1. based on the schedule defined in the /etc/snapmirror. and the storage system to which data is transferred referred to as the SnapMirror destination. . . Data changes made at the SnapMirror source are continuously replicated at the SnapMirror destination to keep the data at both locations synchronized. N Series to N Series S ynchronous S napM irror 2 IBM Systems Figure 1-3 Data ONTAP provides both asynchronous and synchronous SnapMirror functionality. Normally data changes at the SnapMirror source are copied to the destination periodically.7323ch01. The storage system from which data is transferred is referred to as the SnapMirror source.

redbooks. In other words.Draft Document for Review August 23. IBM DB2 UDB 7.4 Ensuring consistency for DB2 UDB database (suspended I/O) To obtain a consistent Snapshot copy for an online recoverable DB2 UDB database. However.1 (FixPak 2) and later provides support for temporarily suspending writes to the database by executing the SET WRITE SUSPEND command. all write operations must be suspended before invoking the Data ONTAP snapshot command. 2006 6:37 pm 7323ch01. Read-only transactions are able to continue running against the database while it is in write-suspended state. http://www. To suspend write operations to a database. the data is sent to both the SnapMirror source and the SnapMirror destination in parallel. connect to the database and execute the following command: set write suspend for database After Snapshot copies of the FlexVol volumes are created using the snapshot command. Not until both storage systems have committed the write to NVRAM does the system acknowledge that the transaction is complete. each time a transaction attempts to write data to disk. Introduction 15 .com/abstracts/redp4132. These transactions proceed normally when write operations on the database are resumed. This functionality allows an individual to temporarily suspend all writes to the database and its transaction log files before creating a Snapshot copy. For further information on SnapMirror technology.ibm. some transactions may be forced to wait if they require disk I/O.fm With synchronous SnapMirror. the application that initiated the write must wait until it receives the acknowledgement from both the source and destination storage systems before it can continue. to flush dirty pages from the buffer pool or to flush log records from the log buffer. write operations to a database can be resumed by executing the following command on the database server: set write resume for database Chapter 1. A detailed discussion of SnapMirror is beyond the scope of this Book. for example. refer to the Redpaper N Series Snapshot™: a Technical Discussion.html?Open 1.

its purpose is to initialize the clone database as a snapshot image.1 FixPak 2. This command is used primarily to initialize a snapshot copy of a database. 2006 6:37 pm 1. The configuration file must adhere to the following format: 16 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . Note: Parameters shown in angle brackets (< >) are optional. The syntax for db2inidb command is as follows: db2inidb [DatabaseAlias] as [snapshot|standby|mirror] <relocate using [ConfigFile]> where Database Alias identifies the alias assigned to the snapshot (secondary) database that is to be initialized. The db2inidb can also be used to change database name. ConfigFile identifies a configuration file that contains information on how the database files contained in the snapshot copy of the database are to be relocated when the snapshot image is initialized. the db2inidb command was introduced in DB2 UDB 7. in the context of creating a clone of a DB2 UDB database from a Snapshot copy. parameters or options shown in square brackets ([ ]) are required and must be provided. database instance name and tablespace header information based on the user provided configuration file. a comma followed by ellipses (…) indicates that the preceding parameter can be repeated multiple times.7323ch01.fm Draft Document for Review August 23.5 The db2inidb command Along with the SET WRITE command.

DB_NAME=mydb. to initialize a DB2 database named mydbcl.newContPath1 CONT_PATH=oldContPath2.newInst NODENUM=nodeNumber LOG_DIR=oldDirPath./mnt/dbdata_cl/* Figure 1-5 sample configuration file Note: It is important to note that if the database has automatic storage enabled.newStoragePath2 Figure 1-4 configuration file The sample configuration file looks similar to Figure 1-5.newPath INSTANCE=oldInst. For example.newStoragePath1 STIRAGE_PATH= oldStoragePath2.mydbcl DB_PATH=/mnt/dbdata.newContPath2 ----STORAGE_PATH= oldStoragePath1. you must specify changes to the location of the database storage paths (using the STORAGE_PATH parameter).Draft Document for Review August 23.db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. 2006 6:37 pm 7323ch01.newName DB_PATH=oldPath.newDirPath CONT_PATH=oldContPath1.fm DB_NAME=oldName. not the tablespace containers (using the CONT_PATH parameter). Introduction 17 ./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*. you would execute the following command at the database server: db2inidb mydbcl as snapshot Chapter 1./mnt/dbdata_cl INSTANCE=db2inst1.

txt It is important to note that db2inidb is never run on the production or the parent database. this command makes the necessary changes to the DB2 instance and the appropriate database support files. It also provides a way to rename a database and/or change the instance to which a database belongs.fm Draft Document for Review August 23.txt. database instance name and tablespace header information using configuration file named config. it is used to rename the clone database. Instead. you would execute the following command on the database server: db2relocatedb -f config. From the clone database perspective. When executed.txt 18 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . and change the tablespace container metadata for the tablespace containers that are associated with the clone. per specifications in a configuration file that is provided by the user.6 The db2relocatedb command The db2relocatedb command allows a DBA to change the location of one or more tablespace containers or an entire database. To rename a clone database and update the metadata for its tablespace containers. 2006 6:37 pm A second example. you would execute the following command at the database server: db2inidb mydbcl as snapshot relocate using config. The configuration file used must follow the same format specified in 1. without having to perform a backup and a redirected restore operation. 1. to initialize a clone DB2 database named mydbcl. you would execute the following command on the database server: db2relocatedb -f [ConfigFile] where ConfigFile identifies the name of a configuration file that contains information that is needed to alter the DB2-specific metadata stored in files associated with a database. change the DB2 instance with which the clone is associated. to relocate a DB2 database using a configuration file named config. it must only be executed against the clone database.7323ch01. and change database name. “The db2inidb command”.5.txt. For example.

data mining. However. and as the data source for data load into the data warehouse database. data from operational data stores (ODS) are copied to staging areas.7 Advantages of cloning a database using N series FlexClone technology There are abundant business needs that require production or near-production data. The capacity and power of the disaster recovery site systems can be used for various purposes such as reporting. By cloning a disaster recovery site.fm 1. These needs can be satisfied by creating a clone of the production database. The clone database created using the N series FlexClone feature resides on the same storage system as the parent database. 2006 6:37 pm 7323ch01. you can provide a staging area that can be refreshed quickly and can be used for cleansing and transformation of the data. The staging area is used for performing cleansing and transformation.Draft Document for Review August 23. testing. Data Warehouse/Data Mart: In typical data warehouse architecture. Normally. N series FlexClone technology has made the database cloning process so simple and easy that a clone can be created in couple of seconds without creating any system overhead. you can deliver a highly efficient and low-cost reporting environment. Introduction 19 . every night. reporting environments have near-production data and are refreshed based on a frequency. Standby Database: Immediately resume read-write workload on discovering corruption in the production dataset by mounting the clone instead. Data Mining: Data-mining software and operations can be implemented with great flexibility because both reads and writes are allowed on a cloned database. a disaster recovery site is equipped with systems that have almost the same capacity and power as the production systems and is not accessible until disaster strikes. You need to use database features DB2 write-suspend mode to transparently prepare Chapter 1. By creating a clone of the replicated data at the disaster recovery site or at a production database. The following list describes some of the key business requirements that can benefit greatly from a clone database created using FlexClone technology: Writable Disaster Recovery Destination: Generally. and development by making the replicated data accessible without affecting the data replication process. The added overhead and the complexities associated with the traditional method of creating a clone database pose immense challenges for database and storage administrators. for example. Reporting Environment: Business reports need read-only access to the production database. Database Software and Application Upgrade Test: Applications upgrades and database software patches can be tested on the cloned database before they are implemented into production.

Network Appliance and IBM has tested IBM DB2 UDB V8. Application Testing: Enterprise production data is growing exponentially and the applications testing is not performed on near-production data because of the size of the data and maintenance overhead. 1.2 for Linux. Online Database Backup: The clone database is a frozen image of the database file system at the time of the clone creation. 2006 6:37 pm the database volumes for cloning by delaying write activity to the database. Therefore.0.fm Draft Document for Review August 23. There may be significant differences in your environment configuration and setup that will alter the procedures necessary to accomplish the objective outlined in this paper. If necessary. please contact this author immediately. you can deliver near-production data for application testing and avoid production issues. By providing a cloned database. the primary database can be restored from the snapshot created for the clone. or applications can point directly to the clone database. Hosts used for these tests were running RHEL 4. 20 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . some real-life system problems go undetected during the testing phase of the system. If you find that any of the procedures described in this paper do not work in your environment.7323ch01. NetApp has not tested this configuration with other combinations of hardware and UNIX flavors. This is necessary because databases need to maintain a point of consistency.8 Configuration used for this publication The information presented in this report has been tested only with a specific hardware and software configuration.

It is also assumed that the UNIX hosts used to access the production database and the cloned database have the following software and utilities installed: IBMM DB2 UDB ESE V8 For a SAN environment. license keys for SnapMirror sync are required for both source and destination storage systems. a supported HBA. Preparation 2. 21 . 2006 6:37 pm 7323ch2. All rights reserved. if synchronous SnapMirror is to be used. and SnapMirror. iSCSI.fm 2 Chapter 2.1 General assumptions In order to take maximum advantage of the procedures and steps described in this publication. FCP. FlexClone. 2006. it is assumed that readers are familiar with the following: Commands and operations of Data ONTAP and the IBM N series storage system Administration and operations of an IBM DB2 UDB instance and database as well DB2 utilities such as db2inidb and db2relocatedb Unix system administration commands Understanding of file and block access protocols such as Fiber Channel and iSCSI It is assumed that the IBM N Series storage systems used are licensed for NFS. SanSurfer utility.Draft Document for Review August 23. Additionally. and host attach kit are installed and configured. Host attach kits can be downloaded from the r © Copyright IBM Corp.

The name of the source database is mydb. The name of the clone volume that is created from the FlexVol volume named dblogs is dblogs_cl. The mount points used to mount the volumes used for the clone database are /mnt/dbdata_cl and /mnt/dblogs_cl. 2. The name of the aggregate on the storage systems is dbaggr.com/servers/storage/support/allproducts/downloading. 22 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . 2006 6:37 pm from the IBM Web site (www-03. The database host system used to access the clone database is hostdst.7323ch2. The mount points used for the production database are /mnt/dbdata and /mnt/dblogs. The name of the cloned database is mydbcl. The sample scripts and steps in this publication assume the following: The name of the storage system containing the production database is srcstore. The database host system used to access the production database is hostsrc.ibm. The name of the FlexVol volume used to store the production database transaction logs is dblogs The name of the clone volume that is created from the FlexVol volume named dbdata is dbdata_cl.fm Draft Document for Review August 23. The name of the storage system used as the SnapMirror destination is dststore. The scripts contained in this document may require significant modifications to run under your version of UNIX. The name of the FlexVol volume used to store the production database table data is dbdata.2 Environment assumptions This technical report covers cloning of an IBM DB2 UDB Enterprise Server Edition V8 database running under UNIX with database storage on a IBM N Series storage system.html).

fm 2. The security style can be updated by executing the following command on the storage system: qtree security [FlexVolPath] unix where FlexVolPath identifies the flexible volume path on the storage system that is used for the database. For example. 2006 6:37 pm 7323ch2. Preparation 23 . to update the security style of a FlexVol volume named dbdata. you would execute the following command on the storage system: qtree security /vol/db2data unix Chapter 2.Draft Document for Review August 23.3 Security and access issues You need to make sure that each FlexVol volume used for the DB2 UDB database's data and transaction logs have their security style set to UNIX.

Figure 2-2 illustrates that both the parent volumes and the clone volumes reside in the aggregate named dbaggr. 24 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .4 Network and storage infrastructure Figure 2-1Figure 1 illustrates a simple basic architecture used to create a clone of a DB2 UDB database in the UNIX. 2006 6:37 pm 2. . or IBM N Series storage system environment. . 3 IBM Systems Figure 2-1 basic architecture A Flexclone volume of a FlexVol volume.7323ch2.fm Draft Document for Review August 23. NetApp FAS. resides in the same aggregate as the parent FlexVol volume. also known as FlexClone volume.

Chapter 2. 2006 6:37 pm 7323ch2.Draft Document for Review August 23.fm 6 IBM Systems Figure 2-2 Both the source and clone volumes reside in the same aggregate The FlexClone feature. creating a clone on the destination storage system. enables database and storage administrators to create a clone on another aggregate or on another storage system. combined with SnapMirror. Preparation 25 . Figure 3 illustrates the use of SnapMirror to replicate the data from the source volume to the destination volume.

fm Draft Document for Review August 23. 26 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . 2006 6:37 pm SRCSTORE DSTSTORE 5 IBM Systems Figure 2-3 ) Clone database volumes on the second NetApp FAS or IBM N Series storage system Figure Illustrates the steps necessary to create a clone of database in a IBM N series storage system environment.7323ch2.

Preparation 27 . 2006 6:37 pm 7323ch2.fm Steps to clone Offline DB2 Database Steps to clone a Online DB2 Database 6 IBM Systems Figure 2-4 Steps necessary to clone a DB2 database in NetApp FAS or IBM N Series storage system environment.Draft Document for Review August 23. Chapter 2.

fm Draft Document for Review August 23.7323ch2. 2006 6:37 pm 28 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .

fm 3 Chapter 3.Draft Document for Review August 23. An aggregate named dbaggr1 © Copyright IBM Corp. you need to create the following storage containers and objects on the storage system used. 2006. All rights reserved. you need to perform a few configuration steps on the database server and the IBM N-Series storage system. After configuring the database server and the storage system. 2006 6:37 pm 7323ch3. Creating a DB2 UDB Database on a IBM N series In order to create a DB2 UDB database on a IBM N-Series storage system. 29 .

Create an igroup named dbhost1_fcp_igp for the database server dbhost1.7323ch3. On the storage system named dbstore1. using ID 0 and 1 respectively.fm Draft Document for Review August 23. Create a LUN named /vol/dblogs/logs within FlexVol volume dblogs. which you can create by completing the following steps: 30 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . 2006 6:37 pm 7 IBM Systems Figure 3-1 dbaggr1 Flexible volumes named dbdata and dblogs within aggregate dbaggr For SAN environments. the storage system should be ready to receive a DB2 UDB database. you need to perform the following additional steps: Create a LUN named /vol/dbdata/data within FlexVol volume dbdata. After you complete these initial steps. create mappings for the LUNs named /vol/dbdata/data and /vol/dbdata/logs to the igroup named dbhost1_fcp_igp.

1 is /opt/IBM/db2/V8.2 Create the database Log in as the database instance owner and execute the following command on the database server: db2 "create database [DatabaseName] on [MountPoint]" where DatabaseName identifies the name that is to be assigned to the new database once it has been created.fm 3. 2006 6:37 pm 7323ch3.1/instance/db2icrt -u db2inst1 db2inst1 3.1 Create a instance If an instance does not already exist.Draft Document for Review August 23.1 is /usr/opt/db2_08_01. For example. log in as the user root on the database server and create a DB2 instance by executing the following command: [DB2Dir]/instance/db2icrt -u [FencedID] [InstanceName] where DB2Dir identifies the directory where the DB2 UDB software was installed: – On AIX®. the DB2 installation directory for version 8. Creating a DB2 UDB Database on a IBM N series 31 . – On all other UNIX-based operating systems. InstanceName identifies the name that is to be assigned to the new instance. FencedID identifies the ID of the user under which fenced user-defined functions and fenced stored procedures will run. MountPoint identifies the mount point location where the new database is to be created. to create a database named mydb on a storage system volume that is mounted on a mount point named /mnt/dbdata. you would execute the following command on the database server: db2 "create database mydb on /mnt/dbdata" Chapter 3. the installation directory for version 8. you would execute the following command on the database server: /opt/IBM/db2/V8.1. to create a database instance named db2inst1. For example.

and the transaction logs are stored in a subdirectory where the database was created. To change the location where transaction log files are stored.3 Change location of transaction logs It is not a good practice to leave transaction log files on their default location. the database manager will move the transaction log files to the new location. NewLogLocation identifies the new location where the database's transaction log files are to be stored. 2006 6:37 pm 3. DB2 UDB uses a circular logging mechanism for the database.fm Draft Document for Review August 23. Switching a DB2 UDB V8 database from circular logging to archive logging is easy. The LOGARCHMETH1 configuration parameter can be updated by executing the following command on the database server: db2 update db cfg for [DatabaseName] using LOGARCHMETH1 DISK:[ArchiveDir] where DatabaseName identifies the name assigned to the database whose logging method is to be changed. 32 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . For example. When first connection is made after re-activating the database. 3. In fact. most production databases run in archive logging mode to support roll-forward recovery. execute the following command at the database server: db2 update db cfg for [DatabaseName] using NEWLOGPATH [NewLogLocation] where DatabaseName identifies the name assigned to the database whose log file storage location is to be changed. the transaction log files for the database should be stored on a separate volume. to change the log directory from the default location to a directory named /mnt/dblogs. However. you would execute the following command on the database server: db2 update db cfg for mydb using NEWLOGPATH /mnt/dblogs Note: The new log path setting will not become effective until all the users are disconnected and the database is deactivated. when a DB2 UDB database is stored on a IBM N Series storage system volume. and it can be done by updating the primary log archive method configuration parameter (named LOGARCHMETH1).4 Switch from circular logging to archive logging By default.7323ch3.

to enable archive logging for the DB2 database named mydb and place the archive file in a directory named /mnt/dbarch1/mydb. you would execute the following command on the database server: db2 update db cfg for mydb using LOGARCHMETH1 DISK:/mnt/dbarch1/mydb If you want to retain a second copy of archive log files on another disk. 2006 6:37 pm 7323ch3. ArchiveDir identifies the directory (location) where the second copy of the archived transaction log files is to be stored. Chapter 3. For example. you would execute the following command on the database server: db2 update db cfg for mydb using LOGARCHMETH2 DISK:/mnt/dbarch2/mydb 3. Creating a DB2 UDB Database on a IBM N series 33 .Draft Document for Review August 23. The LOGARCHMETH2 configuration parameter can be updated by executing the following command on the database server: db2 update db cfg for [DatabaseName] using LOGARCHMETH2 DISK:[ArchiveDir] where DatabaseName identifies the name assigned to the database for which duplex logging is to be enabled.5 Creating offline copy After the logging method is changed from circular to archival. you need to update the secondary log archive method configuration parameter.fm ArchiveDir identifies the directory (location) where archived transaction log files are to be stored. the database is placed into Backup Pending state and can no longer be used until a full offline backup copy of the database has been created. For example. An offline backup copy of the database can be created by executing the following commands on the database server: db2 force application all db2 backup database [DatabaseName] to [BackupDir] where DatabaseName identifies the name assigned to the database that is to be backed up. to store and maintain a second set of archive logs for a DB2 database named mydb in a directory named /mnt/dbarch2/mydb. named LOGARCHMETH2.

you would execute the following command on the database server: db2 force application all db2 backup database mydb to /dbbackup After completing these steps. to create an offline backup copy of the database named mydb.fm Draft Document for Review August 23. 2006 6:37 pm BackupDir identifies the directory (location) where backup images are to be stored.7323ch3. the production database is ready. For example. You can create database objects and start using the database 34 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .

All rights reserved.Draft Document for Review August 23. In this case.1 Select the production database server and database Select the database server which accesses the production (parent) database. 35 .fm 4 Chapter 4. © Copyright IBM Corp. In order to create new DB2 instance you need to complete the following steps: 1. Switch the authority to the user root and create a user named db2instc on the database server by executing the following command: useradd -c "DB2 clone db instance owner" -u 710 -g db2adm -G db2adm db2instc -p db2instc The new user will own the DB2 instance used to access the cloned database. 2006. 2006 6:37 pm clone. you can uses existing DB2 instance or create a new one using the same DB2 UDB V8 code as the production instance. Cloning a DB2 UDB Database in the N series Environment 4.1 Select a database server to access the cloned database You need to select a database server that will be used to access the cloned database.1. You have the following choices: 4.

you need to install the same DB2 UDB V8 code as the production database on the database server and create a database instance as described in the Select the production database server and database. InstanceName identifies the name that is to be assigned to the new instance For example. The new instance name can be same as the production DB2 instance provided there is no other instance with the same name on this server.fm Draft Document for Review August 23. In order to do that you need execute the following command on the database server: [DB2InstallationPath]/instance/db2icrt -u [FencedUser] [InstanceName] where DB2InstallationPath identifies the directory where the DB2 UDB V8 code was installed. Check the list of instances and DB2 UDB code used by executing the following command on the database server /opt/IBM/db2/V8.FP11/instance/db2ilist -a The output from the above command should look similar to Example 4-1.clone. if the DB2 UDB V8 were installed in /opt/IBM/db2/V8. db2inst1 db2instc 32 32 /opt/IBM/db2/V8. 36 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .1 directory.1. you would execute the following command on the database server to create a DB2 instance named db2instc: /opt/IBM/db2/V8. FencedUser identifies the ID of the user under which fenced user-defined functions and fenced stored procedures will run. In this case.2 Select a database server.FP11/instance/db2icrt -u db2instc db2instc a. which has a version of DB2 UDB installed that is different from the production DB2 UDB Version. which has a different DB2 UDB version A database server other than the production database server.1 /opt/IBM/db2/V8.1 Example 4-1 db2ilist output 4. 2006 6:37 pm 2. Now create a new DB2 instance using the same DB2 code as the production database instance.

3 Select a non production server without DB2 UDB installed A database server other than the production database server that does not have DB2 UDB installed.2. create a Snapshot copy of each FlexVol volume that is used for the production database by executing the following command on the storage system: snap create [VolName] [SnapName] where VolName identifies the name assigned to the FlexClone volume that is to be created. to terminate all application connections.2. you would execute the following command on the database server: db2 force applications all 4. Cloning a DB2 UDB Database in the N series Environment 37 .1 Bring the source database offline. 2006 6:37 pm clone.1. To bring the database offline.2 Clone an offline database on the same storage system To clone a database that is offline. terminate all the application connections to the database that is to be cloned by executing the following command on the database server: db2 force applications all For example.fm 4. For example. Next. The new instance name can be same as the production DB2 instance 4. In this case. you need to install the same DB2 UDB V8 code as the production database on the database server and create a database instance as described in the Select the production database server and database.Draft Document for Review August 23. you would complete the following steps: 4. you would execute the following command on the storage system: Chapter 4. SnapName identifies the name that is assigned to the Snapshot copy.2 Create Snapshot copies of the database FlexVol volumes. to create a Snapshot copy named dbdata_snap01 for a FlexVol volume named dbdata.

create a clone of each FlexVol volume using the Snapshot copies created on step Part 4.4 Clone the FlexVol volumes. 4. you can connect to the source database and start using it. A clone volume can be created by executing the following command on the storage system: vol clone create [CloneVol] -s volume -b [ParentVol] <ParentSnap> 38 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .clone.” on page 37.fm Draft Document for Review August 23. 2006 6:37 pm snap create dbdata dbdata_cl_snp01 8 IBM Systems Figure 4-1 snapshot results It is recommended that you develop a naming convention and assign a meaningful name to the Snapshot copies that are created for cloning purpose.3 Start the source database Once the Snapshot copies of the FlexVol volumes of the source database is created.2.2.2. Next. 4. “Create Snapshot copies of the database FlexVol volumes.2.

Cloning a DB2 UDB Database in the N series Environment 39 . ParentVol identifies the name of the FlexVol volume that is source for the clone volume. 2006 6:37 pm clone. to create a clone volume of a FlexVol volume named dblogs using the Snapshot copy named dbdata_cl_snp. backed by volume 'dbdata'. itsotuc2> vol status dbdata_cl Volume State Status dbdata_cl online raid_dp. We recommend explicitly creating a Snapshot and assigning it a meaningful name before creating a clone FlexVol volume. Chapter 4. Note: A Snapshot copy is not required to create a clone of a FlexVol volume if you don't explicitly create a Snapshot copy and specify it when executing the vol clone command. convert_ucode=on Clone. snapshot 'dbdata_cl_snp.fm where CloneVol identifies the name of the FlexClone volume that is being created. For example. you would execute the following command on the N series storage system: vol clone create dbdata_cl -s volume -b dbdata dbdata_cl_snp.01 Verify the clone you just created with: vol status dbdata_cl The output is seen in Example 4-2. The Snapshot copy that is used as the base for the clone volume cannot be deleted as long as the clone volume exists. ParentSnap identifies the name of the parent FlexVol volume snapshot that is used as source for the clone volume.Draft Document for Review August 23.01.01' Containing aggregate: 'aggr0' Example 4-2 vol status example The Snapshot copy that is used as the base for the clone volume can't be deleted as long as the clone volume exists. a Snapshot copy will be implicitly created and used for the clone volume. flex Options create_ucode=on. A Snapshot copy created implicitly will have a system assigned name.

clone.fm

Draft Document for Review August 23, 2006 6:37 pm

4.2.5 Create an export entry for the clone volume.
In order to mount a clone volume to the database server, you need to create an export entry for it in the /etc/exports file that resides on the IBM N Series storage system. The export entry can be created by executing the following command on the IBM N Series storage system: exportfs -p rw=[HostName],root=[HostName] [PathName] where HostName identifies the name assigned to the database server. PathName identifies the name assigned to the flexible volume. For example, to create an export entry for a clone volume named dbdata_cl and allow root access from the database server named hostdst for it, you would execute the following command on the storage system: exportfs -p rw=hostdst,root=hostdst /vol/dbdata_cl Repeat this step to create an export entry for each clone volume that is used for the clone database. You can verify your exports with FilerView™ Figure 4-1

40

Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology

Draft Document for Review August 23, 2006 6:37 pm

clone.fm

11

IBM Systems

Figure 4-2 Verifying the exports

4.2.6 Mount the clone volumes.
The clone database can be accessed from the same database server that is used to access the source database, or from a completely different server. The scenarios described in this paper were produced using a second database sever to access the clone database. In order to access the clone database, you need to mount the clone volumes to a database server. First, you need to create a mount point for each clone volume and append a mount entry to the /etc/fstab file. The mount entry should specify the mount options, and it should look similar to the following: [StorageSystemName]:[FlexVolName] [MountPoint] nfs hard,rw,nointr,rsize=32768,wsize=32768,bg,vers=3,tcp 0 0 where StorageSystemName identifies the name assigned to the storage system that is used for the database storage. FlexVolName identifies the name assigned to the clone volume.

Chapter 4. Cloning a DB2 UDB Database in the N series Environment

41

clone.fm

Draft Document for Review August 23, 2006 6:37 pm

MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server. For example, for a clone volume named dbdata_cl that resides on a storage system named srcstore, you would append the following entry to the /etc/fstab file on the database sever: srcstore:dbdata_cl /mnt/dbdata_cl nfs hard,rw,nointr,rsize=32768,wsize=32768,bg,vers=3,tcp 0 0 After appending the mount entry, you can mount the clone volume by executing the following command on the database server: mount [MountPoint] where MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server. For example, to mount a clone volume that has mount entry specified in the /etc/fstab file, you would execute the following command on the second database server named hostdst: mount /mnt/dbdata_cl The database servers we used had a Linux operating system. In order to operate DB2 successfully, the DB2 instance owner should have ownership of the file systems on the clone volume that is mounted on the database server. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance. FileSystem identifies the name of the files system whose ownership is changed. For example, to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl, you would execute the following command on the second database server: chown -R db2inst1:db2adm /mnt/dbdata_cl

42

Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology

the tablespaces containers for the default tablespaces (SYSCATSPACE. if the DB2 instance name is db2inst1 and the database was created on the directory named /mnt/dbdata.4.2.” on page 41 are going to be used as the storage containers for the cloned database. 2. TEMPSPACE1. and USERSPACE1) reside in the following directory: [DBDir]/[InstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on. You can skip the parts (A) and (B) of this step if following two conditions are true for you environment: 1. Cloning a DB2 UDB Database in the N series Environment 43 . By default when database is created. “Clone the FlexVol volumes. you have to create a DB2 instance with a new name if an existing DB2 instance name is same as the production DB2 instance name. InstanceName identifies the name assigned to the DB2 instance the database belongs to. The name of the DB2 instance used for the clone database is same as the production or source database instance name.7 Configuring the cloned database The clone volumes created in Part 4. The mount points that are used to mount the clone volumes have same name as the mount points that are used to mount volumes of the production database. OldInstanceName identifies the name assigned to the DB2 instance the production database belongs to. 2006 6:37 pm clone. Chapter 4. the default tablespace containers will reside in the following directory.2.” on page 38 and mounted in Part 4. “Mount the clone volumes. /mnt/dbdata/db2inst1/NODE0000 For a database server the DB2 instance name has to be unique. In order to access the clone database from a different instance name you need to change the default tablespace container's path name by executing following command on the database server: mv [DBDir]/[OldInstanceName]/NODE000n [DBDir]/[NewInstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on.2. A.6. Therefore.Draft Document for Review August 23. For example.fm 4.

A sample configuration file for this scenario should look something like this: DB_NAME=mydb./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*. it has its data on /mnt/dbdata_cl and logs on /mnt/dblogs_cl./mnt/dbdata_cl INSTANCE=db2inst1.4. The source database instance name is db2inst1 and clone database instance name is db2instc. 44 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . the clone database becomes available after executing db2start. you would execute the following command on the database server to change the path: mv /mnt/dbdata_cl/db2inst1 /mnt/dbdata_cl/db2instc B. the source database name is mydb and it has its logs on /mnt/dblogs and data on /mnt/dbdata .db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. 2006 6:37 pm NewInstanceName identifies the name assigned to the DB2 instance the clone database belongs to. To do this. For example. Save the configuration file as /home/db2inst1/dbrelocate.clone. you will need to create a configuration file that identifies the source database information and specifies the new clone database information.mydbcl DB_PATH=/mnt/dbdata.cfg C./mnt/dbdata_cl/* Example 4-3 configuration file example In this configuration file.fm Draft Document for Review August 23. The clone database is to be renamed to mydbcl. to access the clone database from the instance named db2instc.cfg and execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate. Start the database manager instance you created for the migration test environment by executing the following command on the database server: db2start If the production database was offline during the Snapshot copy process. Now you need to change the database name and tablespace containers header information using the db2inidb command as specified in section 1.

9 Verify the database. 4.2. The report is generated in the Chapter 4. you would execute the following command on the database server: db2dart mydbcl /db The db2dart utility inspects the entire database for architectural correctness and generates a detailed report.fm The production database was offline during the Snapshot creation process. For example.2. DatabaseAlias identifies the alias name assigned to the database that is being cataloged. FileSystem specifies the path on which the database being cataloged resides. you can connect to the clone database and start using it. After performing the above steps. then on execution the db2relocatedb command uncatalogs the source database. you need to check the entire clone database for architectural correctness.8 Catalog the source database if necessary If the cloned database is accessed from same DB2 instance as the production database on the production database server. Therefore. Therefore. to recatalog a source database named mydb that resides on file system named /mnt/dbdata. Cloning a DB2 UDB Database in the N series Environment 45 . to test the cloned database named mydbcl. you need to catalog the source database by executing the following command on the database server: db2 "catalog database [DatabaseName] as [DatabaseAlias] on [FileSystem]" where DatabaseName identifies the name assigned to the database that is being cataloged. For example. 2006 6:37 pm clone. you would execute the following command on the database server: db2 "catalog database mydb as mydb on /mnt/dbdata" 4. You can do so by executing the following command on the database server: db2dart [DatabaseName] /db where DatabaseName identifies the name of the clone database used for the test environment.Draft Document for Review August 23.

the database write operations need to be temporarily suspended by executing the following command on the database server: db2 set write suspend for database The SET WRITE SUSPEND FOR DATABASE command causes the DB2 database manager to suspend all write operations to tablespace containers and log files that are associated with the current database. In this section.2 Create Snapshot copies of the database FlexVol volumes.3. 4. Therefore. The additional information on accessing a cloned database from the same database server as the source has been described in the Appendix A.3.2. to prevent partial page writes while database cloning is in progress. “Clone an offline database on the same storage system” on page 37 you should have a fair understanding of cloning an offline DB2 database. if any.1 Bring the database into a consistent state (suspend writes).3 Clone an online database on the same storage system After reading Part 4. “Configure a UNIX host to access both the clone and the source databases in a NAS environment” on page 111. Next. The FlexVol volume clone process is completed very quickly.clone. The report has a summary at the end of report. 2006 6:37 pm <$HOME>/sqllib/db2dump/DART0000/ directory. In this scenario. A Snapshot copy of a FlexVol volume can be created by executing the following command on the storage system: snap create [VolName] [SnapName] where 46 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . provided that they do not request a resource that is being held by the suspended I/O process. create a Snapshot copy of each FlexVol volume that is used for the production database. 4. you learn how to clone an online DB2 database by completing the following steps. so the database doesn't need to stay in write suspend mode for more than a few seconds.fm Draft Document for Review August 23. Read-only transactions continue uninterrupted. the source database is online. You can read the summary and find out the errors. 4.

fm VolName identifies the name assigned to the FlexClone volume that is to be created.1 It is recommended that you develop a naming convention and assign a meaningful name to the Snapshot copies that are created for cloning purpose. you need to resume write operations to the database by executing the following command on the database server: set write resume for database 4. A clone volume can be created by executing the following command on the storage system: vol clone create [CloneVol] -s volume -b [ParentVol] <ParentSnap> where CloneVol identifies the name of the FlexClone volume that is being created. Once Snapshot copies are created.3. to create a clone volume of a FlexVol volume named dblogs using the Snapshot copy named dbdata_cl_snp. create a clone of each FlexVol volume using the Snapshot copies created in Part .01. to create a Snapshot copy named dbdata_snap. SnapName identifies the name that is assigned to the Snapshot copy. Cloning a DB2 UDB Database in the N series Environment 47 .Draft Document for Review August 23. you would execute the following command on the storage system: snap create dbdata dbdata_cl_snp.4 Clone the FlexVol volumes. Next.3. ParentSnap identifies the name of the parent FlexVol volume snapshot that is used as source for the clone volume.1 for a FlexVol volume named dbdata. create a Snapshot copy of each FlexVol volume that is used for the production database. 4. “Next.3 Resume normal database operations (resume writes). Chapter 4.” on page 46. 2006 6:37 pm clone. you would execute the following command on the N series storage system: vol clone create dbdata_cl -s volume -b dbdata dbdata_cl_snp.01 The Snapshot copy that is used as the base for the clone volume can't be deleted as long as the clone volume exists. For example. ParentVol identifies the name of the FlexVol volume that is source for the clone volume. For example.

3.vers=3. you need to mount the clone volume to a database server. you need to create an export entry for it in the /etc/exports file that resides on the storage system. In order to access the clone database. PathName identifies the clone volume path. 4. For example.3. The mount entry should specify the mount options.6 Mount the cloned volumes.tcp 0 0 Example 4-4 /etc/fstab where 48 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . you would execute the following command on the storage system: exportfs -p rw=dbhost1.wsize=32768. We recommend explicitly creating a Snapshot and assigning it a meaningful name before creating a clone FlexVol volume.fm Draft Document for Review August 23. to create an export entry for a clone volume named dbdata_cl and allow root access to it from a database server named dbhost1. In order to mount a clone volume to the database server. you create a mount point for each clone volume and append a mount entry to the /etc/fstab file.rw. and it should look similar to the following: [StorageSystemName]:[FlexVolName] [MountPoint] nfs hard.nointr. First. The export entry can be created by executing the following command on the storage system: exportfs -p rw=[HostName]. 4.clone.root=dbhost1 /vol/dbdata_cl Repeat this step to create an export entry for each clone volume that is to be used for the database in the test environment. a Snapshot copy will be implicitly created and used for the clone volume. A Snapshot copy created implicitly will have a system assigned name.root=[HostName] [PathName] where HostName identifies the database server name that will use these clone volumes as storage.5 Create NFS export entries for the cloned volumes. 2006 6:37 pm Note: A Snapshot copy is not required to create a clone of a FlexVol volume if you don't explicitly create a Snapshot copy and specify it when executing the vol clone command.rsize=32768.bg.

you would append the following entry to the /etc/fstab file on the database sever: srcstore:dbdata_cl /mnt/dbdata_cl nfs hard. to mount a clone volume that has mount entry specified in the /etc/fstab file.Draft Document for Review August 23. For example. you would execute the following command on the second database server. for a clone volume named dbdata_cl that resides on a storage system named srcstore.rsize=32768. the DB2 instance owner should have ownership of the file systems on the clone volume that is mounted on the database server.rw. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance.nointr. FlexVolName identifies the name assigned to the clone volume.bg.tcp 0 0 After appending the mount entry. In order to operate DB2 successfully. Cloning a DB2 UDB Database in the N series Environment 49 .vers=3. you can mount the clone volume by executing the following command on the database server: mount [MountPoint] where MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server. FileSystem identifies the name of the files system whose ownership is changed. 2006 6:37 pm clone. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance.fm StorageSystemName identifies the name assigned to the storage system that is used for the database storage. Chapter 4. named hostdst: mount /mnt/dbdata_cl The database servers we used had Linux operating systems. For example.wsize=32768. MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server.

you would execute the following command on the second database server: chown -R db2inst1:db2adm /mnt/dbdata_cl 4. the default tablespace containers will reside in the following directory. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl.3. For example. 2006 6:37 pm For example. if the DB2 instance name is db2inst1 and the database was created on the directory named /mnt/dbdata. You can skip the parts (A) and (B) of this step if following two conditions are true for you environment: 1.” on page 48 of this section are going to be used as the storage containers for the cloned database.clone. In order to access the clone database from a different instance name you need to change the default tablespace container's path name by executing following command on the database server: mv [DBDir]/[OldInstanceName]/NODE000n [DBDir]/[NewInstanceName]/NODE000n 50 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . /mnt/dbdata/db2inst1/NODE0000 For a database server the DB2 instance name has to be unique.6.3. you have to create a DB2 instance with a new name if an existing DB2 instance name is same as the production DB2 instance name.4.fm Draft Document for Review August 23.” on page 47 and mount in Part 4. “Clone the FlexVol volumes.7 Configuring the cloned database The clone volumes created in Part 4. A. The name of the DB2 instance used for the clone database is same as the production or source database instance name. InstanceName identifies the name assigned to the DB2 instance the database belongs to. “Mount the cloned volumes. By default when database is created. Therefore. the tablespaces containers for the default tablespaces (SYSCATSPACE. and USERSPACE1) reside in the following directory: [DBDir]/[InstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on. The mount points that are used to mount the clone volumes have same name as the mount points that are used to mount volumes of the production database. 2.3. TEMPSPACE1.

A sample configuration file for this scenario should look something like this: DB_NAME=mydb. NewInstanceName identifies the name assigned to the DB2 instance the clone database belongs to. Cloning a DB2 UDB Database in the N series Environment 51 . it has its data on /mnt/dbdata_cl and logs on /mnt/dblogs_cl. The clone database is to be renamed to mydbcl./mnt/dbdata_cl/* Example 4-5 configuration file In this configuration file.Draft Document for Review August 23. the source database name is mydb and it has its logs on /mnt/dblogs and data on /mnt/dbdata ./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*. To do this./mnt/dbdata_cl INSTANCE=db2inst1.4. For example. Start the database manager instance you created for the migration test environment by executing the following command on the database server: Chapter 4. 2006 6:37 pm clone. to access the clone database from the instance named db2instc. Save the configuration file as /home/db2inst1/dbrelocate.mydbcl DB_PATH=/mnt/dbdata.cfg C.db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. Now you need to change the database name and tablespace containers header information using the db2inidb command as specified in section 1. you will need to create a configuration file that identifies the source database information and specifies the new clone database information.fm where: DBDir identifies the name assigned to the directory/device the database is created on.cfg and execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate. you would execute the following command on the database server to change the path: mv /mnt/dbdata_cl/db2inst1 /mnt/dbdata_cl/db2instc B. OldInstanceName identifies the name assigned to the DB2 instance the production database belongs to. The source database instance name is db2inst1 and clone database instance name is db2instc.

4 Clone an offline database to a remote storage system The FlexClone feature combined with SnapMirror (Figure 4-3) makes it possible to clone a DB2 database on a remote IBM N Series storage system over the network or on another aggregate of the same IBM N Series storage system. 52 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . you would execute the following commands on the database server: db2inidb mydbcl as snapshot 4.8 Verify the database. You can do this by executing the following command on the database server: db2inidb database [DatabaseName] as snapshot where DatabaseName identifies the name of the clone database that is going to be used for the test environment. For example. You can do so by executing the following command on the database server: db2dart [DatabaseName] /db where DatabaseName identifies the name of the clone database used for the test environment. to test the database named mydbcl you would execute the following command on the database server: 4.3. For example. The production database was online during the Snapshot creation process.fm db2start Draft Document for Review August 23. you will need to use the db2inidb utility to initialize the clone database as a snapshot. After performing the above steps. you need to check the entire database for architectural correctness. to initialize a clone database named mydbcl. the clone database becomes available after executing db2start.clone. 2006 6:37 pm If the production database was offline during the Snapshot copy process. This section describes the steps necessary to clone a database on the second storage system at a remote location.

to enable a SnapMirror license key. you complete the following steps on the SnapMirror source and the SnapMirror destination IBM N Series storage system: 1.4. ® Scalable replication frequency Bandwidth efficient. Chapter 4.fm Application Disaster Recovery Any-to-any mirroring. you would execute the following command on the storage system: License add 1234ABCDE verify the license through FilerView see Figure 4-4.1 Configure SnapMirror. In order to configure SnapMirror.Draft Document for Review August 23. 2006 6:37 pm clone. mirror over existing IP network . For example. Add licenses for SnapMirror and SnapMirror sync on the source and destination IBM N Series storage system by executing the following command: license add [licenseCode] where licenseCode identifies the license key for the product or feature that is provided to you by the NetApp or IBM sales representative. Cloning a DB2 UDB Database in the N series Environment 53 . from low to high-end Remote DR FC or IP SAN Primary Storage SnapMirror . Secondary Storage 44 IBM Systems Figure 4-3 SnapMirror utilization 4.

2006 6:37 pm 1234ABCDE 47 IBM Systems Figure 4-4 license manager 2. 54 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .fm Draft Document for Review August 23.enable on verify options with the following command: options snapmirror The output will look like Example 4-6. Enable the SnapMirror feature by executing the following command on the SnapMirror source and destination storage systems: snapmirror on or options snapmirror.clone.

to append an entry for the storage system named dststore.enable on Example 4-6 options snapmirror 3. On the SnapMirror source storage system.allow file on the SnapMirror source storage system: dststore 4.enable on snapmirror.168. create a snapmirror. For example. The configuration file is used to identify the source storage system.checkip.delayed_acks.conf that resides in the /volvol0/etc directory on the destination storage system.log.Draft Document for Review August 23.fm itsotuc2> options snapmirror snapmirror. The entries in the snapmirror. and SnapMirror schedule.conf file looks similar to the Example 4-7.enable on snapmirror. you would add the following entry to the snapmirror.2 snapmirror. Chapter 4. Create a configuration file named snapmirror. A snippet from a snapmirror. 2006 6:37 pm clone.access host=192. source volume.enable off snapmirror.allow file that resides in the /vol/vol0/etc directory and append an entry for the SnapMirror destination storage system. Cloning a DB2 UDB Database in the N series Environment 55 .2.allow file should look similar to the following: [DestinationStorageSystemName] where DestinationStorageSystemName identifies the name assigned to the SnapMirror destination storage system. destination volume.

you would execute the following command on the destination storage system: vol restrict dbdata verify the execution of the command with the following command.0 * * 1-5 # srcstore:dblog1 dststore:dblog1 .conf If the word sync is specified in the snapmirror. including all Snapshot copies. you need to restrict the destination volume by executing the following command on the destination storage system: vol restrict [VolumeName] where VolumeName identifies the name assigned to the volume that is being used as the SnapMirror destination. to restrict a SnapMirror destination volume named dbdata.synchronous SnapMirror Example 4-7 snapmirror.4.conf file instead of a definitive schedule. For example.2 Initialize SnapMirror.sync -. In order to initialize the SnapMirror relationship. As noted earlier. 56 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .0 * * 1-5 srcstore:dblogs dststore:dblogs .fm Draft Document for Review August 23. from the source volume to the destination volume for the first time. only changed blocks are transferred. 2006 6:37 pm #--------------------------------------------------------------------------# file name: snapmirror. that implies synchronous Snapmirror configuration for that particular volume. thereafter.conf # Description: This file resides on a destination storage system and # consists of SnapMirror configuration details. the initialization process transfers data.clone. 4. Entry format is as follows: # src_filer:[vol | qtreepath] dest_filer:[vol | qtreepath] argument schedule #--------------------------------------------------------------------------srcstore:dbdata dststore:dbdata .

to initialize the SnapMirror relationship that is specified in the configuration file for the volume named dbdata. 2006 6:37 pm clone. you would execute the following command on the destination storage system: snapmirror initialize -S srcstore:dbdata dststore:dbdata You can accomplish the same thing through FilerView Figure 4-5 Chapter 4. vol status dbdata Volume State Status Options dbdata restricted raid_dp. Cloning a DB2 UDB Database in the N series Environment 57 . flex Volume has clones: dbdata_cl Containing aggregate: 'aggr0' Example 4-8 vol status example After restricting the destination FlexVol volumes. For example. DestinationStorageSystem identifies the name assigned to the SnapMirror destination storage system. VolumeName identifies the name assigned to the volume that is the SnapMirror source/destination. you need to initialize the SnapMirror relationship for each volume that is used for the database by executing the following command on the destination storage system: snapmirror initialize -S [SourceStorageSystem]:[VolumeName][DestinationStorageSystem]:[VolumeNa me] where SourceStorageSystem identifies the name assigned to the SnapMirror source storage system.fm vol status dbdata Example 4-8 is the output from the command.Draft Document for Review August 23.

fm Draft Document for Review August 23. After baseline data transfer is finished.clone. 58 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . The progress of SnapMirror can be checked by executing the following command on the storage system: snapmirror status The output from this command should look similar to Example 4-9 or Figure 4-6. the destination volume data is available in read-only mode. 2006 6:37 pm 2 IBM Systems Figure 4-5 SnapMirror creation The SnapMirror initialize command creates a Snapshot copy of the source volume and transfers data from the source to the destination volume.

In the SnapMirror relationship. the destination volumes are read-only. 2006 6:37 pm clone. you need to Chapter 4.fm snapmirror status snapmirror is on. Cloning a DB2 UDB Database in the N series Environment 59 . therefore.Transferring(116 MB done) Example 4-9 snapmirror status Figure 4-6 SnapMirror Status 4.Draft Document for Review August 23.4.3 Create clones of the FlexVol volumes Create clones of the FlexVol volumes on the remote storage system. Source Destination State Lag Status srcstore:dbdata dststore:dbdata SnapMirrored 00:07:33 Idle srcstore:dblogs dststore:dblogs Uninitialized . to create a clone database on a remote IBM N series storage system.

to create a Snapshot copy named dbdata_cl_snap. you would execute the following command on the SnapMirror source storage system: snap create dbdata dbdata_cl_snap. 2006 6:37 pm create Snapshot copies of the FlexVol volumes on the SnapMirror source storage system and update the SnapMirror relationship manually. 60 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . The SnapMirror update operation replicates data. For example. you can connect to the database and start using it. Naming the Snapshot copy appropriately helps to avoid unintended deletion of it from the source storage system. 3. including Snapshot copies.clone.fm Draft Document for Review August 23.1 You should name the Snapshot copy in a way that it describes its intended use.1 of a volume named dbdata. Create a Snapshot copy for each volume that is used for the database by executing the following command on the SnapMirror source storage system: snap create [VolumeName] [SnapName] where VolumeName identifies the name assigned to the FlexVol volume on the SnapMirror storage system that is used for the database. Now you replicate the Snapshot copy created in step b to the SnapMirror destination volume. DestinationStorageSystem identifies the name assigned to the SnapMirror destination storage system. and the replicated Snapshot copy can be used to create the clone volume. to the SnapMirror destination storage system. 4. In order to do so you need to update the SnapMirror relationship manually by executing the following command on the destination storage system: snapmirror <-S [SourceStorageSystem]:[VolumeName]> update [DestinationStorageSystem]:[VolumeName] where SourceStorageSystem identifies the name assigned to the SnapMirror source storage system. Bring the database offline by terminating all the application connections to the database by executing the following command on the database server: db2 force applications all 2. Once Snapshot copies of the FlexVol volumes of the source database are created. Here are the detailed steps: 1. SnapName identifies the name assigned to the Snapshot copy of the FlexVol volume that is used as the source for the clone volume.

2006 6:37 pm clone. For example. the Snapshot copy created on the source volume becomes visible on the destination volume immediately. For synchronous SnapMirror. each destination volume has a Snapshot copy that was created on the source storage system and replicated to the destination. ParentSnap identifies the name of the parent FlexVol volume Snapshot copy that is used as the source for the clone volume. the SnapMirror relationship will fail. you would execute the following command on the SnapMirror destination storage system named dststore: snapmirror -S srcstore:dbdata update dststore:dbdata When the update command is executed for asynchronous SnapMirror. to update SnapMirror for a volume named dbdata.1 Important: The Snapshot copy on the SnapMirror source storage system should not be deleted.Draft Document for Review August 23. otherwise.fm VolumeName identifies the name assigned to the source/destination volume in the SnapMirror relationship. A clone volume can be created from the Snapshot copy by executing the following command on the destination storage system: vol clone create [CloneVol] -s volume -b [ParentVol] <ParentSnap> where CloneVol identifies the name of the FlexClone volume that is being created. For example. Chapter 4. including Snapshot copies. manual update is not required. to create a clone volume named dbdata_cl from the Snapshot copy named dbdata_cl_snp. an update is immediately started from the source to the destination to update the destination volume with the contents of the source volume. It is recommended not to use these automatically created Snapshot copies to create a clone volume. ParentVol identifies the name of the FlexVol volume that is the source for the clone volume. you would execute the following command on the destination storage system: vol clone create dbdata_cl -s volume -b dbdata dbdata_cl_snp. therefore.1 of the volume named dbdata. After the SnapMirror update. Cloning a DB2 UDB Database in the N series Environment 61 . Important: Snapshot copies are also created automatically for SnapMirror update purpose.

PathName identifies the name assigned to the flexible volume.4. The export entry can be created by executing the following command on the IBM N series storage system: exportfs -p rw=[HostName].rsize=32768. FlexVolName identifies the name assigned to the clone volume. For example.root=[HostName] [PathName] where HostName identifies the name assigned to the database server.tcp 0 0 where StorageSystemName identifies the name assigned to the storage system that is used for the database storage.root=hostdst /vol/dbdata_cl Repeat this step to create an export entry for each clone volume that is used for the clone database. you need to mount it to a database server. In order to access the clone database. 4. The mount entry should specify the mount options and it should look similar to the following: [StorageSystemName]:[FlexVolName] [MountPoint] nfs hard. you would append the following entry to the /etc/fstab file on the database sever: srcstore:dbdata_cl /mnt/dbdata_cl nfs hard.bg.4.bg.rw.rsize=32768.nointr. to create an export entry for a clone volume named dbdata_cl and allow root access from the database server named hostdst for it. for a clone volume named dbdata_cl that resides on the storage system named srcstore.clone.fm Draft Document for Review August 23. 2006 6:37 pm 4. you would execute the following command on the storage system: exportfs -p rw=hostdst. In order to mount a clone volume to the database server.5 Mount the clone volumes. First. MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server.tcp 0 0 62 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . you create a mount point for each clone volume and append a mount entry to the /etc/fstab file.rw.vers=3.vers=3. For example.wsize=32768.nointr. you need to create an export entry for it in the /etc/exports file that resides on the NetApp FAS or IBM N Series storage system.wsize=32768.4 Create NFS export entries for the cloned volumes.

2006 6:37 pm clone. you need to create Snapshot copies of the FlexVol volumes on the SnapMirror source storage system and update the SnapMirror relationship manually.In the SnapMirror relationship.6 Configure the cloned database. therefore. to mount a clone volume that has mount entry specified in the /etc/fstab file. to create a clone database on a remote IBM N series storage system. In order to operate DB2 successfully. you would execute the following command on the database server named hostdst: chown -R db2inst1:db2adm /mnt/dbdata_cl 4.Draft Document for Review August 23. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl. you can mount the clone volume by executing the following command on the database server: mount [MountPoint] where MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance. For example.4.fm After appending the mount entry. Cloning a DB2 UDB Database in the N series Environment 63 . “Create clones of the FlexVol volumes on the remote storage system. FileSystem identifies the name of the files system whose ownership is to be changed. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance. including Snapshot Chapter 4. For example. the DB2 instance owner should have ownership of the file systems on the clone volumes that are mounted on the database server. The SnapMirror update operation replicates data. the destination volumes are read-only. The clone volumes created in Part . you would execute the following command on the second database server named hostdst: mount /mnt/dbdata_cl The database servers we used had Linux operating systems.

5. You can skip the part (A) and (B) of this step if following two conditions are true for you environment: 1.fm Draft Document for Review August 23.4. to the SnapMirror destination storage system.” on page 62 of this section are going to be used as the storage containers for the cloned database.clone. The mount points that are used to mount the clone volumes have same name as the mount points that are used to mount volumes of the production database. In order to access the clone database from a different instance name you need to change the default tablespace container's path name by executing following command on the database server: mv [DBDir]/[OldInstanceName]/NODE000n [DBDir]/[NewInstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on. and the replicated Snapshot copy can be used to create the clone volume. 2. TEMPSPACE1. Here are the detailed steps:” on page 59 and mount in the Part 4. A. 2006 6:37 pm copies. InstanceName identifies the name assigned to the DB2 instance the database belongs to. For example. you have to create a DB2 instance with a new name if an existing DB2 instance name is same as the production DB2 instance name. The name of the DB2 instance used for the clone database is same as the production or source database instance name. if the DB2 instance name is db2inst1 and the database was created on the directory named /mnt/dbdata. By default when database is created. /mnt/dbdata/db2inst1/NODE0000 For a database server the DB2 instance name has to be unique. OldInstanceName identifies the name assigned to the DB2 instance the production database belongs to. the default tablespace containers will reside in the following directory. 64 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . the tablespaces containers for the default tablespaces (SYSCATSPACE. “Mount the clone volumes. and USERSPACE1) reside in the following directory: [DBDir]/[InstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on. Therefore.

Now you need to change the database name and tablespace containers header information using the db2inidb command as specified in section 1. the clone database becomes available after executing db2start. it has its data on /mnt/dbdata_cl and logs on /mnt/dblogs_cl. you would execute the following command on the database server to change the path: mv /mnt/dbdata_cl/db2inst1 /mnt/dbdata_cl/db2instc B. 2006 6:37 pm clone. Save the configuration file as /home/db2inst1/dbrelocate. To do this. A sample configuration file for this scenario should look something like Example 4-10.cfg C. The clone database is to be renamed to mydbcl.4.cfg and execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate. DB_NAME=mydb. The source database instance name is db2inst1 and clone database instance name is db2instc.db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. the source database name is mydb and it has its logs on /mnt/dblogs and data on /mnt/dbdata .fm NewInstanceName identifies the name assigned to the DB2 instance the clone database belongs to. to access the clone database from the instance named db2instc. Cloning a DB2 UDB Database in the N series Environment 65 .Draft Document for Review August 23./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*. Chapter 4. For example./mnt/dbdata_cl INSTANCE=db2inst1. you will need to create a configuration file that identifies the source database information and specifies the new clone database information.mydbcl DB_PATH=/mnt/dbdata. Start the database manager instance you created for the migration test environment by executing the following command on the database server: db2start If the production database was offline while the Snapshot copies were created./mnt/dbdata_cl/* Example 4-10 configuration file In this configuration file.

DatabaseAlias identifies the alias name assigned to the database that is being cataloged. Therefore. FileSystem specifies the path on which the database being cataloged resides. Therefore.Catalog the source database If the cloned database is accessed from same DB2 instance as the production database on the production database server. then on execution the db2relocatedb command uncatalogs the source database.7 Catalog the source database If the cloned database is accessed from same DB2 instance as the production database on the production database server. DatabaseAlias identifies the alias name assigned to the database that is being cataloged. you can connect to the clone database and start using it. FileSystem specifies the path on which the database being cataloged resides. (7). For example.clone.fm Draft Document for Review August 23. 66 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . you need to catalog the source database by executing the following command on the database server: db2 "catalog database [DatabaseName] as [DatabaseAlias] on [FileSystem]" where DatabaseName identifies the name assigned to the database that is being cataloged. 2006 6:37 pm The production database was offline during the Snapshot creation process. then on execution the db2relocatedb command uncatalogs the source database. you need to catalog the source database by executing the following command on the database server: db2 "catalog database [DatabaseName] as [DatabaseAlias] on [FileSystem]" where DatabaseName identifies the name assigned to the database that is being cataloged.4. to recatalog a source database named mydb that resides on file system named /mnt/dbdata. you would execute the following command on the database server: db2 "catalog database mydb as mydb on /mnt/dbdata" 4. Therefore.

4. “Configure a UNIX host to access both the clone and the source databases in a NAS environment” on page 111.” on page 53 and Part 4.5. 4. Chapter 4.4. You can do so by executing the following command on the database server: db2dart [DatabaseName] /db where DatabaseName identifies the name of the clone database used for the test environment. The step-by-step cloning process is described in the following subsections. “Configure SnapMirror. For example. you would learn how to create a clone database on a remote storage system when the source database is online. If the source and the clone database need to be accessed from the same database server.2.Draft Document for Review August 23. you would execute the following command on the database server: db2 "catalog database mydb as mydb on /mnt/dbdata" 4. 2006 6:37 pm clone.5 Clone an online database to a remote storage system In this section. The report is generated in the <$HOME>/sqllib/db2dump/DART0000/ directory. You can read the summary and find out the errors. After performing the above steps. you need to check the entire database for architectural correctness. The steps necessary to configure and initialize a SnapMirror relationship are described in Part 4. if any. 4.fm For example. to recatalog a source database named mydb that resides on file system named /mnt/dbdata. The report has a summary at the end of report.1 Configure and initialize SnapMirror. to test the database named mydbcl you would execute the following command on the database server: db2dart mydbcl /db The db2dart utility inspects the entire database for architectural correctness and generates a detailed report.4. then you need to complete the additional steps described in Appendix A. Cloning a DB2 UDB Database in the N series Environment 67 .1.8 Verify the cloned database.

Read-only transactions continue uninterrupted. provided that they do not request a resource that is being held by the suspended I/O process.2 Bring the source database into a consistent state (suspend writes).5. 68 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .1 It is recommended that you develop a naming convention and assign a meaningful name to the Snapshot copies that are created for cloning purposes. For example.fm Draft Document for Review August 23. you would execute the following command on the storage system: snap create dbdata dbdata_cl_snp.” on page 56 respectively. The cloning process is completed very quickly. Therefore. 4. SnapName identifies the name that is assigned to the Snapshot copy. The source database is online. Create a Snapshot copy of each FlexVol volume that is used for the source database by executing the following command on the source storage system: snap create [VolName] [SnapName] where VolName identifies the name assigned to the FlexClone volume that is to be created. so the database doesn't need to stay in write suspend mode for more than a few seconds. you should have working SnapMirror relationships for the volumes that are used for the database to be cloned. you must temporarily suspend the write operations to the database by executing the following command on the database server: db2 set write suspend for database The SET WRITE SUSPEND FOR DATABASE command causes the DB2 database manager to suspend all write operations to tablespace containers and log files that are associated with the current database. After completing these steps. in order to prevent partial page writes while database cloning is in progress.3 Create Snapshot copies of the FlexVol volumes. 4.5.clone. to create a Snapshot copy named dbdata_cl_snap01for a FlexVol volume named dbdata. 2006 6:37 pm “Initialize SnapMirror.

5. DestinationStorageSystem identifies the name assigned to the SnapMirror destination storage system. 2006 6:37 pm clone. VolumeName identifies the name assigned to the volume that is being used as the SnapMirror destination.5.fm Important: The Snapshot copies are created on the SnapMirror source storage system. to update SnapMirror for a volume named dbdata. you would execute the following command on the SnapMirror destination storage system named dststore: snapmirror -S srcstore:dbdata update dststore:dbdata Update the SnapMirror relationship for each volume that is used for the database. an update is immediately started from the source to the destination to update the destination volume with the contents of the source volume. including Snapshot copies For synchronous SnapMirror. When the update command is executed for an asynchronous SnapMirror. 4.Draft Document for Review August 23. you need to resume write operations to the database by executing the following command on the database server: db2 set write resume for database 4.4 Resume normal database operations (resume writes). manual update is not required. Once the Snapshot copies are created. the Snapshot copy created on the source volume becomes available on the destination volume immediately. For example. Cloning a DB2 UDB Database in the N series Environment 69 . Chapter 4. Now update the SnapMirror destination volumes manually by executing the following command on the destination storage system: snapmirror < -S [SourceStorageSystem]:[VolumeName]> update [DestinationStorageSystem]:[VolumeName] where SourceStorageSystem identifies the name assigned to the SnapMirror source storage system.5 Update the SnapMirror destination. therefore.

ParentSnap identifies the name of the parent FlexVol volume Snapshot copy that is used as the source for the clone volume. A clone volume can be created from the Snapshot copy by executing the following command on the destination storage system: vol clone create [CloneVol] -s volume -b [ParentVol] <ParentSnap> where CloneVol identifies the name of the FlexClone volume that is being created. It is recommended not to use these automatically created Snapshot copies to create a clone volume. the SnapMirror relationship will fail. you would execute the following command on the destination storage system: vol clone create dbdata_cl -s volume -b dbdata dbdata_cl_snp.1 of the volume named dbdata.root=[HostName] [PathName] where HostName identifies the name assigned to the database server. PathName identifies the name assigned to the flexible volume. After the SnapMirror update.5.6 Create clone volumes using Snapshot copies. to create a clone volume named dbdata_cl from the Snapshot copy named dbdata_cl_snp. ParentVol identifies the name of the FlexVol volume that is the source for the clone volume. 4.clone. 2006 6:37 pm Important: Snapshot copies are also created automatically for SnapMirror update purposes. you need to create an export entry for it in the /etc/exports file that resides on the NetApp FAS or IBM N Series storage system.1 Important: The Snapshot copy on the SnapMirror source storage system should not be deleted. In order to mount a clone volume to the database server.7 Create NFS export entries for the cloned volumes.5. 4. each destination volume has a Snapshot copy that was created on the source storage system and replicated to the destination.fm Draft Document for Review August 23. 70 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . The export entry can be created by executing the following command on the IBM N Series storage system: exportfs -p rw=[HostName]. otherwise. For example.

you need to mount the clone volumes to a database server.8 Mount the cloned volumes. First. 2006 6:37 pm clone. In order to access the clone database. MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server.5. Cloning a DB2 UDB Database in the N series Environment 71 .bg. The mount entry should specify the mount options.root=hostdst /vol/dbdata_cl Repeat this step to create an export entry for each clone volume that is used for the clone database.rw.tcp 0 0 After appending the mount entry. you create a mount point for each clone volume and append a mount entry to the /etc/fstab file. FlexVolName identifies the name assigned to the clone volume.bg. you can mount the clone volume by executing the following command on the database server: mount [MountPoint] where MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server. you would execute the following command on the second database server named hostdst: mount /mnt/dbdata_cl Chapter 4.wsize=32768.fm For example.rw. to create an export entry for a clone volume named dbdata_cl and allow root access from the database server named hostdst for it. to mount a clone volume that has a mount entry specified in the /etc/fstab file. you would append the following entry to the /etc/fstab file on the database sever: srcstore:dbdata_cl /mnt/dbdata_cl nfs hard.wsize=32768. 4. for a clone volume named dbdata_cl that resides on a storage system named srcstore.tcp 0 0 where StorageSystemName identifies the name assigned to the storage system that is used for the database storage. For example.nointr.rsize=32768.Draft Document for Review August 23.vers=3.vers=3. and it should look similar to the following: [StorageSystemName]:[FlexVolName] [MountPoint] nfs hard. you would execute the following command on the storage system: exportfs -p rw=hostdst.nointr. For example.rsize=32768.

5. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance. the DB2 instance owner should have ownership of the file systems on the clone volume that is mounted on the database server.9 Configure the cloned database The clone volumes created in the Part 4. and USERSPACE1) reside in the following directory: [DBDir]/[InstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on.5. the tablespaces containers for the default tablespaces (SYSCATSPACE.5. TEMPSPACE1.” on page 70 and mount in the Part 4. By default when database is created.6. FileSystem identifies the name of the files system whose ownership is changed. The mount points that are used to mount the clone volumes have same name as the mount points that are used to mount volumes of the production database.8. 72 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .” on page 71 of this section are going to be used as the storage containers for the cloned database. For example. you would execute the following command on the database server named hostdst: chown -R db2inst1:db2adm /mnt/dbdata_cl 4.clone. 2006 6:37 pm The database servers we used had a Linux operating system. 2. In order to operate DB2 successfully. “Create clone volumes using Snapshot copies.fm Draft Document for Review August 23. The name of the DB2 instance used for the clone database is same as the production or source database instance name. You can skip the part (A) and (B) of this step if following two conditions are true for you environment: 1. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance. “Mount the cloned volumes. A.

A sample configuration file for this scenario should look something like Example 4-11this: Chapter 4. you have to create a DB2 instance with a new name if an existing DB2 instance name is same as the production DB2 instance name. if the DB2 instance name is db2inst1 and the database was created on the directory named /mnt/dbdata. the default tablespace containers will reside in the following directory. you would execute the following command on the database server to change the path: mv /mnt/dbdata_cl/db2inst1 /mnt/dbdata_cl/db2instc B.fm InstanceName identifies the name assigned to the DB2 instance the database belongs to.Draft Document for Review August 23.4. Now you need to change the database name and tablespace containers header information using the db2inidb command as specified in section 1. to access the clone database from the instance named db2instc. OldInstanceName identifies the name assigned to the DB2 instance the production database belongs to. NewInstanceName identifies the name assigned to the DB2 instance the clone database belongs to. 2006 6:37 pm clone. For example. you will need to create a configuration file that identifies the source database information and specifies the new clone database information. /mnt/dbdata/db2inst1/NODE0000 For a database server the DB2 instance name has to be unique. For example. Cloning a DB2 UDB Database in the N series Environment 73 . Therefore. To do this. In order to access the clone database from a different instance name you need to change the default tablespace container's path name by executing following command on the database server: mv [DBDir]/[OldInstanceName]/NODE000n [DBDir]/[NewInstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on.

db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. the source database name is mydb and it has its logs on /mnt/dblogs and data on /mnt/dbdata .cfg C.clone. Start the database manager instance you created for the migration test environment by executing the following command on the database server: db2start If the production database was offline during the Snapshot copy process.cfg and execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate. You can do this by executing the following command on the database server: db2inidb database [DatabaseName] as snapshot where DatabaseName identifies the name of the clone database that is going to be used for the test environment./mnt/dbdata_cl/* Example 4-11 configuration file In this configuration file. to initialize a clone database named mydbcl.mydbcl DB_PATH=/mnt/dbdata. it has its data on /mnt/dbdata_cl and logs on /mnt/dblogs_cl. The clone database is to be renamed to mydbcl.fm Draft Document for Review August 23. the clone database becomes available after executing db2start. For example. you would execute the following commands on the database server: 74 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . you need to use the db2inidb utility to initialize the clone database as a snapshot. Therefore. 2006 6:37 pm DB_NAME=mydb./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*./mnt/dbdata_cl INSTANCE=db2inst1. The source database instance name is db2inst1 and clone database instance name is db2instc. The production database was online when the Snapshot copies were created. Save the configuration file as /home/db2inst1/dbrelocate.

You can read the summary and find out the errors. then you need to complete the additional steps described in Appendix A. Cloning a DB2 UDB Database in the N series Environment 75 .5.10 Verify the cloned database.Draft Document for Review August 23. “Configure a UNIX host to access both the clone and the source databases in a NAS environment” on page 111. Chapter 4. to test the database named mydbcl you would execute the following command on the database server: db2dart mydbcl /db The db2dart utility inspects the entire database for architectural correctness and generates a detailed report. you need to check the entire database for architectural correctness. The report has a summary at the end of report.fm db2inidb mydbcl as snapshot 4. The report is generated in the <$HOME>/sqllib/db2dump/DART0000/ directory. 2006 6:37 pm clone. You can do so by executing the following command on the database server: db2dart [DatabaseName] /db where DatabaseName identifies the name of the clone database used for the test environment. If the source and the clone database need to be accessed from the same database server. if any. After performing the above steps. For example.

2006 6:37 pm 76 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .fm Draft Document for Review August 23.clone.

77 . 5.1 Clone an offline database on the same storage system In order to clone a DB2 database that is offline. All rights reserved.1. Cloning a DB2 UDB Database in the SAN Environment 5. you would execute the following command on the database server: db2 force applications all © Copyright IBM Corp. Bring the database offline by terminating all the application connections to the database that is to be cloned by executing the following command on the database server: db2 force applications all For example.1 Bring the source database offline. you need to complete the following steps. 2006 6:37 pm 7323san.Draft Document for Review August 23.fm 5 Chapter 5. to terminate all application connections. 2006.

you would execute the following command on the storage system: snap create dbdata dbdata_cl_snp. to create a clone volume of a FlexVol volume named dblogs using the Snapshot copy named dbdata_cl_snp. 5. to create a Snapshot copy named dbdata_snap.01for a FlexVol volume named dbdata. SnapName identifies the name that is assigned to the Snapshot copy.1.7323san. you can connect to the source database and start using it.3 Start the source database Once the Snapshot copies of the FlexVol volumes of the source database is created.01 It is recommended that you develop a naming convention and assign a meaningful name to the Snapshot copies that are created for cloning purposes. Once the Snapshot copies are created.2 Create Snapshot copies of the FlexVol volumes. you need to create a clone of each FlexVol volume that contains the database's data or transaction log files by executing the following command on the storage system: vol clone create [CloneVol] -s volume -b [ParentVol] <ParentSnap> where CloneVol identifies the name assigned to the new clone volume. ParentVol identifies the name assigned to the FlexVol volume that is to be cloned.fm Draft Document for Review August 23. 5.1. For example. Create a Snapshot copy of each volume that is used for the database by executing the following command on the source storage system: snap create [VolName] [SnapName] where VolName identifies the name assigned to the FlexClone volume that is to be created. For example.01.1. 2006 6:37 pm 5.4 Create clone volumes using Snapshot copies. you would execute the following command on the storage system: 78 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . ParentSnap identifies the name assigned to the snapshot copy that is used as the base for the clone volume.

When a clone volume is created. mapped) Example 5-1 lun show The LUN mappings can be listed by executing the following command on the storage system: lun show -m The output from the lun show -m command should look similar to Example 5-2. You can see the LUN status by executing the following command on the storage system: lun show The output from the lun show command should look similar to Example 5-1. a Snapshot copy will be implicitly created and used for the clone volume. online.Draft Document for Review August 23. you would execute the following command on the storage system: vol clone create dbdata_cl -s volume -b dbdata A Snapshot copy that is used as the base for the clone volume can't be deleted as long as the clone exists. mapped) /vol/dbdata_cl/data 15g (16106127360) (r/w. We recommend explicitly creating a Snapshot and assigning it a meaningful name before creating a clone FlexVol volume.01 Note: A Snapshot copy is not required to create a clone of a FlexVol volume . 5. Cloning a DB2 UDB Database in the SAN Environment 79 .5 Create new mapping for the LUNs. offline. by default. For example. Chapter 5.fm vol clone create dbdata_cl -s volume -b dbdata dbdata_cl_snp.1. lun show /vol/dbdata/data 15g (16106127360) (r/o. A Snapshot copy created implicitly will have a system assigned name. 2006 6:37 pm 7323san. LUNs residing on it have the same mapping as the source FlexVol volume LUNs. to create a clone volume of a FlexVol volume named dbdata.if you don't explicitly create a Snapshot copy and specify it when executing the vol clone command. and they are placed offline.

The FlexClone volume LUNs can be accessed from the same database server used to access the source database.map. you need to complete the following steps: 1. 2006 6:37 pm lun show -m LUN path Mapped to LUN ID Protocol --------------------------------------------------------------/vol/dbdata/data host_src_fcp_igp 0 FCP /vol/dbdata_cl/data host_src_fcp_igp 0 FCP Example 5-2 lun show -m You can see from the output that the LUNs on the clone volume have the same mapping as the parent. you would execute the following command on the storage system: lun unmap /vol/dbdata_cl/data host_src_fcp_igp You should see a message similar to Example 5-3 Thu Aug 3 09:37:10 MST [lun. to remove old mapping for a LUN named /vol/dbdata_cl/data from an igroup named host_src_fcp_igp. The scenarios described in this paper were produced using a second database sever to access the clone database. For example.fm Draft Document for Review August 23. GroupName identifies the name assigned to the initiator group for the database host that is used to access the database. In order to access the clone database from a second database server.unmap:info]: LUN /vol/voldbdata_cl/data unmapped from initiator group host_src_fcp_igp 80 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . or from a completely different server.7323san. Remove the old mapping for each LUN that exists on the clone volume by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] where LunPath identifies the name assigned to the new clone volume.

Refresh the HBA driver on the database server.Draft Document for Review August 23. 1. you would execute the following command on the storage system: lun online /vol/dbdata_cl/data 5. Cloning a DB2 UDB Database in the SAN Environment 81 . iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database.fm 2. you would execute the following command on the storage system: lun map /vol/dbdata_cl/data host_dst_fcp_igp 0 You will see messages similar to Example 5-4.6 Mount the FlexClone volume LUNs. to bring a LUN named /vol/dbdata_cl/data online. you would execute the following commands on the database server: Chapter 5.1. Create a new mapping for the LUNs on the clone volume by using a new ID and/or by mapping them to a new igroup. lun map: auto-assigned host_dst_fcp_igp=4 Example 5-4 lun map message 3. LunId identifies a numeric ID that is assigned to the LUN for mapping it to a specific initiator group. 2006 6:37 pm Example 5-3 unmap messages 7323san. For example. to map a LUN named /vol/dbdata_cl/data to an igroup named host_dst_fcp_igp. For example. For example. each LUN that is on the clone volume and that is used for the clone database needs to be brought online by executing the following command on the storage system: lun online [LunPath] where LunPath identifies the name assigned to the new clone volume. to refresh a Qlogic FC HBA on a Linux database host. After remapping. A LUN mapping can be created by executing the following command on the storage system: lun map [LunPath] [iGroupName] [LunId] where LunPath identifies the name assigned to the new clone volume.

9g (25715277824) itsotuc2: /vol/db2datacl/lun FCP 39. refer to the OS reference manual and the HBA installation guide.0g (8571060224) itsotuc2: /vol/db2logscl/lun FCP 23.fm modprobe -r qla2300 modprobe -v qla2300 Draft Document for Review August 23.ELsmp/kernel/drivers/scsi/scsi_transport_fc. 82 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . Mount LUN devices by executing the following command on the database server: mount [DeviceName] [MountPoint] where DeviceName identifies the name assigned to the new clone volume. 2.9g (42858446848) itsotuc2: /vol/db2logsnfs/lun FCP 8.9-34.0g (8571060224) itsotuc2: /vol/db2logs/lun FCP 23.ELsmp/kernel/drivers/scsi/qla2xxx/qla2xxx.9-34.6.7323san. sanlun lun show filer: lun-pathname Protocol lun size itsotuc2: /vol/db2data/lun FCP 39.9g (25715277824) Example 5-6 sanlun lun show device filename lun state hdisk14 GOOD hdisk16 GOOD hdisk15 GOOD hdisk18 GOOD hdisk17 GOOD hdisk19 GOOD adapter fcs1 fcs1 fcs1 fcs1 fcs1 fcs1 3.6.ELsmp/kernel/drivers/scsi/qla2xxx/qla2300.6.ko Example 5-5 modprobe For any other operating system (OS) and HBA.ko insmod /lib/modules/2.ko insmod /lib/modules/2.9g (42858446848) itsotuc2: /vol/db2datanfs/lun FCP 8. 2006 6:37 pm You should see messages similar to Example 5-5. Obtain the device names for the LUNs by executing the following command on the database server that is to be used to access the clone database: sanlun lun show You should receive a output similar to Example 5-6.9-34. insmod /lib/modules/2.

2. You can skip the parts (A) and (B) of this step if following two conditions are true for you environment: 1. 2006 6:37 pm 7323san. to mount a LUN device that is identified by the name /dev/sdb by the database server.7 Configure the cloned database The LUNs that resides on the FlexClone volume created in Part 5. “Create clone volumes using Snapshot copies. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance. For example. the tablespaces containers for the default tablespaces (SYSCATSPACE. Cloning a DB2 UDB Database in the SAN Environment 83 .fm MountPoint identifies the name assigned to the mount point that is used to mount the LUN device. By default when database is created.Draft Document for Review August 23. and USERSPACE1) reside in the following directory: Chapter 5. For example. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl.6.1.” on page 78 and mounted in Part 5. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance. the DB2 instance owner should have ownership of the LUN file systems mounted on the database server.” on page 81 of this section are going to be used as the storage containers for the cloned database. A. The mount points that are used to mount the LUNs on the FlexClone volumes have the same name as the mount points that are used to mount the LUNs on the FlexVol volumes used for the production database. “Mount the FlexClone volume LUNs. you would execute the following command on the database server named hostdst: chown -R db2inst1:db2adm /mnt/dbdata_cl 5.1.4. you would execute the following command on the database server: mount /dev/sdb /mnt/dbdata 4. The name of the DB2 instance used for the clone database is same as the production or source database instance name.1. TEMPSPACE1. FileSystem identifies the name of the file system whose ownership is changed. In order to operate DB2 successfully.

For example. To do this. 2006 6:37 pm [DBDir]/[InstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on. you will need to create a configuration file that identifies the source database information and specifies the new clone database information. 84 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . you have to create a DB2 instance with a new name if an existing DB2 instance name is same as the production DB2 instance name. “The db2inidb command” on page 16. OldInstanceName identifies the name assigned to the DB2 instance the production database belongs to. Now you need to change the database name and tablespace containers header information using the db2inidb command as specified in Part 1. For example. In order to access the clone database from a different instance name you need to change the default tablespace container's path name by executing following command on the database server: mv [DBDir]/[OldInstanceName]/NODE000n [DBDir]/[NewInstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on. if the DB2 instance name is db2inst1 and the database was created on the directory named /mnt/dbdata.fm Draft Document for Review August 23. A sample configuration file for this scenario should look something like Example 5-7. NewInstanceName identifies the name assigned to the DB2 instance the clone database belongs to.5. to access the clone database from the instance named db2instc. you would execute the following command on the database server to change the path: mv /mnt/dbdata_cl/db2inst1 /mnt/dbdata_cl/db2instc B. Therefore. InstanceName identifies the name assigned to the DB2 instance the database belongs to. the default tablespace containers will reside in the following directory. /mnt/dbdata/db2inst1/NODE0000 For a database server the DB2 instance name has to be unique.7323san.

fm DB_NAME=mydb.cfg C. the LUNs on the clone volume are accessed using FCP. The production database was offline during the Snapshot creation process. The source database instance name is db2inst1 and clone database instance name is db2instc. you can connect to the clone database and start using it.mydbcl DB_PATH=/mnt/dbdata.Draft Document for Review August 23. the source database name is mydb and it has its logs on /mnt/dblogs and data on /mnt/dbdata ./mnt/dbdata_cl INSTANCE=db2inst1. Save the configuration file as /home/db2inst1/dbrelocate.cfg and execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate. it has its data on /mnt/dbdata_cl and logs on /mnt/dblogs_cl. If the source and the clone database need to be accessed from the same database server. then you need to complete the additional steps described in the Appendix B. 2006 6:37 pm 7323san. Chapter 5. your database is ready to use and you can connect and verify the database. the clone database becomes available after executing db2start. Cloning a DB2 UDB Database in the SAN Environment 85 . “Configure a UNIX host to access both the clone and the source databases in a SAN environment” on page 117. Therefore./mnt/dbdata_cl/* Example 5-7 configuration file In this configuration file. After these steps. Start the database manager instance you created for the migration test environment by executing the following command on the database server: db2start If the production database was offline while the Snapshot copies were created./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*. but they can be accessed using the iSCSI access protocol as well. In this scenario.db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. The clone database is to be renamed to mydbcl.

5.2. you need to complete the following steps. SnapName identifies the name that is assigned to the Snapshot copy. to create a Snapshot copy named dbdata_snap01 for a FlexVol volume named dbdata.1 Bring the source database into a consistent state (suspend writes). The FlexVol volume clone process is completed very quickly.2 Clone an online database on the same storage system In order to create a clone on an online DB2 database on the same storage system in a SAN environment. the source database is online. For example.7323san. you need to create a Snapshot copy for each FlexVol volume that consists of LUNs that are used for the production database. 86 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . 2006 6:37 pm 5. provided that they do not request a resource that is being held by the suspended I/O process.2. so the database doesn't need to stay in write suspend mode for more than a few seconds. to prevent partial page writes while database cloning is in progress. the write operations to the database need to be temporarily suspended by executing the following command on the database server: db2 set write suspend for database The SET WRITE SUSPEND FOR DATABASE command causes the DB2 database manager to suspend all write operations to the current database. Therefore. In this scenario.2 Create Snapshot copies of the FlexVol volumes. 5.1 It is recommended that you develop a naming convention and assign a meaningful name to the Snapshot copies that are created for cloning purposes. Read-only transactions continue uninterrupted.fm Draft Document for Review August 23. Therefore. A Snapshot copy of a FlexVol volume can be created by executing the following command on the storage system snap create [VolName] [SnapName] where VolName identifies the name assigned to the FlexClone volume that is to be created. you would execute the following command on the storage system: snap create dbdata dbdata_cl_snp. The LUNs reside within a FlexVol volume.

2006 6:37 pm 7323san. Cloning a DB2 UDB Database in the SAN Environment 87 .2. create a clone of each FlexVol volume by using the Snapshot copies created in step Part 5. you would execute the following command on the storage system: vol clone create dbdata_cl -s volume -b dbdata dbdata_cl_snp. 5. to create a clone of a FlexVol volume named dblogs by using its existing Snapshot copy named dbdata_cl_snp. The LUNs on the clone volume have the same mapping as the LUNs on the source volume.1 The Snapshot copy that is used as the base for the clone volume can't be deleted as long as the clone volume exists. Remove the old mapping for each LUN that exists on the clone volume by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] where Chapter 5. In order to create new mapping for LUNs on the FlexClone volumes you need to complete following steps: 1.” on page 86. you need to resume write operations to the database by executing the following command on the database server: set write resume for database 5.2. ParentVol identifies the name of the FlexVol volume that is the source for the clone volume. Next.3 Resume normal database operation (resume writes).2. a clone volume is a writable Snapshot copy.4 Clone the FlexVol volumes using Snapshot copies. and at the time of clone creation.5 Create new mapping for the LUNs. A clone volume can be created by executing the following command on the storage system: vol clone create [CloneVol] -s volume -b [ParentVol] <ParentSnap> where CloneVol identifies the name of the FlexClone volume that is being created. For example. “Create Snapshot copies of the FlexVol volumes. Once Snapshot copies are created.2. As noted earlier. ParentSnap identifies the name of the parent FlexVol volume Snapshot copy that is used as the source for the clone volume. and they are set offline.Draft Document for Review August 23.2.fm 5.1. it has data that is exactly similar to that of the source volume.

For example.2. iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database. A LUN mapping can be created by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] [LunId] where LunPath identifies the name assigned to the new clone volume. LunId identifies a numeric ID that is assigned to the LUN for mapping it to a specific initiator group. to map a LUN named /vol/dbdata_cl/data to an igroup named host_dst_fcp_igp.6 Mount the LUNs that reside on the FlexClone volumes. For example. iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database. you need to complete following steps: 88 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .7323san. In order to mount the LUNs that reside on the FlexClone volumes. 2006 6:37 pm LunPath identifies the name assigned to the new clone volume. you would execute the following command on the storage system: lun online /vol/dbdata_cl/data 5. you would execute the following command on the storage system: lun map /vol/dbdata_cl/data host_dst_fcp_igp 0 3. to remove old mapping for a LUN named /vol/dbdata_cl/data from an igroup named host_src_fcp_igp.fm Draft Document for Review August 23. For example. each LUN that is on the clone volume and that is used for the clone database needs to be brought online by executing the following command on the storage system: lun online [LunPath] where LunPath identifies the name assigned to the new clone volume. After remapping. to bring a LUN named /vol/dbdata_cl/data online. Create a new mapping for the LUNs on the clone volume by using a new ID and/or by mapping them to a new igroup. you would execute the following command on the storage system: lun unmap /vol/dbdata_cl/data host_src_fcp_igp 2.

In order to operate DB2 successfully. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance. you would execute the following command on the database server: mount /dev/sdb /mnt/dbdata 4. 2. MountPoint identifies the name assigned to the mount point that is used to mount the LUN device. Chapter 5. to refresh a Qlogic FC HBA on a Linux database host. Cloning a DB2 UDB Database in the SAN Environment 89 . refer to the OS reference manual and the HBA installation guide.fm 1. Obtain the LUN device names by executing the following command on the database server that is to be used to access the clone database: sanlun lun show 3. you would execute the following commands on the database server: modprobe -r qla2300 modprobe -v qla2300 For any other operating system (OS) and HBA. Mount the LUN devices by executing the following command on the database server: mount [DeviceName] [MountPoint] where DeviceName identifies the name assigned to the new clone volume. to mount a LUN device that is identified by the name /dev/sdb by the database server. For example. the DB2 instance owner should have ownership of the LUN file systems mounted on the database server.Draft Document for Review August 23. Refresh the HBA driver on the database server. For example. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance. 2006 6:37 pm 7323san. FileSystem identifies the name of the files system whose ownership is changed.

2. “Clone the FlexVol volumes using Snapshot copies. The mount points that are used to mount the clone volumes have same name as the mount points that are used to mount volumes of the production database. /mnt/dbdata/db2inst1/NODE0000 For a database server the DB2 instance name has to be unique. you have to create a DB2 instance with a new name if an existing DB2 instance name is same as the production DB2 instance name. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl. A.7 Configure the cloned database.2. Therefore. The clone volumes created in the Part 5. and USERSPACE1) reside in the following directory: [DBDir]/[InstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on.7323san. By default when database is created. InstanceName identifies the name assigned to the DB2 instance the database belongs to.4.” on page 87 and mount in the step Part 5. The name of the DB2 instance used for the clone database is same as the production or source database instance name. if the DB2 instance name is db2inst1 and the database was created on the directory named /mnt/dbdata. TEMPSPACE1. “Mount the LUNs that reside on the FlexClone volumes. 2. you would execute the following command on the database server named hostdst: chown -R db2inst1:db2adm /mnt/dbdata_cl 5.2. You can skip the parts (A) and (B) of this step if following two conditions are true for you environment: 1. the default tablespace containers will reside in the following directory. the tablespaces containers for the default tablespaces (SYSCATSPACE.” on page 88 of this section are going to be used as the storage containers for the cloned database.6. In order to access the clone database from a different instance name you need to change the default tablespace container's path name by executing following command on the database server: mv [DBDir]/[OldInstanceName]/NODE000n [DBDir]/[NewInstanceName]/NODE000n 90 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . 2006 6:37 pm For example.fm Draft Document for Review August 23. For example.

fm where: DBDir identifies the name assigned to the directory/device the database is created on. Now you need to change the database name and tablespace containers header information using the db2inidb command as specified in section 1. The clone database is to be renamed to mydbcl. Start the database manager instance you created for the migration test environment by executing the following command on the database server: Chapter 5.cfg and execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate. NewInstanceName identifies the name assigned to the DB2 instance the clone database belongs to. OldInstanceName identifies the name assigned to the DB2 instance the production database belongs to./mnt/dbdata_cl/* Example 5-8 configuration file In this configuration file.4. 2006 6:37 pm 7323san. you would execute the following command on the database server to change the path: mv /mnt/dbdata_cl/db2inst1 /mnt/dbdata_cl/db2instc B.Draft Document for Review August 23.mydbcl DB_PATH=/mnt/dbdata.db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. A sample configuration file for this scenario should look like Example 5-8. you will need to create a configuration file that identifies the source database information and specifies the new clone database information. For example. DB_NAME=mydb. it has its data on /mnt/dbdata_cl and logs on /mnt/dblogs_cl./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*.cfg C. Cloning a DB2 UDB Database in the SAN Environment 91 . The source database instance name is db2inst1 and clone database instance name is db2instc. to access the clone database from the instance named db2instc. To do this./mnt/dbdata_cl INSTANCE=db2inst1. Save the configuration file as /home/db2inst1/dbrelocate. the source database name is mydb and it has its logs on /mnt/dblogs and data on /mnt/dbdata .

After completing these steps. but they can be accessed using the iSCSI access protocol as well.4. For example.1. the clone database is ready for use. you need to use the db2inidb utility to initialize the clone database as a snapshot.3. You can connect to the database and perform data verification.3 Clone an offline database to a remote storage system In order to create a clone on the second storage system at a remote location.” on page 56 respectively. 2006 6:37 pm If the production database was offline during the Snapshot copy process.1 Configure and initialize SnapMirror.4. Therefore.fm db2start Draft Document for Review August 23. you 92 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . then you need to complete the additional steps described in the Appendix B.” on page 53 and Part 4. you need to complete the following steps: 5. the LUNs on the clone volume are accessed using FCP. You can do this by executing the following command on the database server: db2inidb database [DatabaseName] as snapshot where DatabaseName identifies the name of the clone database that is going to be used for the test environment.2. the clone database becomes available after executing db2start. The production database was online when the Snapshot copies were created.7323san. If the source and the clone database need to be accessed from the same database host. “Configure a UNIX host to access both the clone and the source databases in a SAN environment” on page 117. “Initialize SnapMirror. In this scenario. “Configure SnapMirror. you would execute the following commands on the database server: db2inidb mydbcl as snapshot After you perform these steps. The steps necessary to set up and initialize a SnapMirror relationship are described in Part 4. 5. to initialize a clone database named mydbcl.

5. Therefore. Now update the SnapMirror destination volumes manually by executing the following command on the destination storage system: snapmirror < -S [SourceStorageSystem]:[VolumeName]> update [DestinationStorageSystem]:[VolumeName] Chapter 5. to create a clone of the destination volume.2 Bring the database offline.3.Draft Document for Review August 23.3 Create Snapshot copies of the FlexVol volumes. you need to create a Snapshot copy for each FlexVol volume that consists of LUNs that are used for the production database. Such a Snapshot copy can be obtained by completing the following steps. A Snapshot copy of a FlexVol volume can be created by executing the following command on the storage system: snap create [VolName] [SnapName] where VolName identifies the name assigned to the FlexClone volume that is to be created. Therefore. In the SnapMirror relationship. 2006 6:37 pm 7323san.4 Update the SnapMirror destination volumes. 5. SnapName identifies the name that is assigned to the Snapshot copy. Terminate all the application connections to the database by executing the following command on the database server: db2 force applications all 5.1 It is recommended that you develop a naming convention and assign a meaningful name to the Snapshot copies that are created for cloning purpose. Cloning a DB2 UDB Database in the SAN Environment 93 . you would execute the following command on the storage system: snap create dbdata dbdata_cl_snp. The LUNs reside within a FlexVol volume.fm should have working SnapMirror relationships for the volumes that are used for the database to be cloned. For example.3. you need a Snapshot copy that is created on the SnapMirror source and is replicated to the destination volume.3. to create a Snapshot copy named dbdata_snap01 for a FlexVol volume named dbdata. the destination volumes are read-only.

Important: The Snapshot copies are also created automatically for SnapMirror update purposes. For example. ParentVol identifies the name of the FlexVol volume that is source for the clone volume. VolumeName identifies the name assigned to the SnapMirror source/destination volume. A clone volume can be created from the Snapshot copy by executing the following command on the destination storage system: vol clone create [CloneVol] -s volume -b [ParentVol] <ParentSnap> where CloneVol identifies the name of the FlexClone volume that is being created. you would execute the following command on the SnapMirror destination storage system named dststore: snapmirror -S srcstore:dbdata update dststore:dbdata Update the SnapMirror relationship for each volume that is used for the database.7323san. For synchronous SnapMirror.3. 2006 6:37 pm SourceStorageSystem identifies the name assigned to the SnapMirror source storage system. DestinationStorageSystem identifies the name assigned to the SnapMirror destination storage system.5 Create FlexClone volumes using Snapshot copies. It is recommended not to use these automatically created Snapshot copies to create a clone volume 5. therefore.fm where Draft Document for Review August 23. the Snapshot copy created on the source volume becomes visible on the destination volume immediately. including Snapshot copies. After the SnapMirror update. an update is immediately started from the source to the destination to update the destination volume with the contents of the source volume. 94 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . to update SnapMirror for a volume named dbdata. manual update is not required. For asynchronous SnapMirror. each destination volume has a Snapshot copy that was created on the SnapMirror source storage system and replicated to the destination.

You can see the LUN status by executing the following command on the storage system: lun show The output from the lun show command should look similar to Example 5-9. otherwise. offline. When a clone volume is created. you would execute the following command on the destination storage system: vol clone create dbdata_cl -s volume -b dbdata dbdata_cl_snp. by default. 5. and they are placed offline.1 Important: The Snapshot copy on the SnapMirror source storage system should not be deleted. to create a clone volume named dbdata_cl from the Snapshot copy named dbdata_cl_snp. Cloning a DB2 UDB Database in the SAN Environment 95 .1 of the volume named dbdata. the SnapMirror relationship will fail.3. mapped) /vol/dbdata_cl/data 15g (16106127360) (r/w. 2006 6:37 pm 7323san. Chapter 5. mapped) Example 5-9 lun show The LUN mappings can be listed by executing the following command on the storage system: lun show -m The output from the lun show -m command should look similar to Example 5-10.6 Create new mapping for LUNs that reside on the clone volumes.fm ParentSnap identifies the name of the parent FlexVol volume Snapshot copy that is used as the source for the clone volume. lun show /vol/dbdata/data 15g (16106127360) (r/o. online.Draft Document for Review August 23. LUNs residing on it have the same mapping as the source FlexVol volume LUNs. For example.

you would execute the following command on the storage system: lun unmap /vol/dbdata_cl/data host_src_fcp_igp 2. you need to complete the following steps: 1. For example.7323san. or from a completely different server. Remove the old mapping for each LUN that exists on the clone volume by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] where LunPath identifies the name assigned to the new clone volume. In order to access the clone database from a second database server. 2006 6:37 pm lun show -m LUN path Mapped to LUN ID Protocol --------------------------------------------------------------/vol/dbdata/data /vol/dbdata_cl/data host_src_fcp_igp host_src_fcp_igp 0 0 FCP FCP Example 5-10 lun show You can see from the output that the LUNs on the clone volume have the same mapping as the parent. Create a new mapping for the LUNs on the clone volume by using a new ID and/or by mapping them to a new igroup. iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database.fm Draft Document for Review August 23. The FlexClone volume LUNs can be accessed from the same database server that is used to access the source database. to remove the old mapping for a LUN named /vol/dbdata_cl/data from an igroup named host_src_fcp_igp. The scenarios described in this paper were produced using a second database sever to access the clone database. A LUN mapping can be created by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] [LunId] where 96 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .

Refresh the HBA driver on the database server. to bring a LUN named /vol/dbdata_cl/data online. Mount LUN devices by executing the following command on the database server: Chapter 5. you would execute the following command on the storage system: lun online /vol/dbdata_cl/data 5.Draft Document for Review August 23. iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database. LunId identifies a numeric ID that is assigned to the LUN for mapping it to a specific initiator group.fm LunPath identifies the name assigned to the new clone volume. For example. each LUN that is on the clone volume and that is used for the clone database needs to be brought online by executing the following command on the storage system: lun online [LunPath where LunPath identifies the name assigned to the new clone volume. to map a LUN named /vol/dbdata_cl/data to an igroup named host_dst_fcp_igp. In order to mount the LUNs that reside on the FlexClone volumes. For example. Obtain the device names for the LUNs by executing the following command on the database server that is to be used to access the clone database: sanlun lun show 3. 2006 6:37 pm 7323san. you would execute the following command on the storage system: lun map /vol/dbdata_cl/data host_dst_fcp_igp 0 3. For example. refer to the OS reference manual and the HBA installation guide. to refresh a Qlogic FC HBA on a Linux database host. Cloning a DB2 UDB Database in the SAN Environment 97 . you would execute the following commands on the database server: modprobe -r qla2300 modprobe -v qla2300 For any other operating system (OS) and HBA.7 Mount the FlexClone volume LUNs. you need to complete following steps: 1. After remapping.3. 2.

The LUNs that resides on the FlexClone volume created in step (4) and mounted in step (5) of this section are going to be used as the storage containers for the cloned database.8 Renaming the cloned database Rename the clone database and update the tablespace containers header information. 98 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .fm Draft Document for Review August 23. FileSystem identifies the name of the files system whose ownership is changed. to mount a LUN device named /dev/sdb to a mount location named /mnt/dbdata_cl. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance.3. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl. You can skip the parts (A) and (B) of this step if following two conditions are true for you environment: 1. The name of the DB2 instance used for the clone database is same as the production or source database instance name. In order to operate DB2 successfully. For example. you would execute the following command on the database server: mount /dev/sdb /mnt/dbdata_cl 4. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance. you would execute the following command on the database server named hostdst: chown -R db2inst1:db2adm /mnt/dbdata_cl 5. For example. MountPoint identifies the name assigned to the mount location that is used to mount the LUN device.7323san. the DB2 instance owner should have ownership of the LUN file systems mounted on the database server. 2006 6:37 pm mount [DeviceName] [MountPoint] where DeviceName identifies the name assigned to the new clone volume.

2006 6:37 pm 7323san.5. TEMPSPACE1. /mnt/dbdata/db2inst1/NODE0000 For a database server the DB2 instance name has to be unique. InstanceName identifies the name assigned to the DB2 instance the database belongs to. you have to create a DB2 instance with a new name if an existing DB2 instance name is same as the production DB2 instance name. OldInstanceName identifies the name assigned to the DB2 instance the production database belongs to. the default tablespace containers will reside in the following directory. In order to access the clone database from a different instance name you need to change the default tablespace container's path name by executing following command on the database server: mv [DBDir]/[OldInstanceName]/NODE000n [DBDir]/[NewInstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on. NewInstanceName identifies the name assigned to the DB2 instance the clone database belongs to. and USERSPACE1) reside in the following directory: [DBDir]/[InstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on.fm 2. the tablespaces containers for the default tablespaces (SYSCATSPACE. Cloning a DB2 UDB Database in the SAN Environment 99 . A. The mount points that are used to mount the LUNs on the FlexClone volumes have the same name as the mount points that are used to mount the LUNs on the FlexVol volumes used for the production database. For example. to access the clone database from the instance named db2instc. Now you need to change the database name and tablespace containers header information using the db2inidb command as specified in Part 1. you would execute the following command on the database server to change the path: mv /mnt/dbdata_cl/db2inst1 /mnt/dbdata_cl/db2instc B.Draft Document for Review August 23. Therefore. if the DB2 instance name is db2inst1 and the database was created on the directory named /mnt/dbdata. By default when database is created. For example. “The Chapter 5.

The clone database is to be renamed to mydbcl.fm Draft Document for Review August 23. it has its data on /mnt/dbdata_cl and logs on /mnt/dblogs_cl. To do this. The production database was offline during the Snapshot creation process.cfg C. If the source and the clone database need to be accessed from the same database host. A sample configuration file for this scenario should look like Example 5-11. the clone database becomes available after executing db2start./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*.7323san. Save the configuration file as /home/db2inst1/dbrelocate. Therefore.cfg and execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate. the source database name is mydb and it has its logs on /mnt/dblogs and data on /mnt/dbdata . then you need to complete the additional steps described in the Appendix B. you can connect to the clone database and start using it.mydbcl DB_PATH=/mnt/dbdata./mnt/dbdata_cl INSTANCE=db2inst1. DB_NAME=mydb. “Configure a UNIX host to access both the clone and the source databases in a SAN environment” on page 117. you will need to create a configuration file that identifies the source database information and specifies the new clone database information./mnt/dbdata_cl/* Example 5-11 configuration file In this configuration file. 100 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . 2006 6:37 pm db2inidb command” on page 16. The source database instance name is db2inst1 and clone database instance name is db2instc. Start the database manager instance you created for the migration test environment by executing the following command on the database server: db2start If the production database was offline while the Snapshot copies were created.db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000.

Draft Document for Review August 23, 2006 6:37 pm

7323san.fm

In this scenario, the LUNs on the clone volume are accessed using FCP, but they can be accessed using the iSCSI access protocol as well.

5.4 Clone an online database to a remote storage system
In this section, you would learn how to create a clone database on the remote storage system when the source database is online. The step-by-step cloning process is described in the following subsections.

5.4.1 Set up and initialize SnapMirror.
The steps necessary to set up and initialize a SnapMirror relationship are described in Part 4.4.1, “Configure SnapMirror.” on page 53 and Part 4.4.2, “Initialize SnapMirror.” on page 56 respectively. After completing the steps described in these sections, you should have working SnapMirror relationships for the volumes that are used for the database to be cloned. In the SnapMirror relationship, the destination volumes are read-only. Therefore, to create a clone of the destination volume, you need a Snapshot copy that is created on the SnapMirror source and that is replicated to the destination volume. Such a Snapshot copy can be obtained by completing the following steps.

5.4.2 Bring the database into a consistent state (suspend writes).
In this scenario, the source database is online. Therefore, to prevent partial page writes while the database Snapshot copy process is in progress, the write operations to the database need to be temporarily suspended by executing the following command on the database server: db2 set write suspend for database The SET WRITE SUSPEND FOR DATABASE command causes the DB2 database manager to suspend all write operations to the current database. Read-only transactions continue uninterrupted, provided that they do not request a resource that is being held by the suspended I/O process. The FlexVol volume clone process is completed very quickly, so the database doesn't need to stay in write suspend mode for more than a few seconds

Chapter 5. Cloning a DB2 UDB Database in the SAN Environment

101

7323san.fm

Draft Document for Review August 23, 2006 6:37 pm

5.4.3 Create Snapshot copies
Create Snapshot copies of the volumes that are used for the database.The LUNs reside within a FlexVol volume. Therefore, you need to create a Snapshot copy for each FlexVol volume that consists of LUNs that are used for the production database. A Snapshot copy of a FlexVol volume can be created by executing the following command on the storage system: snap create [VolName] [SnapName] where VolName identifies the name assigned to the FlexClone volume that is to be created. SnapName identifies the name that is assigned to the Snapshot copy. For example, to create a Snapshot copy named dbdata_snap01 for a FlexVol volume named dbdata, you would execute the following command on the storage system: snap create dbdata dbdata_cl_snp.1 It is recommended that you develop a naming convention and assign a meaningful name to the Snapshot copies that are created for cloning purpose

5.4.4 Resume normal operations for the database (resume writes).
Once Snapshot copies are created, you need to resume write operations to the database by executing the following command on the database server: set write resume for database

5.4.5 Update the SnapMirror destination volumes.
Now update the SnapMirror destination volumes manually by executing the following command on the destination storage system:
snapmirror < -S [SourceStorageSystem]:[VolumeName]> update [DestinationStorageSystem]:[VolumeName]

where SourceStorageSystem identifies the name assigned to the SnapMirror source storage system. VolumeName identifies the name assigned to the volume that is being used as the SnapMirror destination.

102

Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology

Draft Document for Review August 23, 2006 6:37 pm

7323san.fm

DestinationStorageSystem identifies the name assigned to the SnapMirror destination storage system. For example, to update SnapMirror for a volume named dbdata, you would execute the following command on the SnapMirror destination storage system named dststore: snapmirror -S srcstore:dbdata update dststore:dbdata Update the SnapMirror relationship for each volume that is used for the database. For asynchronous SnapMirror, an update is immediately started from the source to the destination to update the destination volume with the contents of the source volume, including Snapshot copies. For synchronous SnapMirror, the Snapshot copy created on the source volume becomes visible on the destination volume immediately; therefore, manual update is not required.

Important: The Snapshot copies are also created automatically for SnapMirror update purposes. It is recommended not to use these automatically created Snapshot copies to create a clone volume.

5.4.6 Create clone volumes using Snapshot copies.
After the SnapMirror update, each destination volume has a Snapshot copy that was created on the SnapMirror source storage system and replicated to the destination. A clone volume can be created from the Snapshot copy by executing the following command on the destination storage system: vol clone create [CloneVol] -s volume -b [ParentVol] <ParentSnap> where CloneVol identifies the name of the FlexClone volume that is being created. ParentVol identifies the name of the FlexVol volume that is source for the clone volume. ParentSnap identifies the name of the parent FlexVol volume Snapshot copy that is used as source for the clone volume. For example, to create a clone volume named dbdata_cl from the Snapshot copy named dbdata_cl_snp.1 of the volume named dbdata, you would execute the following command on the destination storage system:

Chapter 5. Cloning a DB2 UDB Database in the SAN Environment

103

otherwise. 2006 6:37 pm vol clone create dbdata_cl -s volume -b dbdata dbdata_cl_snp. mapped) Example 5-12 lun show The LUN mappings can be listed by executing the following command on the storage system: lun show -m The output from the lun show -m command should look like Example 5-13.7 Create new mapping for LUNs that reside on the clone volumes.7323san.1 Important: The Snapshot copy on the SnapMirror source storage system should not be deleted. mapped) /vol/dbdata_cl/data 15g (16106127360) (r/w. offline. You can see the LUN status by executing the following command on the storage system: lun show The output from the lun show command should look like Example 5-12similar to the following: lun show /vol/dbdata/data 15g (16106127360) (r/o. online. and they are placed offline. When a clone volume is created.fm Draft Document for Review August 23. lun show -m LUN path Mapped to LUN ID Protocol --------------------------------------------------------------/vol/dbdata/data /vol/dbdata_cl/data host_src_fcp_igp host_src_fcp_igp 0 0 FCP FCP 104 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .4. LUNs residing on it have the same mapping as the source FlexVol volume LUNs. by default. the SnapMirror relationship will fail. 5.

The FlexClone volume LUNs can be accessed from the same database server that is used to access the source database. to remove the old mapping for a LUN named /vol/dbdata_cl/data from an igroup named host_src_fcp_igp. For example. you would execute the following command on the storage system: lun unmap /vol/dbdata_cl/data host_src_fcp_igp 2. Cloning a DB2 UDB Database in the SAN Environment 105 . LunId identifies a numeric ID that is assigned to the LUN for mapping it to a specific initiator group.fm You can see from the output that the LUNs on the clone volume have the same mapping as the parent. For example. or from a completely different server. The scenarios described in this paper were produced using a second database sever to access the clone database. In order to access the clone database from a second database server. Remove the old mapping for each LUN that exists on the clone volume by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] where LunPath identifies the name assigned to the new clone volume. 2006 6:37 pm Example 5-13 lun show 7323san. Create a new mapping for the LUNs on the clone volume by using a new ID and/or by mapping them to a new igroup. iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database. you need to complete the following steps: 1. to map a LUN named /vol/dbdata_cl/data to an igroup named host_dst_fcp_igp. you would execute the following command on the storage system: lun map /vol/dbdata_cl/data host_dst_fcp_igp 0 Chapter 5.Draft Document for Review August 23. iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database. A LUN mapping can be created by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] [LunId] where LunPath identifies the name assigned to the new clone volume.

MountPoint identifies the name assigned to the mount location that is used to mount the LUN device.8 Mount the LUN devices. to mount a LUN device named /dev/sdb to a mount location named /mnt/dbdata_cl. Obtain the device names for the LUNs by executing the following command on the database server that is to be used to access the clone database: sanlun lun show 3. to bring a LUN named /vol/dbdata_cl/data online. Refresh the HBA driver on the database server. to refresh a Qlogic FC HBA on a Linux database host. you need to complete following steps: 1.7323san. In order to mount the LUNs that reside on the FlexClone volumes.4.fm Draft Document for Review August 23. you would execute the following commands on the database server: modprobe -r qla2300 modprobe -v qla2300 For any other operating system (OS) and HBA. you would execute the following command on the database server: 106 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . each LUN that is on the clone volume and that is used for the clone database needs to be brought online by executing the following command on the storage system: lun online [LunPath] where LunPath identifies the name assigned to the new clone volume. 2. refer to the OS reference manual and the HBA installation guide. Mount LUN devices by executing the following command on the database server: mount [DeviceName] [MountPoint] where DeviceName identifies the name assigned to the new clone volume. For example. 2006 6:37 pm 3. you would execute the following command on the storage system: lun online /vol/dbdata_cl/data 5. For example. After remapping. For example.

Cloning a DB2 UDB Database in the SAN Environment 107 . TEMPSPACE1. You can skip the parts (A) and (B) of this step if following two conditions are true for you environment: 1. A. The mount points that are used to mount the clone volumes have same name as the mount points that are used to mount volumes of the production database.Draft Document for Review August 23. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance. The name of the DB2 instance used for the clone database is same as the production or source database instance name. In order to operate DB2 successfully. the tablespaces containers for the default tablespaces (SYSCATSPACE. For example. and USERSPACE1) reside in the following directory: [DBDir]/[InstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on.fm mount /dev/sdb /mnt/dbdata_cl 4. Chapter 5. you would execute the following command on the database server named hostdst: chown -R db2inst1:db2adm /mnt/dbdata_cl 5. The clone volumes created in the step (6) and mount in the step (8) of this section are going to be used as the storage containers for the cloned database. 2006 6:37 pm 7323san. By default when database is created. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl. FileSystem identifies the name of the files system whose ownership is changed.9 Configure the cloned database. 2.4. the DB2 instance owner should have ownership of the LUN file systems mounted on the database server.

Now you need to change the database name and tablespace containers header information using the db2inidb command as specified in section 1. 2006 6:37 pm InstanceName identifies the name assigned to the DB2 instance the database belongs to.4. For example. you would execute the following command on the database server to change the path: mv /mnt/dbdata_cl/db2inst1 /mnt/dbdata_cl/db2instc B. For example. To do this. if the DB2 instance name is db2inst1 and the database was created on the directory named /mnt/dbdata. you will need to create a configuration file that identifies the source database information and specifies the new clone database information. In order to access the clone database from a different instance name you need to change the default tablespace container's path name by executing following command on the database server: mv [DBDir]/[OldInstanceName]/NODE000n [DBDir]/[NewInstanceName]/NODE000n where: DBDir identifies the name assigned to the directory/device the database is created on. A sample configuration file for this scenario should look like Example 5-14.fm Draft Document for Review August 23. Therefore. you have to create a DB2 instance with a new name if an existing DB2 instance name is same as the production DB2 instance name. 108 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . the default tablespace containers will reside in the following directory.7323san. /mnt/dbdata/db2inst1/NODE0000 For a database server the DB2 instance name has to be unique. to access the clone database from the instance named db2instc. OldInstanceName identifies the name assigned to the DB2 instance the production database belongs to. NewInstanceName identifies the name assigned to the DB2 instance the clone database belongs to.

2006 6:37 pm 7323san. Save the configuration file as /home/db2inst1/dbrelocate. you need to use the db2inidb utility to initialize the clone database as a snapshot./mnt/dbdata_cl/* Example 5-14 configuration file In this configuration file. Start the database manager instance you created for the migration test environment by executing the following command on the database server: db2start If the production database was offline during the Snapshot copy process.mydbcl DB_PATH=/mnt/dbdata.Draft Document for Review August 23. You can do this by executing the following command on the database server: db2inidb database [DatabaseName] as snapshot where DatabaseName identifies the name of the clone database that is going to be used for the test environment. Cloning a DB2 UDB Database in the SAN Environment 109 .db2instc NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. The clone database is to be renamed to mydbcl./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*. to initialize a clone database named mydbcl. it has its data on /mnt/dbdata_cl and logs on /mnt/dblogs_cl. the clone database becomes available after executing db2start. The source database instance name is db2inst1 and clone database instance name is db2instc.cfg C./mnt/dbdata_cl INSTANCE=db2inst1. Therefore. the source database name is mydb and it has its logs on /mnt/dblogs and data on /mnt/dbdata .cfg and execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate. you would execute the following commands on the database server: db2inidb mydbcl as snapshot Chapter 5.fm DB_NAME=mydb. The production database was online when the Snapshot copies were created. For example.

in the reporting environment. combined with SnapMirror. then you need to complete the additional steps described in the Appendix B. to refresh the test and development environment. the LUNs on the clone volume are accessed using FCP. If the source and the clone database need to be accessed from the same database host.5 Conclusions The storage system offers the DB2 database administrator a compelling advantage and an elegant solution in terms of database cloning. 5. to work closely with live production data. for data mining.7323san. enables database cloning at a remote storage system. but they can be accessed using the iSCSI access protocol as well. and for disaster recovery. and this translates into huge savings in terms of dollars. the cloned database is ready. 110 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology . “Configure a UNIX host to access both the clone and the source databases in a SAN environment” on page 117. The storage space is utilized very efficiently with Snapshot technology.fm Draft Document for Review August 23. You can connect to the database and start using it. sparing database administrators from working late hours and weekends just to replicate data for various IT operations. Database cloning using N series technology is very easy and simple. Use of the FlexVol clone feature. The clone database can be used to take load off of the production database. In this scenario. for production environment troubleshooting. 2006 6:37 pm After completing these steps.

Draft Document for Review August 23. For example.1 Create a mount point for each clone volume by executing the following command on the database server: mkdir -p [MountPoint] where MountPoint identifies the name assigned to the mount location on the database server. to create a mount point named /mnt/db2data_cl. 2006. you would execute the following command on the database server: © Copyright IBM Corp. you need to complete the following steps: A. 111 . All rights reserved. Configure a UNIX host to access both the clone and the source databases in a NAS environment In order to access the clone database and the source database from the same database server. 2006 6:37 pm 7323ax01.fm A Appendix A.

rw. you would append the following mount entry to the /etc/fstab file on the database sever: srcstore:dbdata_cl /mnt/dbdata_cl nfs hard. MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server. to mount a clone volume that has mount entry specified in the /etc/fstab file.bg. 2006 6:37 pm A.rw. The mount should look similar to the following: [StorageSystemName]:[FlexVolName] [MountPoint] nfs hard. FlexVolName identifies the name assigned to the clone volume.vers=3.wsize=32768. for a clone volume named dbdata_cl that resides on a IBM N Series storage system named srcstore. you can mount the clone volume by executing the following command on the database server: mount [MountPoint] where MountPoint identifies the name assigned to the mount location that is used to mount the flexible volume on the database server.tcp 0 0 where StorageSystemName identifies the name assigned to the storage system that is used for the database storage.fm mkdir -p /mnt/dbdata_cl Draft Document for Review August 23.rsize=32768. you would execute the following command on the second database server named hostdst: mount /mnt/dbdata_cl The database servers we used had Linux operating system.nointr. 112 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .vers=3.bg.rsize=32768. For example.wsize=32768.nointr. for Linux you define mount options in the /etc/fstab file. After appending the mount entry.tcp 0 0 The mount entry should specify the IBM recommended mount options.7323ax01. For example. For example.2 Define mount options Define the mount options in the appropriate file for your operating system.

/mnt/dbdata_cl/ Appendix A.4 Rename the clone database The clone database has the old database name and old tablespace container information. Configure a UNIX host to access both the clone and the source databases in a NAS . The configuration file should look like Example A-1. the DB2 instance owner should have ownership of the file systems on the clone volume that is mounted on the database server. FileSystem identifies the name of the files system whose ownership is changed. The db2relocatedb utility allows you to rename a database as well as to update the tablespace header information. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl./mnt/dbdata_cl INSTANCE=db2inst1 NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000. 2006 6:37 pm 7323ax01. DB_NAME=mydb. InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance. you need to create a configuration file specifying both the new and old database names and tablespace containers./mnt/dblogs_cl/NODE0000 STORAGE_PATH=/mnt/dbdata/*. For example. You must rename the clone database and update its tablespace header information to represent the new database and new tablespace containers.Draft Document for Review August 23.mydbcl DB_PATH=/mnt/dbdata.fm A.3 Changing Ownership In order to operate DB2 successfully. you would execute the following command on the database server named hostdst: chown -R db2inst1:db2adm /mnt/dbdata_cl A. First. Ownership can be changed by executing the following command on the database server: chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance.

7323ax01. then modify the database information by executing the db2relocatedb command: db2relocatedb -f [ConfigFile] where ConfigFile identifies the name of the user-created configuration file based on that specifies new and old database information. As noted earlier. the db2inidb utility is used only to initialize a clone database that was created from an online database.5 Checking whether Database is cataloged Check whether the database is cataloged correctly by executing following command on the database server that is used to access the clone database: db2 list db directory The output from this command should look like Example A-2. to update the tablespace containers information and rename the clone database using the sample configuration file named /home/db2inst1/dbrelocate.cfg. 114 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .cfg and grant execute permission on it. you would execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate.fm Example: A-1 configuration file Draft Document for Review August 23. For example. is executed it internally calls the db2relocatedb tool and can be used to relocate a database. If the database was offline during the Snapshot copy process. 2006 6:37 pm Save the file as dbrelocate.cfg Note: When the db2inidb command with the relocate using option. A.

to recatalog a source database named mydb that resides on file system named /mnt/dbdata. the source database is automatically uncatalogged. DatabaseAlias identifies the alias name assigned to the database that is being cataloged. FileSystem specifies the path on which the database being cataloged resides. For example.6 db2relocatedb command Upon execution of the db2relocatedb command. you would execute the following command on the database server: Appendix A. 2006 6:37 pm 7323ax01.Draft Document for Review August 23.00 Catalog database partition number Example: A-2 db2 list A. Configure a UNIX host to access both the clone and the source databases in a NAS . You must recatalog the source database by executing the following command on the database server: db2 "catalog database [DatabaseName] as [DatabaseAlias] on [FileSystem]" where DatabaseName identifies the name assigned to the database that is being cataloged.fm 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 = = Indirect =0 = MYPRD_CL = MYPRD_CL = /mnt/dbdata_cl = a.

you should be able to access both the source and the cloned databases from the same database server. 2006 6:37 pm db2 "catalog database mydb as mydb on /mnt/dbdata" After completing these steps.fm Draft Document for Review August 23. 116 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .7323ax01.

2006. 2006 6:37 pm 7323ax02. 117 . Configure a UNIX host to access both the clone and the source databases in a SAN environment In order to access the clone database from the same database server. All rights reserved.fm B Appendix B. you need to complete the following steps: B.Draft Document for Review August 23. © Copyright IBM Corp.1 List the LUN mappings List the LUN mappings by executing the following command from the IBM N Series storage system: lun show -m The output from the lun show -m command should look like Example B-1.

to remove old mapping for a LUN named /vol/dbdata_cl/data from an igroup named host_src_fcp_igp. A LUN mapping can be created by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] [LunId] where LunPath identifies the name assigned to the new clone volume.2 Remove the old mappings Remove the old mapping for each LUN that exists on the clone volume by executing the following command on the storage system: lun unmap [LunPath] [iGroupName] where LunPath identifies the name assigned to the new clone volume.7323ax02. iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database. 2006 6:37 pm lun show -m LUN path Mapped to LUN ID Protocol --------------------------------------------------------------/vol/dbdata/data host_src_fcp_igp 0 FCP Example: B-1 lun show You can see from the output that the LUNs on the clone volume have the same mapping as the parent. B. For example.3 Create new mappings Create a new mapping for the LUNs on the FlexClone volume by using a new ID and/or by mapping them to a new igroup. you would execute the following command on the storage system: lun unmap /vol/dbdata_cl/data host_src_fcp_igp B.fm Draft Document for Review August 23. 118 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .

LunId identifies a numeric ID that is assigned to the LUN for mapping it to a specific initiator group.4 Bring clone online After remapping.fm iGroupName identifies the name assigned to the initiator group for the database host that is used to access the database.Draft Document for Review August 23. each LUN that is on the clone volume and that is used for the clone database needs to be brought online by executing the following command on the storage system: lun online [LunPath] where LunPath identifies the name assigned to the new clone volume. you would execute the following command on the database server: mkdir -p /mnt/dbdata_cl Appendix B. For example. to map a LUN named /vol/dbdata_cl/data to an igroup named host_dst_fcp_igp. For example. 2006 6:37 pm 7323ax02. For example. to bring a LUN named /vol/dbdata_cl/data online. you would execute the following command on the storage system: lun map /vol/dbdata_cl/data host_dst_fcp_igp 0 B. Configure a UNIX host to access both the clone and the source databases in a SAN . to create a mount point named /mnt/db2data_cl. you would execute the following command on the storage system: lun online /vol/dbdata_cl/data B.5 Create Mount point Create a mount point for each clone volumes by executing the following command on the database server: mkdir -p [MountPoint] where MountPoint identifies the name assigned to the mount location on the database server.

to mount a LUN device that is identified by a name /dev/sdb by the database server.8 Mount the LUN devices Mount the LUN devices by executing the following command on the database server: mount [DeviceName] [MountPoint] where DeviceName identifies the name assigned to the new clone volume. For example.6 Refresh Driver Refresh the HBA driver on the database server. B. to refresh a Qlogic FC HBA on a Linux database host. 2006 6:37 pm B.7323ax02.fm Draft Document for Review August 23. the DB2 instance owner should have ownership of the LUN file systems mounted on the database server. you would execute the following commands on the database server: modprobe -r qla2300 modprobe -v qla2300 For any other operating system (OS) and HBA. Ownership can be changed by executing the following command on the database server: 120 Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology .9 Changing Ownership In order to operate DB2 successfully. refer to the OS reference manual and the HBA installation guide.7 Obtain LUN device names Obtain the LUN device names by executing the following command on the database server that is to be used to access the clone database: sanlun lun show B. For example. you would execute the following command on the database server: mount /dev/sdb /mnt/dbdata B. MountPoint identifies the name assigned to the mount point that is used to mount the LUN device.

Configure a UNIX host to access both the clone and the source databases in a SAN . InstanceOwnerGroup identifies the name assigned to the user's group that owns the database instance. For example.cfg.mydbcl DB_PATH=/mnt/dbdata.Draft Document for Review August 23. and execute the db2relocatedb command as follows: Appendix B. you need to create a configuration file specifying both new and old database names and tablespace containers. First. you would execute the following command on the database server named hostdst: chown -R db2inst1:db2adm /mnt/dbdata_cl B. grant execute permission if necessary. The db2relocatedb utility allows you to rename a database as well as update the tablespace header information.10 Renaming cloned database The cloned database has the old database name and old tablespace container information. to change ownership of the file system mounted on the mount point named /mnt/dbdata_cl./mnt/dblogs_cl/NODE0000 CONT_PATH=/mnt/dbdata/*. FileSystem identifies the name of the file system whose ownership is being changed. DB_NAME=mydb./mnt/dbdata_cl INSTANCE=db2inst1 NODENUM=0 LOG_DIR=/mnt/dblogs/NODE0000.fm chown -R [InstanceOwner]:[InstanceOwnerGroup] [FileSystem] where InstanceOwner identifies the name assigned to the user who owns the database instance. The configuration file should look like Example B-2. You must rename the cloned database and update its tablespace header information to represent the new database and new tablespace containers./mnt/dbdata_cl/* Example: B-2 Configuration file Save the file as dbrelocate. 2006 6:37 pm 7323ax02.

7323ax02.fm

Draft Document for Review August 23, 2006 6:37 pm

db2relocatedb -f [ConfigFile] where ConfigFile identifies the name assigned to the user-created configuration file that is used to relocate the database. For example, to update the tablespace containers information and rename the clone database using the sample configuration file named /home/db2inst1/dbrelocate.cfg, you would execute the following command on the database server: db2relocatedb -f /home/db2inst1/dbrelocate.cfg

B.11 Checking whether database is cataloged
Check whether the database is cataloged correctly by executing the following command on the database server: db2 list db directory The output from this command should look like Example B-3.

122

Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology

Draft Document for Review August 23, 2006 6:37 pm

7323ax02.fm

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 = = Indirect =0 = MYPRD_CL = MYPRD_CL = /mnt/dbdata_cl = a.00

Catalog database partition number Alternate server hostname =

Example: B-3 db2 list

B.12 Recatalog the database
Upon execution of the db2relocatedb command, the source database is automatically uncatalogged. Recatalog the source DB2 database. Now you can access both source and cloned database from the same database server. db2 "catalog database mydb as mydb on /mnt/dbdata" After completing these steps, you should be able to access both the source and the cloned databases from the same database server.

Appendix B. Configure a UNIX host to access both the clone and the source databases in a SAN

7323ax02.fm

Draft Document for Review August 23, 2006 6:37 pm

124

Cloning a IBM DB2 UDB Database using N Series FlexCloneô Technology

Draft Document for Review August 23. see “How to get IBM Redbooks” on page 126.ibm. 125 . 2006. REDP-4074-01 Multiprotocol Data Access with IBM System Storage N series .com/servers/storage/nas/ © Copyright IBM Corp. REDP-4084-01 Joining IBM System Storage N series Systems to Microsoft Active Directory. Using the IBM System Storage N Series with IBM Tivoli Storage Manager SG24-7243-00 IBM Storage System N series Antivirus Scanning Best Practices Guide. GA32-0543-01 Online resources These Web sites are also relevant as further information sources: IBM NAS for your storage infrastructure http://www-03. 2006 6:37 pm 7323bibl.GA32-0517-02 IBM System Storage N series N3700 Hardware and Service Guide.fm Related publications The publications listed in this section are considered particularly suitable for a more detailed discussion of the topics covered in this redbook. Note that some of the documents referenced here may be available in softcopy only.GA32-0515-02 IBM System Storage N series Introduction and Planning Guide. All rights reserved. REDP-4176-00 Other publications These publications are also relevant as further information sources: IBM System Storage N3700 Installation and Setup Instructions. IBM Redbooks For information about ordering these publications.

ibm.com/servers/storage/support/nas/n3700/ Support for System Storage N5200 http://www-03. view. 2006 6:37 pm Support for System Storage N3700 http://www-03. as well as order hardcopy Redbooks or CD-ROMs.fm Draft Document for Review August 23. Hints and Tips. at this Web site: ibm.com/servers/storage/support/nas/n5200/ How to get IBM Redbooks You can search for.ibm. Redpapers.7323bibl. or download Redbooks.com/redbooks Help from IBM IBM Support and downloads ibm.com/support IBM Global Services ibm. draft publications and Additional materials.com/services 126 Using IBM DB2 UDB with IBM System Storage N series .

127 . 2006 6:37 pm 7323ix.fm Index R Redbooks Web site 126 Contact us x © Copyright IBM Corp.Draft Document for Review August 23. 2006. All rights reserved.

2006 6:37 pm 128 Using IBM DB2 UDB with IBM System Storage N series .fm Draft Document for Review August 23.7323ix.

1”<->0.473” 90<->249 pages (0. 2006 6:37 pm 7323spine.0” spine) 0. Now select the Spine width for the book and hide the others: Special>Conditional Text>Show/Hide>SpineSize(-->Hide:)>Set .5”<-> 1. Move the changed Conditional text settings to all files in your book by opening the book file with the spine.17”<->0. you divide the paper PPI into the number of pages in the book.475”<->0.998” 789 <->1051 pages Using IBM DB2 UDB with IBM System Storage N series Using IBM DB2 UDB with IBM System Storage N series (1.4752". Divided 250 by 526 which equals a spine width of .5” spine) 0.498” 460 <-> 788 pages (0.5” spine) 1.fm 129 Using IBM DB2 UDB with IBM System Storage N series (1. In this case.169” 53<->89 pages .2”spine) 0.To determine the spine width of a book.1”spine) 0. An example is a 250 page book using Plainfield opaque 50# smooth which has a PPI of 526.fm still open and File>Import>Formats the Conditional Text Settings (ONLY!) to the book files.875”<->1. Draft Document for Review August 23. you would use the .875” 250 <-> 459 pages Using IBM DB2 UDB with IBM System Storage N series (0.5” spine.

An example is a 250 page book using Plainfield opaque 50# smooth which has a PPI of 526.5”<->nnn. you divide the paper PPI into the number of pages in the book.0” <-> 2.To determine the spine width of a book. Move the changed Conditional text settings to all files in your book by opening the book file with the spine. In this case.0” spine) 2. Divided 250 by 526 which equals a spine width of .498” 1052 <-> 1314 pages .fm still open and File>Import>Formats the Conditional Text Settings (ONLY!) to the book files. Draft Document for Review August 23.5” spine.5” spine) 2.4752".fm 130 Using IBM DB2 UDB with IBM System Storage N series (2.n” 1315<-> nnnn pages Using IBM DB2 UDB with IBM System Storage N series (2. 2006 6:37 pm 7323spine. Now select the Spine width for the book and hide the others: Special>Conditional Text>Show/Hide>SpineSize(-->Hide:)>Set . you would use the .

.

Experts from IBM. 2006 6:37 pm ® Using IBM DB2 UDB with IBM System Storage N series Database cloning is process by which you can create an exact copy of a DB2 database. Furthermore. INTERNATIONAL TECHNICAL SUPPORT ORGANIZATION BUILDING TECHNICAL INFORMATION BASED ON PRACTICAL EXPERIENCE IBM Redbooks are developed by the IBM International Technical Support Organization. either by physically copying the data or by performing what is known as a redirected restore. QA testing. Customers and Partners from around the world create timely technical information based on realistic scenarios. and report generation. including system downtime and degraded system performance during the cloning process. Additionally. Specific recommendations are provided to help you implement IT solutions more effectively in your environment. the maintenance overhead can be enormous if each cloned database requires a frequent data refresh. For more information: ibm. Traditional methods of cloning a database pose various challenges. a large amount of storage space is required to store each clone. Database cloning is performed frequently by database administrators to provide near-production data for various business needs such as application development.com/redbooks SG24-7323-00 ISBN .Back cover Draft Document for Review August 23.

Sign up to vote on this title
UsefulNot useful