环境: rhel4.7,ids11.50uc5
步骤:
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
|
以下是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.检查表恢复..
表级恢复的表模式文件,可以定义多种恢复,具体参考
参考文献: