DB2 多分区环境下load copy yes问题

建库
db2 "CREATE DATABASE MDS AUTOMATIC STORAGE NO ON /db2 USING CODESET UTF-8 TERRITORY CN"
创建表空间:
db2 -tvf mds.sql
CONNECT TO MDS
   Database Connection Information
Database server        = DB2/AIX64 9.5.8
SQL authorization ID   = DB2MDS
Local database alias   = MDS

CREATE LARGE TABLESPACE "TBS_M_BP_GL_DAT" IN DATABASE PARTITION GROUP PDPG PAGESIZE 32768 MANAGED BY DATABASE USING (FILE '/db2/db2mds/db2data1/TBS_M_BP_GL_DAT.DAT' 2G) ON DBPARTITIONNUMS (1) USING (FILE '/db2/db2mds/db2data2/TBS_M_BP_GL_DAT.DAT' 2G) ON DBPARTITIONNUMS (2) USING (FILE '/db2/db2mds/db2data3/TBS_M_BP_GL_DAT.DAT' 2G) ON DBPARTITIONNUMS (3) USING (FILE '/db2/db2mds/db2data4/TBS_M_BP_GL_DAT.DAT' 2G) ON DBPARTITIONNUMS (4) USING (FILE '/db2/db2mds/db2data5/TBS_M_BP_GL_DAT.DAT' 2G) ON DBPARTITIONNUMS (5) USING (FILE '/db2/db2mds/db2data6/TBS_M_BP_GL_DAT.DAT' 2G) ON DBPARTITIONNUMS (6) USING (FILE '/db2/db2mds/db2data7/TBS_M_BP_GL_DAT.DAT' 2G) ON DBPARTITIONNUMS (7) USING (FILE '/db2/db2mds/db2data8/TBS_M_BP_GL_DAT.DAT' 2G) ON DBPARTITIONNUMS (8) EXTENTSIZE 32 PREFETCHSIZE AUTOMATIC BUFFERPOOL BP_32K OVERHEAD 7.500000 TRANSFERRATE 0.060000 NO FILE SYSTEM CACHING DROPPED TABLE RECOVERY ON
DB20000I  The SQL command completed successfully.
修改归档方式:
db2 update db cfg for mds DBPARTITIONNUM 0  using NEWLOGPATH /db2/db2mds/db2log0/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc0/mds
db2 update db cfg for mds DBPARTITIONNUM 1  using NEWLOGPATH /db2/db2mds/db2log1/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc1/mds
db2 update db cfg for mds DBPARTITIONNUM 2  using NEWLOGPATH /db2/db2mds/db2log2/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc2/mds
db2 update db cfg for mds DBPARTITIONNUM 3  using NEWLOGPATH /db2/db2mds/db2log3/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc3/mds
db2 update db cfg for mds DBPARTITIONNUM 3  using NEWLOGPATH /db2/db2mds/db2log3/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc3/mds
db2 update db cfg for mds DBPARTITIONNUM 4  using NEWLOGPATH /db2/db2mds/db2log4/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc4/mds
db2 update db cfg for mds DBPARTITIONNUM 5  using NEWLOGPATH /db2/db2mds/db2log5/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc5/mds
db2 update db cfg for mds DBPARTITIONNUM 6  using NEWLOGPATH /db2/db2mds/db2log6/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc6/mds
db2 update db cfg for mds DBPARTITIONNUM 7  using NEWLOGPATH /db2/db2mds/db2log7/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc7/mds
db2 update db cfg for mds DBPARTITIONNUM 8  using NEWLOGPATH /db2/db2mds/db2log8/mds LOGARCHMETH1 DISK:/db2/db2mds/db2arc8/mds

进行归档切换备份
db2_all "<<+0< db2 BACKUP DB MDS to /dev/null"
db2_all "|<<-0< db2 BACKUP DB MDS  to /dev/null"

生成测试数据:
CREATE TABLE TEMP (
ID INT NOT NULL PRIMARY KEY,
NAME CHAR(10),
SALARY DECIMAL(8,2))
DISTRIBUTE BY HASH ("ID")
IN "TBS_M_BP_GL_DAT";

INSERT INTO TEMP
WITH TEMP_CT (A,B) AS
(VALUES(INTEGER(1),RAND(1))
UNION ALL
SELECT A+1,RAND()
FROM TEMP_CT
WHERE A<1000000
)
SELECT A AS ID, 'EMP'||CHAR(A) AS NAME, DECIMAL((B*10000),8,2) AS SALARY
FROM TEMP_CT;



创建恢复备份:
db2_all "<<+0< db2 BACKUP DB MDS to /db2/db2mds/backup"
db2_all "|<<-0< db2 BACKUP DB MDS  to /db2/db2mds/backup"


