Project

General

Profile

Database Mirroring (DB2) on remote site » History » Version 7

chin-yeh, 03/21/2012 06:15 PM

1 1 chin-yeh
{{toc}}
2
3 2 chin-yeh
h1. Database Mirroring on remote site
4
5
h2. Introduction
6
7 3 chin-yeh
To mirror production database(s) to remote site, there are a number of approaches:
8
# Use <code>(full)</code> database backup
9
# Use <code>(full + incremental)</code> database backup
10
# Use <code>(full + delta)</code> database backup
11
# Use <code>(full + incremental + delta)</code> database backup - _not recommended because it is too complex_
12
# Use <code>(full database backup + transaction logs)</code>
13
14
> the approach 1-4 are described in "Using DB2 incremental backup":http://www.ibm.com/developerworks/data/library/techarticle/dm-0910db2incrementalbackup/
15
16
The following sections will describe how the last approach actually works. Before that, let's do a compare:
17 4 chin-yeh
18 3 chin-yeh
!database_mirroring_approach.png!
19 4 chin-yeh
20
h2. Full Database Backup + Transaction Logs
21 5 chin-yeh
22
Below diagram describes how this approach works:
23
24
!full_transaction_logs_approach.png!
25 6 chin-yeh
26
_Sample steps:_
27
# Like any other approaches, you must perform a full database backup _(either offline or online)_
28
** e.g.:
29
<pre>$ db2 backup db prod_db online</pre>
30
# Use the <code>rsync</code> command to do an one way incremental sync from remote (production) site to standby site.
31
** e.g.:
32
<pre>$ rsync -var --delete db2inst1@db-prod:/home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/ /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR</pre>
33
# Execute the <code>rollfoward</code> on the standby database: (*do not* include the *complete* option)
34
** e.g.:
35
<pre>$ db2 rollforward db prod_db to end of logs</pre>
36
# If want to bring up standby database, just execute this command:
37
<pre>$ db2 rollforward db prod_db complete</pre>
38
39
The main selling points of this approach is there's little or no need to revise current backup strategies, however, the mirror database cannot be used until the <code>rollforward</code> process is terminated.
40
41 7 chin-yeh
h2. Test Tools