DB2 HADR Start and stop

Source: Internet
Author: User

HADR is the high availability Disaster Recovery feature (Hight Available Disaster Recover) of DB2. It uses the data replication technology to continuously replicate data from the primary database to the backup database to avoid data loss.


DB2 HADR Management
 Start and Stop DB2 HADR
Use the start hadr command to START the HADR of the primary and standby databases. Start the master database using the as primary clause and start the slave database using the as standby clause. If you want to start HADR with another USER, you can use the user USER-name USING password clause to specify the user name and password. When you start HADR of the primary database, if the connection to the backup database HADR fails to be established within the time specified by the database HADR_TIMEOUT, the startup will fail. At this time, you can start the primary database HADR after troubleshooting and successfully starting the standby database HADR, or forcibly starting the primary database BY specifying the by force clause. :

Start the backup database:

DEACTIVATE DATABASE SAMPLE
Start hadr on database sample [using db2admin using db2admin] as standby

Start the primary database:

DEACTIVATE DATABASE SAMPLE
Start hadr on database sample [using db2admin using db2admin] as primary [by force]


Use stop hadr to STOP the HADR of the primary database and the standby database. If this command is issued on the active primary database, all database connections are disconnected and the database is restored to a standard database, and remain online; if this command is issued on the active standby database, the failure will stop. You must first use
The deactivate database Command cancels the activation and then stops HADR.

Stop the backup database:

Deactivate database sample
Stop hadr on database sample [using db2admin using db2admin]

Stop the primary database:

Stop hard on database sample [using db2admin using db2admin]

Worker

When the HADR of the standby database is started, it first enters the local synchronous update status. Search and replay the log files in the Local System Based on the local Log Path configuration parameters and the log archiving method settings. When the local log file is replayed, the Standby database enters the remote synchronization pending state. After establishing a connection with the primary database, the Standby database enters the remote synchronous update status. That is, the primary database sends its own log files to the standby database through the TCPIP protocol. The standby database receives and replays the log files until all log files are replayed, the standby database and the primary database enter the peer state.

View the DB2 HADR status:

Db2pd-d sample-hadr

Slave master database and slave database take over/failover

When the primary database fails, the Standby database can take over the services of the primary database and become a new primary database (referred to as failover ). After the original primary database is repaired, it can be added as a backup database to the HADR pair. Even if the primary database server is not faulty, we use the TAKEOVER command to switch the role of the primary database and the standby database. The takeover command can only be used on the standby database. HADR provides the following two methods:

Emergency Takeover:

Takeover hadr on database sample by force

Common Takeover:
Takeover hadr on database sample

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.