Table of Contents
Back to DB2 HADR home
HADR FAQ
Redirected restore is not supported. "Redirected" here means redirecting tablespace containers, as in a "restore ... redirect" command.
Database directory ("restore ... to ...") and log directory ("restore ... newlogpath") changes are supported. When database directory changes, table space containers created by relative paths will be restored to paths relative to the new database directory.
The "restore ... on ... [dbpath on ...]" command is also supported, even though it can be considered as "implicit" redirection.
From Info Center, Managing HADR, initializing HADR:
Usually, the standby database is started first. If you start the primary database first, this startup procedure will fail if the standby database is not started within the time period specified by the HADR_TIMEOUT database configuration parameter.
In order to configure 2 databases for automated failover, you will need to have 4 separate XML files, here is the sequence in which you would run db2haicu to set this up:
Setting up for database 1:
1) Run db2haicu on the standby (XML file A)
2) Run db2haicu on the primary (XML file B)
Setting up for database 2:
3) Run db2haicu on the standby (XML file C)
4) Run db2haicu on the primary (XML file D)
See also HADR config on HADR syncmode and other parameters.
See HADR sync mode
See Updating HADR Configuration
No. All HADR related registry variables require DB2 instance shutdown and restart to take effect. The HADR registry variables have DB2_HADR_ prefix. Example: DB2_HADR_PEER_WAIT_LIMIT, DB2_HADR_SOSNDBUF and DB2_HADR_SORCVBUF.
DB2_HADR_NO_IP_CHECK should be set on both primary and standby instances, even if only one of them is under NAT (Network Address Translation) control.
Log file management on the primary database is identical to that of a standard (non-HADR) database.
See Log File Management on Standby
Yes. See also Log File Management on Standby
If archiving is not enabled on the primary (It is using logretain), then the standby will not reclaim any log files. All files will be kept on both primary and standby. Users are responsible to manage the files. Generally, files older than "First active log file" from "get db cfg" can be removed. "First active file" should be read and used for file management on primary and standby separately. Standby's first active file can be older than the primary's because replay on standby can fall behind primary's transaction processing.
The standby never archives log files, thus using logretain on standby has no impact to HADR log file operations on standby.
See LOGARCHMETH1 and LOGARCHMETH2 Log ArchiveDevice
The DB2 log archive compression feature (enabled via database configuration parameter logarchcompr1 or logarchcompr2) compresses log files when they are archived. Compression happens when a log file is sent to log archive. Log files in active log path are not compressed. Neither is log shipping from HADR primary to standby. So normally, compression has little effect on HADR.
Log archive compression can affect HADR when standby falls significantly behind the primary (eg. due to planned or unplanned outage of standby). When standby is reactivated, it will need to replay some relatively old log files to catchup. The files are likely to be in archive. Unless shared archive is configured, the primary will need to retrieve, uncompress, and send the files to the standby. This will add to CPU cost on the primary and cause some delay in HADR catchup. Even if standby can directly retrieve the files via shared archive, it will still need to uncompress them, with CPU cost on the standby.
The same log archive compression configuration is recommended on HADR primary and standby. Log archive compression can be configured independently on primary and standby. A database (primary, standby, or standard) can always uncompress log files, regardless of its current compression setting. A standby will not have problem reading compressed files from shared archive.
The decision to use log archive compression should be made based on the benefit vs cost, as if HADR is not being used. The benefit is space saving in archive, the cost is CPU time to compress and uncompress the files. The HADR complication of standby falling significantly behind is relatively rare. It is troublesome with or without log archive compression. When it happens, you may consider reinitializing the standby via a recent backup from the primary, rather than going through a long catchup. If you choose to go through a long catchup, you may retrieve needed log files to overflow log path in advance to speed up catchup.
See What's replicated and what's not
HADR replicates load with certain restrictions. See DB2 info center " Load operations and HADR ".
See also Replaying Load
There is a significant difference using IMPORT / INGEST vs using LOAD :
Thus if the performance of INGEST is adequate, it is preferred. Things to consider when using IMPORT or INGEST:
DB2 LOB type includes Blob, Clob, and DBClob. A LOB column can be declared as logged or not logged. For HADR, a LOB column is replicated if and only if it is logged. For a not logged LOB, the standby will still allocate space for it; the LOB will have the right size but the content will be binary zero.
For fatal errors, the standby database will shut itself down. The DBA should identify the cause (read db2diag.log, etc.), fix the problem, then reactivate the standby.
Replay errors on a tablespace may bring the tablespace offline, but leave the database online. Subsequent replays will skip this tablespace. At database level, the standby may look healthy, say, in peer state with a small log gap. But it can have one or more tablespaces offline. These tablespaces will not be accessible upon failover.
Therefore it is very important to also monitor tablespace state on the standby. You can use "db2pd -tablespaces" option to monitor the standby.
See also HADR commands
HADR commands (start hadr, stop hadr, takeover hadr) use db aliases to address the database. Therefore, you could issue the commands from the database server machine or a client machine as long as the alias points to the right database.
However, there is a limitation for the "start hadr ... as standby" command. On the server machine hosting the standby database, the database catalog must have an entry with the same db alias and db name. If you do "db2 list db directory", you should see something like:
Database alias = FOO Database name = FOO Local database directory = /work1/databases Database release level = a.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number =
Users do not usually run into this limitation. Such an entry is created automatically on "create db" or "restore db". It's missing only in unusually cases such as "loopback" catalog.
Do not use ACR enabled database aliases in HADR admin commands. See HADR Admin Commands
When the "start HADR on database ... as standby" command is issued, the command returns as soon as the relevant EDUs are successfully started. It does not wait for connection to primary (In contrast, with the exception of "start HADR on db ... as primary by force ", the primary database is not considered started until it connects to a standby database). If the standby database encounters an error such as connection rejected by the primary, the "start" command may still return success. Many replay errors will also bring down the standby database. Thus the status of the standby should be continuously monitored.
The same behavior applies to the "activate database" command on the standby.
This behavior applies to primary reintegration too. Returning of "start ... as standby" command does not indicate that reintegration succeeded. See also Primary Reintegration
See also HADR monitoring
Check database configuration parameter "HADR database role". It is one of PRIMARY, STANDBY, or STANDARD (not an HADR database). When it is online, you can also find the role in the "HADR_ROLE" field in monitoring interfaces.
This message is usually caused by a client (or the client reroute mechanism) trying to connect to the standby database. This message and the subsequent "sqleserl, probe:77" message can usually be ignored.
DB2 CLP command "list tablespaces" requires a database connection. But the standby database does not accept client connection unless reads on standby is enabled. You can use the db2pd command to monitor tablespaces on the standby. Use "db2pd -tablespaces -db <dbName>". See also Standby Tablespace Status
It is routine practice to identify if any database objects, such as tables, are unavailable on the HADR standby prior to issuing a takeover. For example, you might check if there any tables that are unavailable because they are in a drop-pending state. Tables in unavailable state may be caused by not logged operation on the primary such as NLI / non-recoverable load.
To determine if there are any tables in drop-pending state on the standby, you need to use the
db2dart
and the
db2pd
commands on the standby. You need to use both commands because each provides a potentially incomplete picture of the table state:
db2dart
reads only changes that are on disk, and
db2pd
can report only the information about tables that are loaded into memory.
See this technote for detailed steps to check for unavailable tables in the database on HADR standby.
Please refer to section 7.5 "Automating HADR takeover with PowerHA" of the following redbook:
http://www.redbooks.ibm.com/redbooks/pdfs/sg247363.pdf
See feature history
No. HADR sends log data onto TCP as is. If compression is needed, an external hardware or software solution can be used. Note that if row compression or columnar compression is enabled, the data embedded in log stream is already compressed. Therefore additional compression at or below TCP level may not result in high compression ratio.
DB2 "log archive compression" feature only compresses a log file when it is archived. It has no effect on HADR log shipping. See also What is the recommendation on using log archive compression with HADR?
No. HADR sends log data onto TCP as is. HADR primary and standby usually are connected via private network, for security and performance reasons. If encryption is needed, an external method such as VPN can be used.
The DB2 native database encryption only encrypts data at rest (ie. on disk), Data in memory and in transit (such as client/server communication and HADR primary/standby communication) are not encrypted. Search for "Encrypt a database in an HADR environment" in the knowledge center topic quoted above for example of managing HADR in encrypted database environment.
Primary and standby encryption configurations are independent. You can have both unencrypted, both encrypted, or one encrypted and the other not encrypted. In most business environments, you would want them to have the same encryption policy. HADR will print a warning message to DB2 admin log when it detects that primary and standby have different policy.