时间点恢复

什么是冷恢复?

如果关键数据库空间由于磁盘故障或损坏的数据而受损,则数据库服务器将自动脱机。如果关键数据库空间停止运行,您必须对所有关键数据库空间执行冷恢复

要进行冷恢复,数据库服务器在 Dynamic Server 上必须处于脱机方式或在 Extended Parallel Server 上处于微内核方式。如果数据库服务器已停止运行,您可以对所有存储空间执行冷恢复,而不管它们是处于联机还是脱机状态。

当数据库服务器发生故障时请执行冷恢复,或者需要执行以下任务之一:

  • 时间点恢复
  • 日志点恢复
  • 整个系统恢复(仅 IDS)
  • 导入恢复
  • 重命名块(仅 IDS)

冷恢复首先对所有关键存储空间进行物理恢复,接着恢复非关键存储空间,最后恢复逻辑日志。根数据库空间的保留页恢复后,数据库服务器进入恢复方式。当逻辑恢复完成后,数据库服务器进入静默方式。使用 onmode 命令使数据库服务器变成联机状态。关于更多信息,请参阅执行冷恢复

技巧:
如果镜像关键数据库空间,则您不太可能在磁盘故障后执行冷恢复,因为数据库服务器可以使用镜像的存储空间。如果镜像逻辑日志空间,当一个或多个磁盘出现故障时更可能抢救逻辑日志数据。

可在数据库空间已重命名并且对 rootdbs 和重命名的数据库空间执行了 0 级备份之后执行冷恢复。

实例:

环境:AS4U7 + Informix Dynamic Server 2000 Version 9.21.UC2 (虚拟机)
模拟一个场景:在一次onbar 0级备份之后,操作了数据库,现在想恢复到0级备份之前的一个时间点时的数据,或者是在误操作之后,想恢复到之前的状态

[root@informix etc]# cat ixbar.0
online_db         rootdbs            R  0 1     0 1911863244 0          2010-07-21 16:36:09 1     0     0           1     0     – –
online_db         logdbs             CD 0 2     0 1911863245 0          2010-07-21 16:36:12 1     0     0           2     0     – –
online_db         phydbs             CD 0 3     0 1911863247 0          2010-07-21 16:36:13 1     0     0           3     0     – –
online_db         datadbs            ND 0 4     0 1911863246 0          2010-07-21 16:36:13 1     0     0           4     0     – –
online_db         idxdbs             ND 0 5     0 1911863248 0          2010-07-21 16:36:13 1     0     0           5     0     – –
online_db         13                 L  0 6     0 1911863249 0          2010-07-21 16:37:04 1     0     0           6     0     – –
online_db         rootdbs            R  0 7     0 1911863250 0          2010-07-21 17:01:49 1     0     0           7     0     – –
online_db         logdbs             CD 0 8     0 1911863251 0          2010-07-21 17:01:51 1     0     0           8     0     – –
online_db         phydbs             CD 0 9     0 1911863252 0          2010-07-21 17:01:52 1     0     0           9     0     – –
online_db         idxdbs             ND 0 10    0 1911863253 0          2010-07-21 17:01:52 1     0     0           10    0     – –
online_db         datadbs            ND 0 11    0 1911863254 0          2010-07-21 17:01:52 1     0     0           11    0     – –
online_db         14                 L  0 12    0 1911863255 0          2010-07-21 17:02:44 1     0     0           12    0     – –

bar_act.log日志如下:
2010-07-21 17:09:16 4990  4988 /home/informix/bin/onbar_d -r -t 2010-07-21 16:37:04
2010-07-21 17:09:16 4990  4988 Storage space datadbs is not down so it will not be restored.
2010-07-21 17:09:16 4990  4988 Storage space idxdbs is not down so it will not be restored.
2010-07-21 17:09:16 4990  4988 Storage space logdbs is not down so it will not be restored.
2010-07-21 17:09:16 4990  4988 Storage space phydbs is not down so it will not be restored.
2010-07-21 17:09:16 4990  4988 Storage space rootdbs is not down so it will not be restored.
2010-07-21 17:09:16 4990  4988 There are no storage spaces/logical logs to backup/restore.
2010-07-21 17:09:16 4990  4988 /home/informix/bin/onbar_d complete, returning 147 (0x93)

