网页和接口自动化测试开发

How to check DB2 multiple archiv

2016-10-27  本文已影响711人  30而立人

Basic knowledge of DB2 archive log

more details please go to DB2 logging official website

There are two types of logging in DB2, the circular logging and archive logging.

figure1.gif figure2.gif

The physical log files store in the Disk with archive logging

There are 5 logging folders store the different period of archive logs. We can use blow db2 command to find all of the 5 logfolder path:

db2 get db cfg

You will see the 5 paths:


paths.png

Now, actually the 5 logging path blows to Online archived logs and Off-line archived logs.

** Online archived logs **

UPDATE DB CFG FOR db_name USING LOGPRIMARY 3
UPDATE DB CFG FOR db_name USING LOGSECOND 2

Off-line archived logs

How DB2 backup files with Archive logging

DB2 archive log backup.png

So,the key point is:

How DB2 restore archive logs with Archive logging

DB2 archive log restore.png

So, the key point is:

What situation can make RAU can't read archive logs

The only scenario is the required archived files not exist in all of five archive log paths. So If we want to ensure RAU run smoothly , I suggest to back up archive logs to at least one off-line log path. Recommend use the LOGARCHMETH1.

Test steps for the multiple archive path

>db2
db2 =>connect to db_name 
db2 =>UPDATE DATABASE CONFIGURATION USING logarchmeth1 DISK:path1
db2 =>UPDATE DATABASE CONFIGURATION USING logarchmeth2 DISK:path2
db2 =>UPDATE DB CFG FOR db_name USING SOFTMAX 200
db2 =>UPDATE DB CFG FOR db_name USING LOGPRIMARY 3
db2 =>UPDATE DB CFG FOR db_name USING LOGSECOND 2
db2 =>BACKUP  DATABASE  db_name TO path1
db2 =>db2stop force
db2 =>db2start
ra_config pds_host_name,localhost
go
ra_config pds_database_name,db_name 
go
ra_config pds_port_number,50000
go
ra_config pds_username,pds_user
go
ra_config pds_password,Sybase123
go
ra_config pds_datasource_name,db_name 
go
test_connection PDS
go
ra_admin init
go
trace LTITRACELTL,true 
go
ra_config connect_to_rs,false  
go
ra_config use_rssd,false 
go
db2 =>create table chartest(pkey int,varchar(20))
pdb_setreptable chartest,mark
go
ra_locator move_truncpt
go
insert into chartest values(1,'KKKKKK')

recommend you use DB2 procedure or write a script to insert mass data

insert into chartest values(1,'KKKKKK')
insert into chartest values(1,'HHHHHH')

now lets look at all archive log path, in LOGPATH is S0000182 ~S0000186, in MIRRORLOGPATH is S0000182 ~S0000186 too (those are online logs), in LOGARCHMETH1 and LOGARCHMETH2 are S0000167 ~ S0000181(those are archived logs).

resume
go

after resume RAU, you can see the off-line archived log file is coping to LOGPATH. And then ,open the LTITRACELL.log file in RAU instance folder,you will find the keyword 'KKKKK'.
Run RA command:

suspend
go
resume
go

you will find ra stoped replication due to error,no LTL log output.
The error log like LogReader encountered exception with unknown error: <An attempt to read transaction log data failed because the Log containing the requested Log Sequence Number can not be found...
The error occurs because the log locator can't match any exist on-line archive files and off-line archived files.

Summary

We should suggest customer to enable LOGARCHMETH1 or enable LOGARCHMETH1 and LOGARCHMETH2 to ensure all archive files archived to off-line.

上一篇 下一篇

猜你喜欢

热点阅读