查看: 7265|回复: 5

[精华] 今天做的db2 2 partition的redirect异机恢复全步骤

[复制链接]
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
跳转到指定楼层
1#
发表于 2006-3-16 22:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
今天需要对2 node的投运db2数据库做一个恢复到开发机的恢复测试,也就是异机恢复啦。呵呵。由于投运机使用了raw device,在开发机上准备使用file system,所以是redirect restore

由于开发机只有1台,所以在同一机器,同一用户下建立2个node来恢复

以下是步骤:

1)        创建EEE mode instance db2test,用户db2test
2)        配置
为db2test分配端口
修改/etc/services,增加service PORT口,以及node间通讯port
Db2set设置参数如下
DB2_FORCE_FCM_BP=YES
DB2COMM=TCPIP
DB2CODEPAGE=1383
3)        修改Db2nodes.cfg设置2 node
0 dvlp_host 0
1 dvlp_host1
修改db2test下 .rhosts文件,权限设置为(rw-r-r),内容如下
+               db2test
4) 在node0上创建DB
create database TEST on /db2restore/db2data using codeset gb2312 territory CN
5) 在node0上restore
DB2NODE=0
export DB2NODE
db2 terminate
以下命令在DB2 CLP环境中运行
restore database PROD from /db2restore to /db2restore/db2data into TEST redirect
set tablespace containers for 0 using ( path '/db2restore/db2data/TEST/db2test/NODE0000/SQL00001/SQLT0000.0' )
set tablespace containers for 1 using (path '/db2restore/db2data/TEST/db2test/NODE0000/SQL00001/SQLT0001.0')
set tablespace containers for 2 using (path '/db2restore/db2data/TEST/db2test/NODE0000/SQL00001/SQLT0002.0')
set tablespace containers for 3 using ( file '/db2restore/db2data/TEST/data3.dbf' 256000 )
set tablespace containers for 4 using ( file '/db2restore/db2data/TEST/data4.dbf' 256000 )
....
按照投运环境的设置给每个node 0上的tablespace设置redirect container
注意设置必须和原来得tablespace type一致,如原来是SMS,则使用PATH container,原来是DMS,则使用FILE/DEVICE container
restore db PROD continue
6) 在node1上restore
DB2NODE=1
export DB2NODE
db2 terminate
以下命令在DB2 CLP环境中运行
restore database PROD from /db2restore taken at 20060315141040 to /db2restore/db2data into TEST redirect
set tablespace containers for 2 using (path '/db2restore/db2data/TEST/db2test/NODE0001/SQL00001/SQLT0002.0')
set tablespace containers for 5 using ( file '/db2restore/db2data/TEST/data51.dbf' 256000 )
set tablespace containers for 6 using ( file '/db2restore/db2data/TEST/data61.dbf' 256000 )
...
按照投运环境的设置给每个node 1上的tablespace设置redirect
注意不能和前面设值得node0的container重复
restore db PROD continue
7) 在node0上rollforward
Copy log到
/db2restore/db2data/db2test/NODE0000/SQL00000/SQLOGDIR/放置node0的LOG
/db2restore/db2data/db2test/NODE0001/SQL00001/SQLOGDIR/放置node1的LOG
DB2NODE=0
export DB2NODE
db2 terminate
db2 Rollforward db TEST to 2006-03-15-14.13.00 and stop

至此,异机恢复成功完成~

测试平台: aix433



在db2板块第一次发原创贴,大家支持一下
招聘 : c/c++研发
论坛徽章:
45
技术图书徽章
日期:2014-03-10 14:09:192012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-01-04 11:51:22ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15现任管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:332011新春纪念徽章
日期:2011-01-25 15:42:152011新春纪念徽章
日期:2011-01-25 15:41:50
2#
发表于 2006-3-16 23:07 | 只看该作者
不错:)

使用道具 举报

回复
论坛徽章:
71
马上加薪
日期:2014-02-19 11:55:14ITPUB十周年纪念徽章
日期:2011-11-01 16:19:412010广州亚运会纪念徽章:橄榄球
日期:2011-05-22 10:54:33管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:332011新春纪念徽章
日期:2011-01-25 15:42:152011新春纪念徽章
日期:2011-01-25 15:41:502011新春纪念徽章
日期:2011-01-25 15:41:012010年世界杯参赛球队:丹麦
日期:2010-04-06 10:23:36
3#
发表于 2006-3-17 07:24 | 只看该作者
很好,设为精华

使用道具 举报

回复
招聘 : c/c++研发
论坛徽章:
45
技术图书徽章
日期:2014-03-10 14:09:192012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-01-04 11:51:22ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15现任管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:332011新春纪念徽章
日期:2011-01-25 15:42:152011新春纪念徽章
日期:2011-01-25 15:41:50
4#
发表于 2006-3-18 04:34 | 只看该作者
我这里正好也有一个restore on EEE的问题百思不得其解,既然有人抛砖了我也就顺便问一下:
script:
#! /bin/ksh                                                              
#  db restore script                                                     
db2_all '<<+000< db2 restore db edmu01 use tsm OPEN 2 SESSIONS taken at 20060228090413 with 4 buffers buffer 4096 parallelism 4'                        
db2_all '<<-000< db2 restore db edmu01 Use tsm taken at 20060228090916 with 4 buffers buffer 4096 parallelism 4'                                         
echo Wait for all background processes to complete                       
wait         

可是不知道为什么第一步可以执行成功(restore node 0),第二步的时候就hang了。(确认TSM中有backup image)
db2diag.log没有任何错误信息,tsm log里没有错误信息,使用list utilites察看进度发现一直停留在completed work=4096(也就是buffer大小),本身数据库不大,等了好几个小时也没有动静。
有没有人见过类似的情况。