正确操作:

停数据库服务,然后执行基于物理备份的时间点恢复,然后执行基于逻辑日志的时间点恢复2010-07-22 08:34:47 9477  9475 /home/informix/bin/onbar_d -r -p -t 2010-07-21 16:37:04
2010-07-22 08:37:27 9477  9475 Successfully connected to Storage Manager.
2010-07-22 08:37:27 9477  9475 Begin cold level 0 restore rootdbs (Storage Manager copy ID: 1911863244 0).
2010-07-22 08:37:39 9477  9475 Completed cold level 0 restore rootdbs.
2010-07-22 08:37:39 9502  9477 Process 9502  9477 successfully forked.
2010-07-22 08:37:39 9502  9477 Successfully connected to Storage Manager.
2010-07-22 08:37:39 9503  9477 Process 9503  9477 successfully forked.
2010-07-22 08:37:39 9503  9477 Successfully connected to Storage Manager.
2010-07-22 08:37:39 9504  9477 Process 9504  9477 successfully forked.
2010-07-22 08:37:39 9504  9477 Successfully connected to Storage Manager.
2010-07-22 08:37:39 9505  9477 Process 9505  9477 successfully forked.
2010-07-22 08:37:39 9505  9477 Successfully connected to Storage Manager.
2010-07-22 08:37:40 9502  9477 Begin cold level 0 restore logdbs (Storage Manager copy ID: 1911863245 0).
2010-07-22 08:37:41 9505  9477 Begin cold level 0 restore idxdbs (Storage Manager copy ID: 1911863248 0).
2010-07-22 08:37:42 9502  9477 Completed cold level 0 restore logdbs.
2010-07-22 08:37:42 9502  9477 Process 9502  9477 completed.
2010-07-22 08:37:44 9505  9477 Completed cold level 0 restore idxdbs.
2010-07-22 08:37:44 9505  9477 Process 9505  9477 completed.
2010-07-22 08:37:50 9504  9477 Begin cold level 0 restore datadbs (Storage Manager copy ID: 1911863246 0).
2010-07-22 08:37:51 9503  9477 Begin cold level 0 restore phydbs (Storage Manager copy ID: 1911863247 0).
2010-07-22 08:37:53 9504  9477 Completed cold level 0 restore datadbs.
2010-07-22 08:37:54 9504  9477 Process 9504  9477 completed.
2010-07-22 08:37:54 9503  9477 Completed cold level 0 restore phydbs.
2010-07-22 08:37:54 9503  9477 Process 9503  9477 completed.
2010-07-22 08:37:54 9477  9475 Physical restore complete. Logical restore required before work can
continue.
2010-07-22 08:37:54 9477  9475 /home/informix/bin/onbar_d complete, returning 0 (0x00)
2010-07-22 08:55:34 9528  9526 /home/informix/bin/onbar_d -r -l -t 2010-07-21 16:37:04
2010-07-22 08:55:35 9528  9526 Successfully connected to Storage Manager.
2010-07-22 08:55:35 9528  9526 Begin restore logical log 13 (Storage Manager copy ID: 1911863249 0).
2010-07-22 08:55:53 9528  9526 Completed restore logical log 13.
2010-07-22 08:55:53 9528  9526 Begin restore logical log 14 (Storage Manager copy ID: 1911863256 0).
2010-07-22 08:55:54 9528  9526 Completed restore logical log 14.
2010-07-22 08:55:55 9528  9526 Begin restore logical log 15 (Storage Manager copy ID: 1911863258 0).
2010-07-22 08:55:56 9528  9526 Completed restore logical log 15.
2010-07-22 08:56:02 9528  9526 Completed logical restore.
2010-07-22 08:56:03 9543  9541 /home/informix/bin/onbar_d -b -l
2010-07-22 08:56:04 9543  9541 /home/informix/bin/onbar_d complete, returning 0 (0x00)
2010-07-22 08:56:07 9528  9526 /home/informix/bin/onbar_d complete, returning 0 (0x00)

发表评论