[root@dragon soft]# ls -l
总用量 1395532
-rwxr-xr-x. 1 root root 1429018107 8月 11 2016 v10.5fp7_linuxx64_server_t.tar.gz
[root@dragon soft]# tar xf v10.5fp7_linuxx64_server_t.tar.gz
[root@dragon soft]# ls -l
总用量 1395536
drwxr-xr-x. 5 root root 4096 12月 22 2015 server_t
-rwxr-xr-x. 1 root root 1429018107 8月 11 2016 v10.5fp7_linuxx64_server_t.tar.gz
[root@dragon soft]# cd server_t/
[root@dragon server_t]# ls -l
总用量 120
drwxr-xr-x. 6 bin bin 4096 12月 22 2015 db2
-r--r--r--. 1 bin bin 4987 12月 22 2015 db2checkCOL_readme.txt
-r--r--r--. 1 bin bin 41539 12月 22 2015 db2checkCOL.tar.gz
-r-xr-xr-x. 1 bin bin 5880 12月 22 2015 db2ckupgrade
-r-xr-xr-x. 1 bin bin 5795 12月 22 2015 db2_deinstall
-r-xr-xr-x. 1 bin bin 5665 12月 22 2015 db2_install
-r-xr-xr-x. 1 bin bin 5629 12月 22 2015 db2ls
-r-xr-xr-x. 1 bin bin 5639 12月 22 2015 db2prereqcheck
-r-xr-xr-x. 1 bin bin 5647 12月 22 2015 db2setup
drwxr-xr-x. 10 bin bin 4096 12月 22 2015 ibm_im
-r-xr-xr-x. 1 bin bin 5683 12月 22 2015 installFixPack
drwxr-xr-x. 4 root root 4096 12月 22 2015 nlpack
关键字vrmf
[root@dragon db2]# cat /data/soft/server_t/db2/spec
arch=x86_64
architecture_level=10.5.0.7.0.0
baseptf=IP23956
bldlevel=20151221
code_level=10.5.0.7.0.0
ext_buildlevel=s151221
fixpack=7
gpfs_efix_build=10
gpfs_level=3.5.0.7
interim=
minimum_committed_level_for_online_install=10.5.0.5.0.0
minimum_version=10.5.0.0
online_update_supported=Y
os=Linux
ptf=IP23956
sb=0
section_level=10.5.0.7.0.0
specialbuild=
toleration_level=N
tsa_efix_build=0
tsa_level=3.2.7.3
vrmf=10.5.0.7
修复不满足的项再重新执行db2prereqcheck
,直到全部满足安装前提条件
[root@dragon server_t]# ./db2prereqcheck -v 10.5.0.7
==========================================================================
正在检查操作系统 "Linux" V"10.5.0.7" 的 DB2 安装的先决条件。
正在验证 "Linux 分发 " ...
要求的最低操作系统分发:"RHEL";版本:"5";Service pack:"9"。
实际操作系统分发版本:"6";Service pack:"10"。
达到要求。
正在验证 "内核级别 " ...
要求的最低操作系统内核级别:"2.6.16"。
实际操作系统内核级别:"2.6.32"。
达到要求。
正在验证 "C++ 库版本 " ...
要求的最低 C++ 库版本:"libstdc++.so.6"
标准 C++ 库位于以下目录中:"/usr/lib64/libstdc++.so.6.0.13"。
实际 C++ 库:"CXXABI_1.3.1"
达到要求。
正在验证 ""libstdc++.so.6" 的 32 位版本 " ...
在以下目录中找到了 32 位 "/usr/lib/libstdc++.so.6":"/usr/lib"。
达到要求。
正在验证 "libaio.so 版本 " ...
DBT3553I db2prereqcheck 实用程序已成功装入 libaio.so.1 文件。
达到要求。
正在验证 "/lib/libpam.so*" ...
达到要求。
DBT3533I db2prereqcheck 实用程序已确认所有安装先决条件均已满足。
[root@dragon server_t]# ./db2_install -f NOTSAMP
DBI1324W 不推荐支持 db2_install 命令。
安装产品的缺省目录 - /opt/ibm/db2/V10.5
***********************************************************
是否安装到缺省目录 (/opt/ibm/db2/V10.5) 中?[是/否]
是
指定下列其中一个关键字以安装 DB2 产品。
SERVER
CONSV
EXP
CLIENT
RTCL
输入 "help" 以重新显示产品名称。
输入 "quit" 以退出。
***********************************************************
SERVER
正在初始化 DB2 安装。
要执行的任务总数为:47
要执行的所有任务的总估计时间为:1607 秒
.....
.....
.....
任务 #48 启动
描述:正在更新全局概要文件注册表
估计时间 3 秒
任务 #48 结束
已成功完成执行。
[root@dragon V10.5]# pwd
/opt/ibm/db2/V10.5
[root@dragon V10.5]# ls
acs bnd dasfcn dsdriver guardium install lib32 map properties security32
adm cfg db2tss function ha instance lib64 misc rdf security64
adsm conv desktop gse include java license msg Readme tivready
bin das doc gskit infopop json logs pd samples tools
[root@dragon adm]# /opt/ibm/db2/V10.5/adm/db2licm -l
Product name: "DB2 Advanced Enterprise Server Edition"
License type: "Trial"
Expiry date: "12/09/2019"
Product identifier: "db2aese"
Version information: "10.5"
[root@dragon adm]# /opt/ibm/db2/V10.5/adm/db2licm -a /data/soft/db2aese_c.lic
LIC1402I License added successfully.
LIC1426I This product is now licensed for use as outlined in your License Agreement. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, LOCATED IN THE FOLLOWING DIRECTORY: "/opt/ibm/db2/V10.5/license/zh_CN.utf8"
[root@dragon adm]# /opt/ibm/db2/V10.5/adm/db2licm -l
Product name: "DB2 Advanced Enterprise Server Edition"
License type: "CPU Option"
Expiry date: "Permanent"
Product identifier: "db2aese"
Version information: "10.5"
Enforcement policy: "Soft Stop"
[root@dragon install]# /opt/ibm/db2/V10.5/install/db2ls
Install Path Level Fix Pack Special Install Number Install Date Installer UID
---------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V10.5 10.5.0.7 7 Wed Sep 11 15:30:36 2019 CST 0
[root@dragon install]# /opt/ibm/db2/V10.5/install/db2ls -q -b /opt/ibm/db2/V10.5
Install Path : /opt/ibm/db2/V10.5
Feature Response File ID Level Fix Pack Feature Description
---------------------------------------------------------------------------------------------------------------------
BASE_CLIENT 10.5.0.7 7 Base client support
JAVA_SUPPORT 10.5.0.7 7 Java support
SQL_PROCEDURES 10.5.0.7 7 SQL procedures
BASE_DB2_ENGINE 10.5.0.7 7 Base server support
CONNECT_SUPPORT 10.5.0.7 7 Connect support
DB2_DATA_SOURCE_SUPPORT 10.5.0.7 7 DB2 data source support
SPATIAL_EXTENDER_SERVER_SUPPORT 10.5.0.7 7 Spatial Extender server support
JDK 10.5.0.7 7 IBM Software Development Kit (SDK) for Java(TM)
LDAP_EXPLOITATION 10.5.0.7 7 DB2 LDAP support
INSTANCE_SETUP_SUPPORT 10.5.0.7 7 DB2 Instance Setup wizard
ACS 10.5.0.7 7 Integrated Flash Copy Support
SPATIAL_EXTENDER_CLIENT_SUPPORT 10.5.0.7 7 Spatial Extender client
COMMUNICATION_SUPPORT_TCPIP 10.5.0.7 7 Communication support - TCP/IP
APPLICATION_DEVELOPMENT_TOOLS 10.5.0.7 7 Base application development tools
DB2_UPDATE_SERVICE 10.5.0.7 7 DB2 Update Service
REPL_CLIENT 10.5.0.7 7 Replication tools
DB2_SAMPLE_DATABASE 10.5.0.7 7 Sample database source
TEXT_SEARCH 10.5.0.7 7 DB2 Text Search
INFORMIX_DATA_SOURCE_SUPPORT 10.5.0.7 7 Informix data source support
ORACLE_DATA_SOURCE_SUPPORT 10.5.0.7 7 Oracle data source support
FIRST_STEPS 10.5.0.7 7 First Steps
GUARDIUM_INST_MNGR_CLIENT 10.5.0.7 7 Guardium Installation Manager Client
[root@dragon ~]# groupadd -g 901 db2grp
[root@dragon ~]# groupadd -g 902 db2fgrp
[root@dragon ~]# groupadd -g 903 db2agrp
[root@dragon ~]# useradd -g db2grp -u 801 -d /home/db2inst1 -m -s /bin/bash db2inst1
[root@dragon ~]# useradd -g db2grp -u 802 -d /home/db2inst2 -m -s /bin/bash db2inst2
[root@dragon ~]# useradd -g db2fgrp -u 803 -d /home/db2fenc1 -m -s /bin/bash db2fenc1
[root@dragon ~]# useradd -g db2fgrp -u 804 -d /home/db2fenc2 -m -s /bin/bash db2fenc2
[root@dragon ~]# useradd -g db2agrp -u 805 -d /home/db2das -m -s /bin/bash db2das
修改实例用户密码
[root@dragon ~]# passwd db2inst1
[root@dragon ~]# passwd db2inst2
[root@dragon ~]# grep db2 /etc/passwd
db2inst1:x:801:901::/home/db2inst1:/bin/bash
db2inst2:x:802:901::/home/db2inst2:/bin/bash
db2fenc1:x:803:902::/home/db2fenc1:/bin/bash
db2fenc2:x:804:902::/home/db2fenc2:/bin/bash
db2das:x:805:903::/home/db2das:/bin/bash
[root@dragon ~]# grep db2 /etc/group
db2grp:x:901:
db2fgrp:x:902:
db2agrp:x:903:
创建实例1
[root@dragon instance]# /opt/ibm/db2/V10.5/instance/db2icrt -u db2fenc1 db2inst1
DBI1446I The db2icrt command is running.
DB2 installation is being initialized.
Total number of tasks to be performed: 4
Total estimated time for all tasks to be performed: 309 second(s)
Task #1 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #1 end
Task #2 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #2 end
Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)
Task #3 end
Task #4 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #4 end
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2icrt.log.41164".
DBI1070I Program db2icrt completed successfully.
创建实例2
[root@dragon instance]# /opt/ibm/db2/V10.5/instance/db2icrt -u db2fenc2 db2inst2
DBI1446I The db2icrt command is running.
DB2 installation is being initialized.
Total number of tasks to be performed: 4
Total estimated time for all tasks to be performed: 309 second(s)
Task #1 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #1 end
Task #2 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #2 end
Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)
Task #3 end
Task #4 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #4 end
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2icrt.log.50937".
DBI1070I Program db2icrt completed successfully.
查看已配置的db2端口号
[db2inst2@dragon ~]$ grep -i db2inst /etc/services
DB2_db2inst1 60000/tcp
DB2_db2inst1_1 60001/tcp
DB2_db2inst1_2 60002/tcp
DB2_db2inst1_3 60003/tcp
DB2_db2inst1_4 60004/tcp
DB2_db2inst1_END 60005/tcp
DB2_db2inst2 60006/tcp
DB2_db2inst2_1 60007/tcp
DB2_db2inst2_2 60008/tcp
DB2_db2inst2_3 60009/tcp
DB2_db2inst2_4 60010/tcp
DB2_db2inst2_END 60011/tcp
实例db2inst1
[db2inst1@dragon ~]$ db2set -all
[g] DB2SYSTEM=dragon
[g] DB2INSTDEF=db2inst1
[db2inst1@dragon ~]$ id
uid=801(db2inst1) gid=901(db2grp) groups=901(db2grp) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[db2inst1@dragon ~]$ db2set DB2AUTOSTART=YES
[db2inst1@dragon ~]$ db2set DB2COMM=tcpip
[db2inst1@dragon ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=dragon
[g] DB2INSTDEF=db2inst1
[db2inst1@dragon ~]$ db2 get dbm cfg|grep -i svcename
TCP/IP Service name (SVCENAME) =
SSL service name (SSL_SVCENAME) =
[db2inst1@dragon ~]$ db2 update dbm cfg using SVCENAME DB2_db2inst1
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
[db2inst1@dragon ~]$ db2 get dbm cfg|grep -i svcename
TCP/IP Service name (SVCENAME) = DB2_db2inst1
实例db2inst2
[db2inst2@dragon ~]$ db2set -all
[g] DB2SYSTEM=dragon
[g] DB2INSTDEF=db2inst1
[db2inst2@dragon ~]$ db2set DB2AUTOSTART=YES
[db2inst2@dragon ~]$ db2set DB2COMM=tcpip
[db2inst2@dragon ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=dragon
[g] DB2INSTDEF=db2inst1
[db2inst2@dragon ~]$ db2 get dbm cfg|grep -i svcename
TCP/IP Service name (SVCENAME) =
SSL service name (SSL_SVCENAME) =
[db2inst2@dragon ~]$ db2 update dbm cfg using SVCENAME DB2_db2inst2
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
[db2inst2@dragon ~]$ db2 get dbm cfg|grep -i svcename
TCP/IP Service name (SVCENAME) = DB2_db2inst2
[db2inst1@dragon ~]$ db2start
09/11/2019 16:30:57 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
[db2inst2@dragon ~]$ db2start
09/11/2019 16:31:43 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
创建标准目录
[root@dragon ~]# mkdir -p /data/db/db2/{db2inst1,db2inst2}/{db2backup,db2data,actlog,arclog,db2diag}
[root@dragon db2]# pwd
/data/db/db2
[root@dragon db2]# tree
.
├── db2inst1
│ ├── actlog
│ ├── arclog
│ ├── db2backup
│ ├── db2data
│ └── db2diag
└── db2inst2
├── actlog
├── arclog
├── db2backup
├── db2data
└── db2diag
chown -R db2inst1.db2grp /data/db/db2/db2inst1
chown -R db2inst2.db2grp /data/db/db2/db2inst2
以下赋予粘滞位权限
chmod 1757 /data/db/db2/db2inst1/db2diag
配置dbm参数
实例1:
db2 update dbm cfg using DIAGPATH /data/db/db2/db2inst1/db2diag/
db2 update dbm cfg using DFTDBPATH /data/db/db2/db2inst1/db2data/
实例2:
db2 update dbm cfg using DIAGPATH /data/db/db2/db2inst2/db2diag/
db2 update dbm cfg using DFTDBPATH /data/db/db2/db2inst2/db2data/
[db2inst1@dragon ~]$ db2sampl
Creating database "SAMPLE"...
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...
Creating tables with XML columns and XML data in schema "DB2INST1"...
'db2sampl' processing complete.
db2 update db cfg for sample using NEWLOGPATH /data/db/db2/db2inst1/actlog/
db2 update db cfg for sample using LOGARCHMETH1 DISK:/data/db/db2/db2inst1/arclog/
db2 UPDATE DB CFG FOR SAMPLE USING TRACKMOD ON
db2 UPDATE DB CFG FOR SAMPLE USING LOGINDEXBUILD ON
db2 UPDATE DB CFG FOR SAMPLE USING INDEXREC RESTART
[db2inst1@dragon ~]$ db2 backup db sample to /data/db/db2/db2inst1/db2backup/
Backup successful. The timestamp for this backup image is : 20190911194848
[db2inst1@dragon ~]$ ls -l /data/db/db2/db2inst1/db2backup/
total 169112
-rw-------. 1 db2inst1 db2grp 173170688 Sep 11 19:48 SAMPLE.0.db2inst1.DBPART000.20190911194848.001
[db2inst2@dragon ~]$ db2 RESTORE DATABASE SAMPLE FROM '/data/db/db2/db2inst2/db2backup' TAKEN AT 20190911194848 ON '/data/db/db2/db2inst2/db2data' INTO SAMPLE NEWLOGPATH '/data/db/db2/db2inst2/actlog'
DB20000I The RESTORE DATABASE command completed successfully.
Primary
db2 update db cfg for sample using HADR_LOCAL_HOST dragon
db2 update db cfg for sample using HADR_LOCAL_SVC DB2_db2inst1_4
db2 update db cfg for sample using HADR_REMOTE_HOST dragon
db2 update db cfg for sample using HADR_REMOTE_SVC DB2_db2inst2_4
db2 update db cfg for sample using HADR_REMOTE_INST db2inst2
[db2inst1@dragon db2backup]$ db2 terminate
DB20000I The TERMINATE command completed successfully.
[db2inst1@dragon db2backup]$ db2 get db cfg for sample | grep HADR
HADR database role = STANDARD
HADR local host name (HADR_LOCAL_HOST) = dragon
HADR local service name (HADR_LOCAL_SVC) = DB2_db2inst1_4
HADR remote host name (HADR_REMOTE_HOST) = dragon
HADR remote service name (HADR_REMOTE_SVC) = DB2_db2inst2_4
HADR instance name of remote server (HADR_REMOTE_INST) = db2inst2
HADR timeout value (HADR_TIMEOUT) = 120
HADR target list (HADR_TARGET_LIST) =
HADR log write synchronization mode (HADR_SYNCMODE) = NEARSYNC
HADR spool log data limit (4KB) (HADR_SPOOL_LIMIT) = AUTOMATIC(0)
HADR log replay delay (seconds) (HADR_REPLAY_DELAY) = 0
HADR peer window duration (seconds) (HADR_PEER_WINDOW) = 0
Standby
db2 update db cfg for sample using HADR_LOCAL_HOST dragon
db2 update db cfg for sample using HADR_LOCAL_SVC DB2_db2inst2_4
db2 update db cfg for sample using HADR_REMOTE_HOST dragon
db2 update db cfg for sample using HADR_REMOTE_SVC DB2_db2inst1_4
db2 update db cfg for sample using HADR_REMOTE_INST db2inst1
[db2inst2@dragon ~]$ db2 terminate
DB20000I The TERMINATE command completed successfully.
[db2inst2@dragon ~]$ db2 get db cfg for sample | grep HADR
HADR database role = STANDARD
HADR local host name (HADR_LOCAL_HOST) = dragon
HADR local service name (HADR_LOCAL_SVC) = DB2_db2inst2_4
HADR remote host name (HADR_REMOTE_HOST) = dragon
HADR remote service name (HADR_REMOTE_SVC) = DB2_db2inst1_4
HADR instance name of remote server (HADR_REMOTE_INST) = db2inst1
HADR timeout value (HADR_TIMEOUT) = 120
HADR target list (HADR_TARGET_LIST) =
HADR log write synchronization mode (HADR_SYNCMODE) = NEARSYNC
HADR spool log data limit (4KB) (HADR_SPOOL_LIMIT) = AUTOMATIC(0)
HADR log replay delay (seconds) (HADR_REPLAY_DELAY) = 0
HADR peer window duration (seconds) (HADR_PEER_WINDOW) = 0
[db2inst2@dragon ~]$ db2 start hadr on database sample as standby
DB20000I The START HADR ON DATABASE command completed successfully.
[db2inst1@dragon db2backup]$ db2 start hadr on database sample as primary
DB20000I The START HADR ON DATABASE command completed successfully.
Primary
[db2inst1@dragon db2backup]$ db2pd -d sample -hadr
Database Member 0 -- Database SAMPLE -- Active -- Up 0 days 00:29:14 -- Date 2019-09-11-20.47.26.846837
HADR_ROLE = PRIMARY
REPLAY_TYPE = PHYSICAL
HADR_SYNCMODE = NEARSYNC
STANDBY_ID = 1
LOG_STREAM_ID = 0
HADR_STATE = PEER
HADR_FLAGS =
PRIMARY_MEMBER_HOST = dragon
PRIMARY_INSTANCE = db2inst1
PRIMARY_MEMBER = 0
STANDBY_MEMBER_HOST = dragon
STANDBY_INSTANCE = db2inst2
STANDBY_MEMBER = 0
HADR_CONNECT_STATUS = CONNECTED
HADR_CONNECT_STATUS_TIME = 09/11/2019 20:43:41.206444 (1568205821)
HEARTBEAT_INTERVAL(seconds) = 30
HEARTBEAT_MISSED = 0
HEARTBEAT_EXPECTED = 7
HADR_TIMEOUT(seconds) = 120
TIME_SINCE_LAST_RECV(seconds) = 15
PEER_WAIT_LIMIT(seconds) = 0
LOG_HADR_WAIT_CUR(seconds) = 0.000
LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
LOG_HADR_WAIT_ACCUMULATED(seconds) = 0.000
LOG_HADR_WAIT_COUNT = 0
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 0, 660150
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 0, 174758
PRIMARY_LOG_FILE,PAGE,POS = S0000000.LOG, 79, 41084155
STANDBY_LOG_FILE,PAGE,POS = S0000000.LOG, 79, 41084155
HADR_LOG_GAP(bytes) = 0
STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000000.LOG, 79, 41084155
STANDBY_RECV_REPLAY_GAP(bytes) = 0
PRIMARY_LOG_TIME = 09/11/2019 20:33:25.000000 (1568205205)
STANDBY_LOG_TIME = 09/11/2019 20:33:25.000000 (1568205205)
STANDBY_REPLAY_LOG_TIME = 09/11/2019 20:33:25.000000 (1568205205)
STANDBY_RECV_BUF_SIZE(pages) = 512
STANDBY_RECV_BUF_PERCENT = 0
STANDBY_SPOOL_LIMIT(pages) = 13000
STANDBY_SPOOL_PERCENT = 0
STANDBY_ERROR_TIME = NULL
PEER_WINDOW(seconds) = 0
READS_ON_STANDBY_ENABLED = N
Standby
db2inst2@dragon ~]$ db2pd -d sample -hadr
Database Member 0 -- Database SAMPLE -- Standby -- Up 0 days 00:05:32 -- Date 2019-09-11-20.48.22.718697
HADR_ROLE = STANDBY
REPLAY_TYPE = PHYSICAL
HADR_SYNCMODE = NEARSYNC
STANDBY_ID = 0
LOG_STREAM_ID = 0
HADR_STATE = PEER
HADR_FLAGS =
PRIMARY_MEMBER_HOST = dragon
PRIMARY_INSTANCE = db2inst1
PRIMARY_MEMBER = 0
STANDBY_MEMBER_HOST = dragon
STANDBY_INSTANCE = db2inst2
STANDBY_MEMBER = 0
HADR_CONNECT_STATUS = CONNECTED
HADR_CONNECT_STATUS_TIME = 09/11/2019 20:43:41.205828 (1568205821)
HEARTBEAT_INTERVAL(seconds) = 30
HEARTBEAT_MISSED = 0
HEARTBEAT_EXPECTED = 9
HADR_TIMEOUT(seconds) = 120
TIME_SINCE_LAST_RECV(seconds) = 12
PEER_WAIT_LIMIT(seconds) = 0
LOG_HADR_WAIT_CUR(seconds) = 0.000
LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
LOG_HADR_WAIT_ACCUMULATED(seconds) = 0.000
LOG_HADR_WAIT_COUNT = 0
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 0, 660150
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 0, 174758
PRIMARY_LOG_FILE,PAGE,POS = S0000000.LOG, 79, 41084155
STANDBY_LOG_FILE,PAGE,POS = S0000000.LOG, 79, 41084155
HADR_LOG_GAP(bytes) = 0
STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000000.LOG, 79, 41084155
STANDBY_RECV_REPLAY_GAP(bytes) = 0
PRIMARY_LOG_TIME = 09/11/2019 20:33:25.000000 (1568205205)
STANDBY_LOG_TIME = 09/11/2019 20:33:25.000000 (1568205205)
STANDBY_REPLAY_LOG_TIME = 09/11/2019 20:33:25.000000 (1568205205)
STANDBY_RECV_BUF_SIZE(pages) = 512
STANDBY_RECV_BUF_PERCENT = 0
STANDBY_SPOOL_LIMIT(pages) = 13000
STANDBY_SPOOL_PERCENT = 0
STANDBY_ERROR_TIME = NULL
PEER_WINDOW(seconds) = 0
READS_ON_STANDBY_ENABLED = N
[db2inst1@dragon db2backup]$ db2 "create table t1(a int,b int)"
DB20000I The SQL command completed successfully.
[db2inst1@dragon db2backup]$ db2 "insert into t1 values (1,1)"
DB20000I The SQL command completed successfully.
[db2inst2@dragon ~]$ db2 takeover hadr on database sample
DB20000I The TAKEOVER HADR ON DATABASE command completed successfully.
原standby变成primary端
[db2inst2@dragon ~]$ db2pd -hadr -alldbs
Database Member 0 -- Database SAMPLE -- Active -- Up 0 days 00:17:38 -- Date 2019-09-11-21.00.28.354997
HADR_ROLE = PRIMARY
REPLAY_TYPE = PHYSICAL
HADR_SYNCMODE = NEARSYNC
STANDBY_ID = 1
LOG_STREAM_ID = 0
HADR_STATE = PEER
HADR_FLAGS =
PRIMARY_MEMBER_HOST = dragon
PRIMARY_INSTANCE = db2inst2
PRIMARY_MEMBER = 0
STANDBY_MEMBER_HOST = dragon
STANDBY_INSTANCE = db2inst1
STANDBY_MEMBER = 0
HADR_CONNECT_STATUS = CONNECTED
HADR_CONNECT_STATUS_TIME = 09/11/2019 20:43:41.205828 (1568205821)
HEARTBEAT_INTERVAL(seconds) = 30
HEARTBEAT_MISSED = 0
HEARTBEAT_EXPECTED = 33
HADR_TIMEOUT(seconds) = 120
TIME_SINCE_LAST_RECV(seconds) = 21
PEER_WAIT_LIMIT(seconds) = 0
LOG_HADR_WAIT_CUR(seconds) = 0.000
LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
LOG_HADR_WAIT_ACCUMULATED(seconds) = 0.000
LOG_HADR_WAIT_COUNT = 0
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 0, 16384
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 0, 87380
PRIMARY_LOG_FILE,PAGE,POS = S0000000.LOG, 275, 41884044
STANDBY_LOG_FILE,PAGE,POS = S0000000.LOG, 275, 41884044
HADR_LOG_GAP(bytes) = 0
STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000000.LOG, 275, 41884044
STANDBY_RECV_REPLAY_GAP(bytes) = 0
PRIMARY_LOG_TIME = 09/11/2019 20:59:27.000000 (1568206767)
STANDBY_LOG_TIME = 09/11/2019 20:59:27.000000 (1568206767)
STANDBY_REPLAY_LOG_TIME = 09/11/2019 20:59:27.000000 (1568206767)
STANDBY_RECV_BUF_SIZE(pages) = 512
STANDBY_RECV_BUF_PERCENT = 0
STANDBY_SPOOL_LIMIT(pages) = 13000
STANDBY_SPOOL_PERCENT = 0
STANDBY_ERROR_TIME = NULL
PEER_WINDOW(seconds) = 0
READS_ON_STANDBY_ENABLED = N
原primary变成standby
[db2inst1@dragon db2backup]$ db2pd -hadr -alldbs
Database Member 0 -- Database SAMPLE -- Standby -- Up 0 days 00:43:23 -- Date 2019-09-11-21.01.35.757687
HADR_ROLE = STANDBY
REPLAY_TYPE = PHYSICAL
HADR_SYNCMODE = NEARSYNC
STANDBY_ID = 0
LOG_STREAM_ID = 0
HADR_STATE = PEER
HADR_FLAGS =
PRIMARY_MEMBER_HOST = dragon
PRIMARY_INSTANCE = db2inst2
PRIMARY_MEMBER = 0
STANDBY_MEMBER_HOST = dragon
STANDBY_INSTANCE = db2inst1
STANDBY_MEMBER = 0
HADR_CONNECT_STATUS = CONNECTED
HADR_CONNECT_STATUS_TIME = 09/11/2019 20:43:41.206444 (1568205821)
HEARTBEAT_INTERVAL(seconds) = 30
HEARTBEAT_MISSED = 0
HEARTBEAT_EXPECTED = 34
HADR_TIMEOUT(seconds) = 120
TIME_SINCE_LAST_RECV(seconds) = 29
PEER_WAIT_LIMIT(seconds) = 0
LOG_HADR_WAIT_CUR(seconds) = 0.000
LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
LOG_HADR_WAIT_ACCUMULATED(seconds) = 0.000
LOG_HADR_WAIT_COUNT = 0
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 0, 16384
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 0, 87380
PRIMARY_LOG_FILE,PAGE,POS = S0000000.LOG, 275, 41884044
STANDBY_LOG_FILE,PAGE,POS = S0000000.LOG, 275, 41884044
HADR_LOG_GAP(bytes) = 0
STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000000.LOG, 275, 41884044
STANDBY_RECV_REPLAY_GAP(bytes) = 0
PRIMARY_LOG_TIME = 09/11/2019 20:59:27.000000 (1568206767)
STANDBY_LOG_TIME = 09/11/2019 20:59:27.000000 (1568206767)
STANDBY_REPLAY_LOG_TIME = 09/11/2019 20:59:27.000000 (1568206767)
STANDBY_RECV_BUF_SIZE(pages) = 512
STANDBY_RECV_BUF_PERCENT = 0
STANDBY_SPOOL_LIMIT(pages) = 13000
STANDBY_SPOOL_PERCENT = 0
STANDBY_ERROR_TIME = NULL
PEER_WINDOW(seconds) = 0
READS_ON_STANDBY_ENABLED = N
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。