Before you start
DB2 High Availability Disaster Recovery (HADR) is a DB2 feature that provides a high-availability solution for database site failures by replicating database changes from a source database (primary) to a target database (standby). HADR protects against data loss by shipping log data from the primary database to the standby database and by constantly applying the log data into the standby site using rollforward. In case of a critical hardware, network, or software failure in the primary site, the standby site can take over the database server operations much faster than the time it would take to repair the failure on the primary site. There are other high-availability solutions you can use with DB2, but DB2 HADR is a feature completely contained within DB2 itself, so it does not require any additional hardware or software solution.
Note: Starting with DB2 9.7.1, DB2 supports read operations against standby databases. This can be a great performance benefit, because users can shift the read-only workload to the standby database directly, freeing up cycles in the primary database.
IBM Data Studio is the complimentary tooling available with your database license that provides basic database administration and database development capabilities for DB2 (and, to some extent, Informix® Dynamic Database). As of DB2 9.5, Data Studio replaced older tools, including Developer Workbench. Data Studio also provides some of the basic capabilities of DB2 Control Center. Along with capabilities to test, debug, and deploy routines, including stored procedures and user-defined functions, Data Studio also includes the following key database and object-management capabilities:
- Manage DB2 instances (start and stop, quiesce, configure parameters)
- Manage and recover databases
- Connect to DB2 or Informix data sources and browse data objects and their properties
- Use editors and wizards to create and alter data objects
- Modify privileges for data objects and authorization IDs
- Drop data objects from databases
- Analyze the impact of changes
- Manage data in tables, including reorganizing, importing, and exporting
- Backup and recover data
- Use data diagrams to visualize and print the relationships among data objects
- Import and export database connections
- Configure automatic maintenance and logging
- Rebind packages
- Get index advice on single queries (stand-alone package only)
- Configure pureScale members (stand-alone package only)
Data Studio comes in both an integrated development environment (IDE) package and a stand-alone package. The stand-alone package has a lighter footprint, and it contains everything you need for this tutorial. You can also use Optim Database Administrator, which is a priced-offering that includes advanced features for managing complex database schema changes. Additional features included in Optim Database Administrator include:
- Copying and pasting database objects and data
- Generating schema change reports
- Exporting administration and change scripts as Command Line Processor (CLP) scripts
- Generating undo scripts
For this tutorial, you can use either Data Studio or Optim Database Administrator.
The high-availability disaster recovery (HADR) feature of DB2 for Linux, UNIX, and Windows can help prevent data loss. Using Data Studio or Optim Database Administrator to configure the setup makes the process relatively easy. In this tutorial you will learn how to configure and execute the HADR setup using the Data Studio stand-alone package. You can also use the Optim Database Administrator or Data Studio IDE instead.
The objective of this tutorial is to teach you the process of setting up DB2 HADR using Data Studio or Optim Database Administrator. You will learn how to:
- Connect to your primary database and configure it for HADR, including configuring archive logging and creating the backup to copy over
- Connect to the standby database and configure it for HADR
- Configure additional options, such as copying over external objects and configuring TCP/IP
- Review and execute the generated HADR commands
- Validate the setup
This tutorial assumes you have basic knowledge of how to administer a DB2 database on Linux, UNIX, and Windows. Familiarity with Data Studio or Optim Database Administrator is recommended. A good resource to get basic knowledge is the Getting Started with Data Studio e-book (see Resources).
To follow along with the tutorial, you need DB2 for Linux, UNIX and Windows 9.7 installed on two different computers. You also need to have either Data Studio (stand-alone) 220.127.116.11 or Optim Database Administrator 2.2.2 installed on a system that can connect to the DB2 instances. See Resources for links to a download of free Data Studio or to a 30-day trial of Optim Database Administrator.
The database used in this tutorial is the sample database from the fictional Great Outdoors Company. You can download this database from the Integrated Data Management Information Center (see Resources). You can use the DB2 SAMPLE database or any other database for the tutorial instead.
The recommended approach to setting up HADR is for the two computers to be used as primary and standby computers to have identical operating systems. In the example setup, there are two x86_64 SUSE Linux® 10 boxes called server1 and server2. Server1 is the primary computer, and server2 is the standby computer. You also need an extra TCP port for the HADR service.
For a complete list of the system requirements for DB2 HADR, see Resources.