189 8069 5689

DB2_PureScale备份与恢复是怎样的

DB2_PureScale备份与恢复是怎样的,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

10年的忠县网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。营销型网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整忠县建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“忠县网站设计”,“忠县网站推广”以来,每个客户项目都认真落实执行。

执行在线备份
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 ''为      LOGTARGET '/db2sd_20170116165543/backup'
    (2) -- DBPATH ON '' 改为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备份与恢复是怎样的问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。


分享文章:DB2_PureScale备份与恢复是怎样的
当前链接:http://cdxtjz.cn/article/iidjph.html

其他资讯