Chinaunix首页 | 论坛 | 博客
  • 博客访问: 352389
  • 博文数量: 38
  • 博客积分: 2432
  • 博客等级: 少校
  • 技术积分: 504
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-20 09:49
个人简介

GBase 8t/Informix数据库技术支持。

文章分类

全部博文(38)

文章存档

2011年(2)

2010年(14)

2009年(11)

2008年(11)

分类: DB2/Informix

2009-11-26 15:26:40

目的: 使用archecker从备机中进行表级恢复.
环境: rhel4.7,ids11.50uc5
注:archecker只恢复已经备份的0级备份及逻辑日志备份中的日志。

步骤:
1.建立测试表t1(id char(10),name char(10),info(10)),并insert一些记录.
2.对数据库进行0级备份(可使用ontape或者onbar,这两种备份在进行archecker表级恢复时有所区别,需注意).
3.检查备份
    onbar备份:onbar -v 或者 archecker -bvs
    ontape备份:archecker -tvs
      (注:在使用ontape备份时发现ac_msg.log中,dbspace/table检查都通过,最后出现"STATUS: archecker completed Validation pid = 24032 exit code: 3",但不影响表恢复.why?)
    确认备份是正常的..
4.删除测试表t1
5.创建表恢复模式文件t1.cmd
   database dbmon;             --对应库名.
   create table t1
   (  id   char(10),
      name char(10),
      info char(10)
   ) in rootdbs;               --源表(即存在于备份中的表,及所在的dbspace.)
   create table t1
   (  id   char(10),
      name char(10),
      info char(10)
   );                          --目标表结构,表明恢复后的表.
   insert into t1 select * from t1; --insert到目标表,从源表读取数据.
   restore to current;              --可选,恢复到的时间点,在使用时间点恢复的时候需要设置GL_DATETIME环境变量,如GL_DATETIME="%Y-%m-%d %H:%M:%S", 例:restore to "2010-09-09 15:52:00";

6.执用恢复
   onbar备份:  archecker -bvs -f t1.cmd
   ontape备份: archecker -tvs -f t1.cmd

以下是一个ontape备份的表恢复ac_msg.log

IBM Informix Dynamic Server Version 11.50.UC5
Program Name: archecker
Version: 8.0
Released: 2009-07-14 19:19:21
CSDK: IBM Informix CSDK Version 3.50
ESQL: IBM Informix-ESQL Version 3.50.UC4
Compiled: 07/14/09 19:19 on Linux 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:54:53 EST 2006

AC_STORAGE /tmp
AC_MSGPATH /tmp/ac_msg.log
AC_VERBOSE on
AC_TAPEDEV /opt/informix/backup/fullbak/
AC_TAPEBLOCK 1024 KB
AC_LTAPEDEV /opt/informix/lp
AC_LTAPEBLOCK 32 KB
Dropping old log control tables
Extracting table dbmon:t1 into dbmon:t1
Archive file /opt/informix/backup/fullbak/suse10_0_L0
Tape type: Archive Backup Tape
OnLine version: IBM Informix Dynamic Server Version 11.50.UC5
Archive date: Thu Nov 26 15:12:29 2009
Archive level: 0
Tape blocksize: 1048576
Tape size: 2147483647
Tape number in series: 1

Scan PASSED
Control page checks PASSED
Table checks PASSED
Table extraction commands 1
Tables found on archive 1
LOADED: dbmon:t1 produced 2 rows.
Creating log control tables

Please put in log tape with log id 8.
Type <return> or 0 to end:

Read/Write End Of Medium enabled: blocks = 0

Logically recovered dbmon:t1 Inserted 0 Deleted 0 Updated 0


以下是onbar备份的表恢复ac_msg.log

2010-09-09 15:54:10

-----------------------------------------

STATUS: IBM Informix Dynamic Server Version 11.50.UC6

Program Name:   archecker

Version:        8.0

Released:       2009-12-15 21:59:36

CSDK:           IBM Informix CSDK Version 3.50

ESQL:           IBM Informix-ESQL Version 3.50.UC4

Compiled:       12/15/09 21:59  on Linux 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:54:53 EST 2006


STATUS: Arguments [-bvs -f t1.cmd]

STATUS: AC_STORAGE               /tmp

STATUS: AC_MSGPATH               /tmp/ac_msg.log

STATUS: AC_VERBOSE               on

STATUS: AC_TAPEBLOCK             62 KB

STATUS: AC_IXBAR                 /opt/informix/etc/ixbar.0

STATUS: AC_SCHEMA                t1.cmd

TIME: [2010-09-09 15:54:10] All old validation files removed.

STATUS: Dropping old log control tables

STATUS: SQL [SET  INDEXES, TRIGGERS,  CONSTRAINTS FOR t1 DISABLED]

STATUS: Extracting table tt:t1 into tt:t1

STATUS: Determined Storage Manager to be ism.

STATUS: starting to scan dbspace 4 created on 2010-09-09 15:50:11.

STATUS: Archive timestamp 0X001213EA.

TIME: [2010-09-09 15:54:11] Found Partition t1 in space workdbs (0x00400041).

STATUS: Scan PASSED

STATUS: Control page checks PASSED

STATUS: Table checks PASSED

STATUS: Table extraction commands 1

STATUS: Tables found on archive 1

STATUS: LOADED: tt:t1 produced 1000 rows.

TIME: [2010-09-09 15:54:12] Physical Extraction Completed

STATUS: Creating log control tables

TIME: [2010-09-09 15:54:12] Log Stager started (pid = 19106)

TIME: [2010-09-09 15:54:12] Log Applier started (pid = 19100)

STATUS: Setting up log stream 1

STATUS: Determined Storage Manager to be ism.

STATUS: Starting recovery at log 43.

STATUS: Common rollforward point 0043:0x00043:0x0018.

STATUS: Staging Log 43

STATUS: Determined Storage Manager to be ism.

STATUS: Staging Log 44

TIME: [2010-09-09 15:54:14] Switching to log 44

STATUS: Determined Storage Manager to be ism.

STATUS: All logstreams have been staged by stager 19106

TIME: [2010-09-09 15:54:15] Scanner (19106) is done scanning logs

STATUS: Log stager elapsed processing time 00 H 00 M 02.855 S

TIME: [2010-09-09 15:54:15] Unload Completed




STATUS: archecker completed staging pid = 19106 exit code: 0

STATUS: SQL [SET INDEXES, TRIGGERS, CONSTRAINTS FOR t1 ENABLED]

STATUS: Logically recovered tt:t1 Inserted 1 Deleted 0 Updated 0

STATUS: Log applier processing time 00 H 00 M 03.018 S

TIME: [2010-09-09 15:54:15] Unload Completed




STATUS: archecker completed applying pid = 19100 exit code: 0


7.检查表恢复..

表级恢复的表模式文件,可以定义多种恢复,具体参考

参考文献:
阅读(1873) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~