使用NBU恢复informix数据库

在对数据库恢复之前,需要保证数据库的安装程序、环境变量,原数据库的所有数据文件以及日志空间的名字、容量、权限与恢复之前相同。

onbar -r -p dbspace_name
恢复全部数据文件,但不做逻辑日志的恢复和应用,也可以只恢复某表空间

onbar -r –l
在前一个命令的基础上,做逻辑日志恢复

onbar -r [dbspace_name]
恢复全部数据文件,包括逻辑日志的恢复和应用,也可以只恢复某表空间

onbar -r -t time -w –p
整体数据库的时间点的恢复。

如果数据库全部损坏,则需要恢复如下文件:
根据您的备份规划,您可以执行如下通过管理页面执行:
进入恢复页面:/usr/openv/netbackup/bin/jbpSA &
选择你要恢复的数据库备份文件 $INFORMIXDIR/etc/ 等
如果恢复时有未曾备份的逻辑日志,则需要拯救当前的日志文件:
onbar -l -s
然后执行:
onbar -r
恢复过程中,都可以查看恢复日志 bar_act.log

如主机宕机,在环境一样的备机上进行全库的实例恢复:
确认informix处于关闭状态
$ onstat -
shared memory not initialized for INFORMIXSERVER 'xxx_tcp'
设置请求恢复的数据源为xxx主机的备份集
$ export INFXBSA_CLIENT=xxx
进行onbar恢复,根据需要使用onbar参数
$ onbar -r -w -p

开始恢复后在NBU Admin Console(jnbSA&)可以看到恢复任务
同时查看日志

cd db/informix/tmp

tail -f bar_act.log

-c  Use compression dictionary to expand compressed data
-q  Do not display program header
-b  Display information about logged BLOB pages
-u  Display the specified user(s)
-t  Display the specified TBLspace(s)
-x  Display the specified transaction(s)

2015-01-31 01:16:30 23285 23283 /home/db/informix/bin/onbar_d complete, returning 149
(0x95)
2015-01-31 01:32:40 6762 6760 /home/db/informix/bin/onbar_d -r -w -p
2015-01-31 01:32:40 6762 6760 Working with veritas-netbackup as generic storage
manager.
2015-01-31 01:32:41 6762 6760 Successfully connected to Storage Manager.
2015-01-31 01:36:28 6762 6760 Begin reserved pages restore (level 0 of rootdbs, Storage
Manager copy ID: 1 1422538816).
2015-01-31 01:36:38 6762 6760 Completed reserved pages restore (level 0 of rootdbs).
2015-01-31 01:36:40 6762 6760 (-43341) Logical log 28621 is needed by this restore but
cannot be found in OnBar ixbar file.
2015-01-31 01:36:40 6762 6760 Successfully connected to Storage Manager.
2015-01-31 01:40:50 6762 6760 Begin cold level 0 restore rootdbs (Storage Manager copy
ID: 1 1422538816).
2015-01-31 01:41:11 6762 6760 Completed cold level 0 restore rootdbs.
2015-01-31 01:43:42 6762 6760 Begin cold level 0 restore blobdbs (Storage Manager copy
ID: 1 1422539009).
2015-01-31 01:43:52 6762 6760 Completed cold level 0 restore blobdbs.
2015-01-31 01:46:37 6762 6760 Begin cold level 0 restore ywdattbs02 (Storage Manager
copy ID: 1 1422539175).
2015-01-31 01:49:07 6762 6760 Completed cold level 0 restore ywdattbs02.
2015-01-31 01:51:33 6762 6760 Begin cold level 0 restore ywdattbs08 (Storage Manager
copy ID: 1 1422540977).
2015-01-31 01:53:51 6762 6760 Completed cold level 0 restore ywdattbs08.
2015-01-31 01:56:27 6762 6760 Begin cold level 0 restore ywdattbs04 (Storage Manager
copy ID: 1 1422542465).
2015-01-31 01:58:44 6762 6760 Completed cold level 0 restore ywdattbs04.
2015-01-31 02:01:25 6762 6760 Begin cold level 0 restore ywdattbs07 (Storage Manager
copy ID: 1 1422543766).
2015-01-31 02:03:31 6762 6760 Completed cold level 0 restore ywdattbs07.
2015-01-31 02:05:56 6762 6760 Begin cold level 0 restore ywdattbs01 (Storage Manager
copy ID: 1 1422545053).
2015-01-31 02:08:01 6762 6760 Completed cold level 0 restore ywdattbs01.
2015-01-31 02:10:27 6762 6760 Begin cold level 0 restore ywdattbs03 (Storage Manager
copy ID: 1 1422546320).
2015-01-31 02:12:31 6762 6760 Completed cold level 0 restore ywdattbs03.
2015-01-31 02:14:41 6762 6760 Begin cold level 0 restore data0tbs01 (Storage Manager
copy ID: 1 1422547639).
2015-01-31 02:16:45 6762 6760 Completed cold level 0 restore data0tbs01.
2015-01-31 02:19:16 6762 6760 Begin cold level 0 restore ywdattbs05 (Storage Manager
copy ID: 1 1422548920).
2015-01-31 02:21:14 6762 6760 Completed cold level 0 restore ywdattbs05.
2015-01-31 02:23:05 6762 6760 Begin cold level 0 restore ywdattbs06 (Storage Manager
copy ID: 1 1422550196).
2015-01-31 02:25:06 6762 6760 Completed cold level 0 restore ywdattbs06.
2015-01-31 02:27:32 6762 6760 Begin cold level 0 restore indextbs01 (Storage Manager
copy ID: 1 1422551385).
2015-01-31 02:29:12 6762 6760 Completed cold level 0 restore indextbs01.
2015-01-31 02:30:57 6762 6760 Begin cold level 0 restore logdbs (Storage Manager copy
ID: 1 1422552529).
2015-01-31 02:31:07 6762 6760 Completed cold level 0 restore logdbs.
2015-01-31 02:32:58 6762 6760 Begin cold level 0 restore phydbs (Storage Manager copy
ID: 1 1422552657).
2015-01-31 02:33:08 6762 6760 Completed cold level 0 restore phydbs.
2015-01-31 02:33:10 6762 6760 Completed whole system restore.
2015-01-31 02:33:10 6762 6760 /home/db/informix/bin/onbar_d complete, returning 0
(0x00)

恢复完成后
$ onstat -
Informix Dynamic Server Version -- Fast Recovery -- Up 01:26:21 -- 1816960 Kbytes
执行onmode -m或者进行必要的log回滚,例如onbar -r -l -t
$ onmode -m
$ onstat -
Informix Dynamic Server Version -- Fast Recovery (CKPT REQ) -- Up 01:27:27 -- 1816960 Kbytes
Blocked:CKPT
$ onstat -
Informix Dynamic Server Version -- On-Line -- Up 01:28:49 -- 1816960 Kbytes

你可能感兴趣的:(使用NBU恢复informix数据库)