===================
已经做过的测试:recycle instance, ipclean+kill -9 on all db2 processes
===================
DB2 Release Info

Server is running MPP/EEE.
DB21085I  Instance "dminstu1" uses "32" bits and DB2 code release "SQL08023"
with level identifier "03040106".
Informational tokens are "DB2 v8.1.1.96", "s050811", "U803920", and FixPak
"10".
Product is installed at "/usr/opt/db2_08_01".
--------------
Operating system and level
Operating system is: AIX 5.3.0.0

OSS reports operating system level as: 5.3.
--------------------
EEE node configuration

      Number of nodes in db2nodes.cfg is: 5
      Current node number is: 0

      Node information from the db2nodes.cfg file:

      0 rsuedw03 0
      1 rsuedw03 1
      2 rsuedw03 2
      3 rsuedw03 3
      4 rsuedw03 4

--------------------
List database directory
LIST DB DIRECTORY

System Database Directory

Number of entries in the directory = 1

Database 1 entry:

Database alias                       = EDMU01
Database name                        = EDMU01
Local database directory             = /dminstu1/edmu01/dbmgmt
Database release level               = a.00
Comment                              =
Directory entry type                 = Indirect
Catalog database partition number    = 0
Alternate server hostname            =
Alternate server port number         =


SQLCA Information

sqlcaid : SQLCA     sqlcabc: 136   sqlcode: 0   sqlerrml: 0
sqlerrmc:
sqlerrp : SQL08023
sqlerrd : (1) 0                (2) 0                (3) 0
           (4) 0                (5) 0                (6) 0
sqlwarn : (1)      (2)      (3)      (4)        (5)       (6)
           (7)      (8)      (9)      (10)       (11)
sqlstate: 00000

----------------------
2006-03-02-12.49.21.809137-300 I1C1186            LEVEL: Event
PID     : 233620               TID  : 1           PROC : db2agent (EDMU01) 0
INSTANCE: dminstu1             NODE : 000         DB   : EDMU01
APPHDL  : 0-54                 APPID: *N0.dminstu1.060302174745
FUNCTION: DB2 UDB, RAS/PD component, _pdlogInt, probe:120
START   : New db2diag.log file
DATA #1 : Build Level, 124 bytes
Instance "dminstu1" uses "32" bits and DB2 code release "SQL08023"
with level identifier "03040106".
Informational tokens are "DB2 v8.1.1.96", "s050811", "U803920", FixPak "10".
DATA #2 : System Info, 220 bytes
System: AIX rsuedw03 3 5 00CA86BE4C00
CPU: total:24 online:6 Threading degree per core:2
Physical Memory(MB): total:11264 free:3919
Virtual  Memory(MB): total:17920 free:10565
Swap     Memory(MB): total:6656 free:6646
Kernel   Params: msgMaxMessageSize:4194304 msgMaxQueueSize:4194304
                 shmMax:2147483648 shmMin:1 shmIDs:131072 shmSegments:16
                 semIDs:131072 semNumPerID:65535 semOps:1024 semMaxVal:32767
                 semAdjustOnExit:16384
Information in this record is only valid at the time when this file was
created (see this record's time stamp)

2006-03-02-12.49.21.806879-300 I1188C419          LEVEL: Warning
PID     : 233620               TID  : 1           PROC : db2agent (EDMU01) 0
INSTANCE: dminstu1             NODE : 000         DB   : EDMU01
APPHDL  : 0-54                 APPID: *N0.dminstu1.060302174745
FUNCTION: DB2 UDB, database utilities, sqludPrintStartingMsg, probe:1
DATA #1 : String, 52 bytes
Starting a full database restore.
Agent PID: 233620

2006-03-02-12.49.21.822294-300 I1608C439          LEVEL: Severe
PID     : 233620               TID  : 1           PROC : db2agent (EDMU01) 0
INSTANCE: dminstu1             NODE : 000         DB   : EDMU01
APPHDL  : 0-54                 APPID: *N0.dminstu1.060302174745
FUNCTION: DB2 UDB, database utilities, sqluCompareDB, probe:45
MESSAGE : DiagData
DATA #1 : Hexdump, 4 bytes
0x405D0CB8 : 0000 09EB                                  ....

2006-03-02-12.53.53.916457-300 I2048C377          LEVEL: Severe
PID     : 647428               TID  : 1           PROC : db2agent (instance) 0
INSTANCE: dminstu1             NODE : 000         DB   : EDMU01
APPHDL  : 0-63                 APPID: *N0.dminstu1.060302175353
FUNCTION: DB2 UDB, buffer pool services, sqlb_counts, probe:90
MESSAGE : max pool id is less than 0 at -1

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

相信不是问题,因为cust已经在restore出现覆盖提示的时候选择了yes

使用道具 举报

回复
论坛徽章:
1
2010新春纪念徽章
日期:2010-01-04 08:33:08
5#
发表于 2006-3-25 09:40 | 只看该作者
to Tao Wang, any further db2diag.log info? you can email to me on wyhang@gmail.com. 3q.

使用道具 举报

回复
招聘 : c/c++研发
论坛徽章:
45
技术图书徽章
日期:2014-03-10 14:09:192012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-01-04 11:51:22ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15现任管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:332011新春纪念徽章
日期:2011-01-25 15:42:152011新春纪念徽章
日期:2011-01-25 15:41:50
6#
发表于 2006-3-26 03:17 | 只看该作者
db2diag.log里除了上面的信息和restore有联系外就没有其他有用的东西了。
PID 233620在后面压根就没有出现过。。。。

最后,发现客户曾经对instance做过OS level的restore,让客户重新建立instance创建分区然后就可以了……

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表