创建导入表:
CREATE TABLE TEMP1 (
ID INT NOT NULL PRIMARY KEY,
NAME CHAR(10),
SALARY DECIMAL(8,2))
DISTRIBUTE BY HASH ("ID")
IN "TBS_M_BP_GL_DAT";
导入数据:
db2 "load from temp.del of del replace into temp1 copy yes to /db2/db2mds/load"


使用备份进行恢复
db2_all "<<+0< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING"
nohup db2_all "<<+1< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING" &
nohup db2_all "<<+2< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING" &
nohup db2_all "<<+3< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING" &
nohup db2_all "<<+4< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING" &
nohup db2_all "<<+5< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING" &
nohup db2_all "<<+6< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING" &
nohup db2_all "<<+7< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING" &
nohup db2_all "<<+8< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING" &

db2_all "db2set DB2LOADREC=/db2/db2mds/load/loadrec"
修改/db2/db2mds/load/loadrec文件
CASHMAPP2:/db2/db2mds/load$more loadrec
TIM 20120227141358
DBP 0
SCH DB2MDS
TAB TEMP1
DAT MDS
DB2 db2mds
BUF NULL
SES NULL
TYP L
LOCationnumber 8
entry /db2/db2mds/load/MDS.4.db2mds.NODE0008.CATN0000.20120227141358.001
/db2/db2mds/load/MDS.4.db2mds.NODE0007.CATN0000.20120227141358.001
/db2/db2mds/load/MDS.4.db2mds.NODE0006.CATN0000.20120227141358.001
/db2/db2mds/load/MDS.4.db2mds.NODE0005.CATN0000.20120227141358.001
/db2/db2mds/load/MDS.4.db2mds.NODE0004.CATN0000.20120227141358.001
/db2/db2mds/load/MDS.4.db2mds.NODE0003.CATN0000.20120227141358.001
/db2/db2mds/load/MDS.4.db2mds.NODE0002.CATN0000.20120227141358.001
/db2/db2mds/load/MDS.4.db2mds.NODE0001.CATN0000.20120227141358.001

查看数据库前滚状态:
db2 rollforward db mds query status
                                 Rollforward Status
Input database alias                   = mds
Number of nodes have returned status   = 9
Node number  Rollforward                 Next log             Log files processed        Last committed transaction
              status                      to be read
-----------  --------------------------  -------------------  -------------------------  --------------------------
           0  DB  pending                 S0000001.LOG                     -              2012-02-27-06.12.43.000000 UTC
           1  DB  pending                 S0000005.LOG                     -              2012-02-27-06.13.00.000000 UTC
           2  DB  pending                 S0000005.LOG                     -              2012-02-27-06.13.01.000000 UTC
           3  DB  pending                 S0000005.LOG                     -              2012-02-27-06.13.01.000000 UTC
           4  DB  pending                 S0000005.LOG                     -              2012-02-27-06.13.01.000000 UTC
           5  DB  pending                 S0000005.LOG                     -              2012-02-27-06.13.04.000000 UTC
           6  DB  pending                 S0000005.LOG                     -              2012-02-27-06.13.04.000000 UTC
           7  DB  pending                 S0000005.LOG                     -              2012-02-27-06.13.04.000000 UTC
           8  DB  pending                 S0000005.LOG                     -              2012-02-27-06.13.04.000000 UTC
进行数据库前滚:
db2 "rollforward db mds to end of logs and complete "

CASHMAPP2:/db2/db2mds/backup$db2 "rollforward db mds to end of logs and complete "
SQL3799W  Load recovery for table "DB2MDS  .TEMP1" at time "20120227141358" on
node "5" is pending due to warning "-3784" with additional information "2".
Do you want to continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t)
Do you want to continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t)
Do you want to continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t)
Do you want to continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t)

进行最后一步的前滚时,会一直让选择 "continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t) "
大家谁见过类似的情况?怎么解决的?
参与11

10同行回答

weiruan85weiruan85数据库管理员ibm
把4的 db2diag.log 贴出来,好让大家帮你看看。显示全部
把4的 db2diag.log 贴出来,好让大家帮你看看。收起
政府机关 · 2012-02-29
浏览1406
tongjixianingtongjixianing软件开发工程师IBM
呵呵,这个确实没注意到,这个和多分区应该没关系,每个文件前都应该有ENT的。显示全部
呵呵,这个确实没注意到,这个和多分区应该没关系,每个文件前都应该有ENT的。收起
互联网服务 · 2012-02-29
浏览1434
kingsword123kingsword123数据库管理员CMBC
:lol 最佳答案能给自己不?嘿嘿显示全部
:lol 最佳答案能给自己不?嘿嘿收起
政府机关 · 2012-02-29
浏览1408
kingsword123kingsword123数据库管理员CMBC
已经搞定了,是loadrec文件设置的问题多个分区每个load copy yes文件之前都应该写一个 ENTRY.多谢各位了。哈哈,问题搞定。:lol显示全部
已经搞定了,是loadrec文件设置的问题
多个分区每个load copy yes文件之前都应该写一个 ENTRY.
多谢各位了。哈哈,问题搞定。:lol收起
政府机关 · 2012-02-29
浏览1446
tongjixianingtongjixianing软件开发工程师IBM
把其中一个node的daig.log贴出来。要是着急的话,就在当前做个offline backup,再restore.另外,之前有做过类似的操作成功了吗?显示全部
把其中一个node的daig.log贴出来。要是着急的话,就在当前做个offline backup,再restore.

