您好,登錄后才能下訂單哦!
DB2_PureScale備份與恢復是怎樣的,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
執行在線備份
db2 backup database sampledb online to /gpfs1nsd/backup include logs
db2 list history backup all for sampledb
數據庫創建測試表,并插入數據
db2 "create table test1 (name varchar(32))"
db2 "insert into test1 values ('Jack')"
檢查表空間狀態
db2 list tablespaces | grep State
restore數據庫
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.
數據庫前滾
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.
或者指定前滾的時間點
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>
查看測試表數據
###活動日志###
PureScale每個member成員有自己的活動日志文件,可以看到兩個member的活動日志分別存放在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每個member成員有自己的歸檔日志文件,可以看到兩個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數據庫間進行重定向恢復###
備庫執行
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
創建目錄
mkdir data1
mkdir data2
mkdir data3
mkdir data4
mkdir data5
mkdir data6
mkdir data7
mkdir data8
mkdir db2log
mkdir db2logmir
mkdir db2arch
設置DB路徑
db2 attach to db2sdin1
db2 update dbm cfg using DFTDBPATH '/db2sd_20170116165543/SAMPLEDB'
執行restore命令
db2 terminate
db2 -tvf /db2sd_20170116165543/backup/sampledb.clp
查看數據庫恢復狀態
db2 list utilities show detail
查看前滾狀態
db2 rollforward db sampledb query status
執行前滾操作
db2 "rollforward db sampledb to end of logs and stop overflow log path ('/db2sd_20170116165543/backup')"
關于DB2_PureScale備份與恢復是怎樣的問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。