共計(jì) 4880 個(gè)字符,預(yù)計(jì)需要花費(fèi) 13 分鐘才能閱讀完成。
DB2_PureScale 備份與恢復(fù)是怎樣的,針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。
執(zhí)行在線(xiàn)備份
db2 backup database sampledb online to /gpfs1nsd/backup include logs
db2 list history backup all for sampledb
數(shù)據(jù)庫(kù)創(chuàng)建測(cè)試表,并插入數(shù)據(jù)
db2 create table test1 (name varchar(32))
db2 insert into test1 values (Jack)
檢查表空間狀態(tài)
db2 list tablespaces | grep State
restore 數(shù)據(jù)庫(kù)
db2 list active databases
db2inst1@psnode1:/gpfs1nsd/backup db2 restore database sampledb from /gpfs1nsd/backup taken at 20170117141422
SQL2539W The specified name of the backup image to restore is the same as the
name of the target database. Restoring to an existing database that is the
same as the backup image database will cause the current database to be
overwritten by the backup version.
Do you want to continue ? (y/n) y
DB20000I The RESTORE DATABASE command completed successfully.
數(shù)據(jù)庫(kù)前滾
db2inst1@psnode1:/gpfs1nsd/backup db2 rollforward db sampledb query status
Rollforward Status
Input database alias = sampledb
Number of members have returned status = 2
Member ID Rollforward Next log Log files processed Last committed transaction
status to be read
———– ————————– ——————- ————————- ————————–
0 DB pending S0000000.LOG – 2017-01-17-06.14.26.000000 UTC
1 DB pending S0000000.LOG – 2017-01-17-06.14.26.000000 UTC
db2inst1@psnode1:/gpfs1nsd/backup db2 list utilities show detail
SQL1611W No data was returned by Database System Monitor. SQLSTATE=00000
db2inst1@psnode1:/gpfs1nsd/backup db2 rollforward db sampledb to end of logs and stop
Rollforward Status
Input database alias = sampledb
Number of members have returned status = 2
Member ID Rollforward Next log Log files processed Last committed transaction
status to be read
———– ————————– ——————- ————————- ————————–
0 not pending S0000000.LOG-S0000000.LOG 2017-01-17-06.22.58.000000 UTC
1 not pending – 2017-01-17-06.14.26.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.
或者指定前滾的時(shí)間點(diǎn)
db2inst1@psnode1:/gpfs1nsd/backup db2 rollforward database sampledb to 2017-01-17-14.14.26.000000 using local time and complete overflow log path (/gpfs1nsd/backup)
Rollforward Status
Input database alias = sampledb
Number of members have returned status = 2
Member ID Rollforward Next log Log files processed Last committed transaction
status to be read
———– ————————– ——————- ————————- ————————–
0 not pending – 2017-01-17-14.14.26.000000 Local
1 not pending – 2017-01-17-14.14.26.000000 Local
DB20000I The ROLLFORWARD command completed successfully.
db2inst1@psnode1:/gpfs1nsd/backup db2 rollforward db sampledb query status
Rollforward Status
Input database alias = sampledb
Number of members have returned status = 2
Member ID Rollforward Next log Log files processed Last committed transaction
status to be read
———– ————————– ——————- ————————- ————————–
0 not pending S0000000.LOG-S0000000.LOG 2017-01-17-06.22.58.000000 UTC
1 not pending – 2017-01-17-06.14.26.000000 UTC
db2inst1@psnode1:/gpfs1nsd/backup
查看測(cè)試表數(shù)據(jù)
### 活動(dòng)日志 ###
PureScale 每個(gè) member 成員有自己的活動(dòng)日志文件,可以看到兩個(gè) member 的活動(dòng)日志分別存放在 LOGSTREAM0000 和 LOGSTREAM0001 中;
db2inst1@psnode2:/gpfs1nsd/db2log/NODE0000/LOGSTREAM0001 cd /gpfs1nsd/db2log/NODE0000/
db2inst1@psnode2:/gpfs1nsd/db2log/NODE0000 ls -rlt
total 0
drwxr-x— 4 db2inst1 db2grp 4096 Jan 17 14:42 LOGSTREAM0000
drwxr-x— 2 db2inst1 db2grp 4096 Jan 17 14:42 LOGSTREAM0001
### 歸檔日志 ###
PureScale 每個(gè) member 成員有自己的歸檔日志文件,可以看到兩個(gè) member 的歸檔日志分別存放在 LOGSTREAM0000 和 LOGSTREAM0001 中;
db2inst1@psnode2:/gpfs1nsd/db2arch/db2inst1/SAMPLEDB/NODE0000 ls -rlt
total 0
drwxr-x— 5 db2inst1 db2grp 4096 Jan 17 14:40 LOGSTREAM0000
drwxr-x— 5 db2inst1 db2grp 4096 Jan 17 14:42 LOGSTREAM0001
### 兩套 Purescale 數(shù)據(jù)庫(kù)間進(jìn)行重定向恢復(fù) ###
備庫(kù)執(zhí)行
cd /db2sd_20170116165543/backup
db2 restore database sampledb from /db2sd_20170116165543/backup into sampledb redirect generate script sampledb.clp without rolling forward
編輯 ESBDBFE.clp
(1)– LOGTARGET directory 為 LOGTARGET /db2sd_20170116165543/backup
(2) — DBPATH ON target-directory 改為 DBPATH ON /db2sd_20170116165543/SAMPLEDB
(2)注釋掉 without rolling forward
創(chuàng)建目錄
mkdir data1
mkdir data2
mkdir data3
mkdir data4
mkdir data5
mkdir data6
mkdir data7
mkdir data8
mkdir db2log
mkdir db2logmir
mkdir db2arch
設(shè)置 DB 路徑
db2 attach to db2sdin1
db2 update dbm cfg using DFTDBPATH /db2sd_20170116165543/SAMPLEDB
執(zhí)行 restore 命令
db2 terminate
db2 -tvf /db2sd_20170116165543/backup/sampledb.clp
查看數(shù)據(jù)庫(kù)恢復(fù)狀態(tài)
db2 list utilities show detail
查看前滾狀態(tài)
db2 rollforward db sampledb query status
執(zhí)行前滾操作
db2 rollforward db sampledb to end of logs and stop overflow log path (/db2sd_20170116165543/backup)
關(guān)于 DB2_PureScale 備份與恢復(fù)是怎樣的問(wèn)題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒(méi)有解開(kāi),可以關(guān)注丸趣 TV 行業(yè)資訊頻道了解更多相關(guān)知識(shí)。