另外,之前有做过类似的操作成功了吗?收起
互联网服务 · 2012-02-29
浏览1391
kingsword123kingsword123数据库管理员CMBC
一个德性....没啥改变CASHMAPP2:/home/db2mds$db2_all "显示全部
一个德性....没啥改变
CASHMAPP2:/home/db2mds$db2_all "<<+0< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING"

DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok
CASHMAPP2:/home/db2mds$db2_all "<<-0< db2 RESTORE DATABASE MDS FROM /db2/db2mds/backup INTO MDS REPLACE EXISTING"
rah: omitting logical node 0

SQL2523W  Warning!  Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version.  The Roll-forward recovery logs
associated with the target database will be deleted.
DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok

SQL2523W  Warning!  Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version.  The Roll-forward recovery logs
associated with the target database will be deleted.
DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok

SQL2523W  Warning!  Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version.  The Roll-forward recovery logs
associated with the target database will be deleted.
DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok

SQL2523W  Warning!  Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version.  The Roll-forward recovery logs
associated with the target database will be deleted.
DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok

SQL2523W  Warning!  Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version.  The Roll-forward recovery logs
associated with the target database will be deleted.
DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok

SQL2523W  Warning!  Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version.  The Roll-forward recovery logs
associated with the target database will be deleted.
DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok

SQL2523W  Warning!  Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version.  The Roll-forward recovery logs
associated with the target database will be deleted.
DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok

SQL2523W  Warning!  Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version.  The Roll-forward recovery logs
associated with the target database will be deleted.
DB20000I  The RESTORE DATABASE command completed successfully.
CASHMAPP2: db2 RESTORE DATABASE ... completed ok
CASHMAPP2:/home/db2mds$
CASHMAPP2:/home/db2mds$db2 "rollforward db mds to end of logs  on dbpartitionnums (0,1,2,3,4,5,6,7,8) and complete "
SQL3799W  Load recovery for table "DB2MDS  .TEMP1" at time "20120227141358" on
node "4" is pending due to warning "-3784" with additional information "2".
Do you want to continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t) c
SQL3799W  Load recovery for table "DB2MDS  .TEMP1" at time "20120227141358" on
node "6" is pending due to warning "-3784" with additional information "2".
Do you want to continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t) c
SQL3799W  Load recovery for table "DB2MDS  .TEMP1" at time "20120227141358" on
node "1" is pending due to warning "-3784" with additional information "2".
Do you want to continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t) c
SQL3799W  Load recovery for table "DB2MDS  .TEMP1" at time "20120227141358" on收起
政府机关 · 2012-02-29
浏览1491
kingsword123kingsword123数据库管理员CMBC
回复 4# weiruan85 IBM PMR已经开了,但是还没有结果,IBM现在招聘了一堆小孩,处理问题很慢啊。我在试一试不用nohup恢复数据库试一试。显示全部
回复 4# weiruan85
IBM PMR已经开了,但是还没有结果,IBM现在招聘了一堆小孩,处理问题很慢啊。
我在试一试不用nohup恢复数据库试一试。收起
政府机关 · 2012-02-29
浏览1398
weiruan85weiruan85数据库管理员ibm
回复 3# tongjixianing     他先前滚的0节点,其余节点用nohup 应该没影响。  不过兄说的很对,现在只能看看db2diag.log 里边有啥信息。       如果不行,只能开pmr 做db2trc 了。...显示全部
回复 3# tongjixianing


    他先前滚的0节点,其余节点用nohup 应该没影响。  不过兄说的很对,现在只能看看db2diag.log 里边有啥信息。
  
    如果不行,只能开pmr 做db2trc 了。收起
政府机关 · 2012-02-28
浏览1416
tongjixianingtongjixianing软件开发工程师IBM
把node5的db2diag.log贴出来。 还有你restore的时候用 db2_all "显示全部
把node5的db2diag.log贴出来。 还有你restore的时候用 db2_all "<<-0< “ for non-catalog node. 不要用nohup那种形式收起
互联网服务 · 2012-02-27
浏览1421
kingsword123kingsword123数据库管理员CMBC
:funk:  没人回答啊?显示全部
:funk:  没人回答啊?收起
政府机关 · 2012-02-27
浏览1349

提问者

kingsword123
数据库管理员CMBC

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2012-02-27
  • 关注会员:1 人
  • 问题浏览:7920
  • 最近回答:2012-02-29
  • X社区推广