db2 异机备份恢复





生产端

 

$ db2 connect to dcold

 

   Database Connection Information

 

 Database server        = DB2/6000 8.1.6

 SQL authorization ID   = DB2ADMIN

 Local database alias   = DCOLD

 

$ db2 backup db DCOLD online to /db2backup/todaybackup compress

 

Backup successful. The timestamp for this backup image is :20141201092232

 

$ cd /db2backup/todaybackup

$ ls -rtl

total 92430752

-rw-r—–    1 db2admin db2grp1    16797696 Dec 01 08:20 ADDOLD.0.db2admin.NODE0000.CATN0000.20141201082033.001

-rw-r—–    1 db2admin db2grp1    12603392 Dec 01 08:30 RONEOLD.0.db2admin.NODE0000.CATN0000.20141201083001.001

-rw-r—–    1 db2admin db2grp1   113266688 Dec 01 08:43 CTROLD.0.db2admin.NODE0000.CATN0000.20141201084209.001

-rw-r—–    1 db2admin db2grp1  11400138752 Dec 01 08:43 STMAOLD.0.db2admin.NODE0000.CATN0000.20141201081852.001

-rw-r—–    1 db2admin db2grp1   117460992 Dec 01 09:00 SHAREOLD.0.db2admin.NODE0000.CATN0000.20141201085950.001

-rw-r—–    1 db2admin db2grp1    16797696 Dec 01 09:15 ROEEEOLD.0.db2admin.NODE0000.CATN0000.20141201091505.001

-rw-r—–    1 db2admin db2grp1    83906560 Dec 01 09:35 CDBOLD.0.db2admin.NODE0000.CATN0000.20141201093422.001

-rw-r—–    1 db2admin db2grp1    41963520 Dec 01 09:48 DCEIIOLD.0.db2admin.NODE0000.CATN0000.20141201094734.001

-rw-r—–    1 db2admin db2grp1     8409088 Dec 01 09:58 GNGTRANS.0.db2admin.NODE0000.CATN0000.20141201095832.001

-rw-r—–    1 db2admin db2grp1  35513192448 Dec 01 11:01 DCOLD.0.db2admin.NODE0000.CATN0000.20141201092232.001

 

目标端

$ db2 restore db dcold from '/db2backup/dcold' taken at 20141201092232

SQL2539W  Warning!  Restoring to an existing database that is the same as the backup image database.  The database files will be deleted.

Do you want to continue ? (y/n) y

 

DB20000I  The RESTORE DATABASE command completed successfully.

 

$ db2 rollforward db dcold query status

 

                                 Rollforward Status

 

 Input database alias                   = dcold

 Number of nodes have returned status   = 1

 

 Node number                            = 0

 Rollforward status                     = DB  pending

 Next log file to be read               = S0006886.LOG

 Log files processed                    =  -

 Last committed transaction             = 2014-10-03-01.31.42.000000

 

生产端

$ db2 connect to dcold

 

   Database Connection Information

 

 Database server        = DB2/6000 8.1.6

 SQL authorization ID   = DB2ADMIN

 Local database alias   = DCOLD

 

$ db2 get db cfg |grep -i log

 Log retain for recovery status                          = RECOVERY

 User exit for logging status                            = YES

 Catalog cache size (4KB)              (CATALOGCACHE_SZ) = (MAXAPPLS*4)

 Log buffer size (4KB)                        (LOGBUFSZ) = 256

 Log file size (4KB)                         (LOGFILSIZ) = 20000

 Number of primary log files                (LOGPRIMARY) = 20

 Number of secondary log files               (LOGSECOND) = 20

 Changed path to log files                  (NEWLOGPATH) = 

 Path to log files                                       = /db2_log/stmadc/

 Overflow log path                     (OVERFLOWLOGPATH) = 

 Mirror log path                         (MIRRORLOGPATH) = 

 First active log file                                   = S0006953.LOG

 Block log on disk full                (BLK_LOG_DSK_FUL) = NO

 Percent of max active log space by transaction(MAX_LOG) = 0

 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0

 Percent log file reclaimed before soft chckpt (SOFTMAX) = 100

 Log retain for recovery enabled             (LOGRETAIN) = RECOVERY

 User exit for logging enabled                (USEREXIT) = ON

$ cd /db2_log/stmadc/

$ ls -l S0006886.LOG

ls: 0653-341 The file S0006886.LOG does not exist.

$ cd /db2_arch/arch/DCOLD/NODE0000

$ ls -l S0006886.LOG

 

$ scp S0006886.LOG 10.44.65.82:/db2backup/dcold

db2admin@10.44.65.82's password: 

S0006886.LOG                                                                                                                         100%   78MB  26.0MB/s   00:03

 

目标端

$ db2 "rollforward db dcold to end of logs and stop overflow log path (/db2backup/dcold)"

 

                                 Rollforward Status

 

 Input database alias                   = dcold

 Number of nodes have returned status   = 1

 

 Node number                            = 0

 Rollforward status                     = not pending

 Next log file to be read               =

 Log files processed                    = S0006886.LOG – S0006953.LOG

 Last committed transaction             = 2014-12-01-08.15.52.000000

 

DB20000I  The ROLLFORWARD command completed successfully.

$ db2 connect to dcold

 

   Database Connection Information

 

 Database server        = DB2/6000 8.1.6

 SQL authorization ID   = DB2ADMIN

 Local database alias   = DCOLD

 

$ db2 get db cfg | grep -i log

 Log retain for recovery status                          = RECOVERY

 User exit for logging status                            = YES

 Catalog cache size (4KB)              (CATALOGCACHE_SZ) = (MAXAPPLS*4)

 Log buffer size (4KB)                        (LOGBUFSZ) = 256

 Log file size (4KB)                         (LOGFILSIZ) = 20000

 Number of primary log files                (LOGPRIMARY) = 20

 Number of secondary log files               (LOGSECOND) = 20

 Changed path to log files                  (NEWLOGPATH) = 

 Path to log files                                       = /db2_log/stmadc/

 Overflow log path                     (OVERFLOWLOGPATH) = 

 Mirror log path                         (MIRRORLOGPATH) = 

 First active log file                                   = S0006954.LOG

 Block log on disk full                (BLK_LOG_DSK_FUL) = NO

 Percent of max active log space by transaction(MAX_LOG) = 0

 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0

 Percent log file reclaimed before soft chckpt (SOFTMAX) = 100

 Log retain for recovery enabled             (LOGRETAIN) = RECOVERY

 User exit for logging enabled                (USEREXIT) = ON




Related posts

coded by nessus
分享:  DeliciousGReader鲜果豆瓣CSDN网摘
Trackback

no comment untill now

Add your comment now

无觅相关文章插件