我在使用 Onbar 工具(依赖于使用云设备(AWS s3)的 Informix db(服务器 12.1)的 Onpsm 主存储管理器)时遇到了困难。
https://www.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/com.ibm.bar.doc/ids_bar_526.htm
- 在备份服务器上,我使用类似以下命令创建了 DBSPOOL 和 LOGPOOL 设备
onpsm -D add AMAZON1 \ -g DBSPOOL \ -p HIGHEST \ -t CLOUD \ --url https://ifmx-s3-dev.s3.amazonaws.com \ --provider S3 \ --user AKIAIT1111155555X4PA \ --password A2nB21111155555nvTI0X9ZxGzUJNJivoBQY9MrD \ --container ifmx-s3-dev \ --max_part_size 25600
- 然后,我设置了一个 cron 作业来对所有在线存储空间和使用的逻辑日志执行标准的 0 级备份。
onbar-b-L 0
上栏-b-l
- 阅读以下 IBM 出版物,其中建议备份存储目录表,因为未与数据库实例一起备份,我设置了一个 cron 作业来备份应该包含存储目录表的 $INFORMIXDIR/etc/psm
https://www.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/com.ibm.bar.doc/ids_bar_526.htm
将 $INFORMIXDIR/etc/psm 目录和 $INFORMIXDIR/etc/ixbar.? 从源服务器复制到目标服务器,然后重命名 ixbar.? 文件,将源计算机上使用的 IBM Informix 服务器名称替换为目标计算机的 IBM Informix 服务器名称。
3- 将复制的 /psm 目录和 ixbar 文件的所有权更改为用户 informix
4-关闭数据库以执行冷恢复
onmode -yuk
5-检查备份对象是否存在
onpsm -O list
6- 尝试在冷恢复期间恢复数据和关键文件
onbar -r -cf yes
收到这个奇怪的错误:
必须设置环境变量 BAR_BSALIB_PATH 才能使用 -cf 选项!
我检查了 ONCONFIG 文件中的 BAR_BSALIB_PATH,它被设置为 $INFORMIXDIR/lib/libbsapsm.so 甚至完成了这个 BAR_BSALIB_PATH="/opt/informix-12.10.fc10/lib/libbsapsm.so" :/home/informix echo $BAR_BSALIB_PATH /opt/informix-12.10.fc10/lib/libbsapsm.so
还是同样的错误!
7- 重新生成紧急启动文件 - 如果 ixbar 文件不为空且包含对象数据,onsmsync -b 将更新 sysutils 数据库和 ixbar 文件,以使它们同步。
onsmsync -b
bar_act.log
2018-07-20 00:19:07 25656 25370 (-43207) 无法打开与数据库服务器的连接:。2018-07-20 00:19:07 25656 25370 onsmsync 完成,返回 155 (0x9b) 2018-07-20 00:21:24 25933 25931 /opt/informix-12.10.fc10/bin/onbar_d -r
8-恢复数据
onbar -r
警告:参数的用户配置值已被调整。(ALARMPROGRAM)gzip:stdin:文件意外结束
gzip:stdin:文件意外结束
9- 服务器进入快速恢复模式
10-错误日志
获取 /awwdst13a/rootdbs/0/rootdbs.377.1 HTTP/1.1
然后出现失败消息,如 * 写入正文失败(0 != 16347)* 关闭连接 0 2018-07-20 00:21:25 25937 25933 smtranid.c:155 对象事务列表为空。 2018-07-20 00:21:27 25933 25931 bar_ixbar_list:输入 2018-07-20 00:21:27 25933 25931 bar_ixbar_list:返回 0(0x00) 2018-07-20 00:21:27 25933 25931 bar_build_timeline:输入 2018-07-20 00:21:27 25933 25931 bar_build_timeline:返回 0(0x00) 2018-07-20 00:21:27 25933 25931 smcatalog.c:521 nsmOpenDatabase:计数:已打开 = 9,缺失 = 0。2018-07-20 00:21:27 25933 25931 smtranid.c:84 对象事务列表为空。2018-07-20 00:21:27 25941 25933 smcatalog.c:521 nsmOpenDatabase:计数:已打开 = 9,缺失 = 0。2018-07-20 00:21:27 25941 过滤器 write_to_filter:在父级输出管道上写入失败。errno = 32。2018-07-20 00:21:27 25941 过滤器
write_to_filter:写入位于 0x1e05930 的句柄/fd 17 时出错。
11-bar_act.log
2018-07-20 00:21:27 25945 25933 成功连接到存储管理器。 2018-07-20 00:21:27 25933 25931 开始冷级别 0 恢复 rootdbs(存储管理器副本 ID:0 377)。 2018-07-20 00:21:40 25945 25933 Informix 主存储管理器会话 867 已关闭 2018-07-20 00:21:40 25945 25933 备份和恢复过滤器的子进程正在终止,退出代码为 0。 2018-07-20 00:21:41 25933 25931 完成冷级别 0 恢复 rootdbs。
2018-07-20 00:21:41 25969 25933 开始冷级别 0 恢复 api7dbs(存储管理器副本 ID:0 381)。2018-07-20 00:21:42 25968 25933 Informix 主存储管理器会话 869 已打开。2018-07-20 00:21:42 25968 25933 已成功连接到存储管理器。2018-07-20 00:21:42 25968 25933 正在启动过滤器 /usr/bin/gunzip。2018-07-20 00:21:42 25968 25933 Informix 主存储管理器会话 869 已关闭
2018-07-20 00:21:44 25971 25933 开始冷级别 0 恢复 dat2dbs (存储管理器副本 ID:0 380)。2018-07-20 00:21:51 25983 25971 没有更多字节可读取。ISAM 错误 = 0。OS 错误 = 10 (无子进程)。2018-07-20 00:21:51 25983 25971 XBSA 错误:(BSAGetData) 发生系统错误。中止 XBSA 会话。 2018-07-20 00:21:51 25983 25971 Informix Primary Storage Manager 会话 875 已关闭 2018-07-20 00:21:51 25983 25971 备份和恢复过滤器的子进程正在终止,退出代码为 0。 2018-07-20 00:21:53 25971 25933 无法关闭存储空间恢复:物理恢复未完成。 2018-07-20 00:21:53 25971 25933 进程 25971 25933 已完成。 2018-07-20 00:21:53 25933 25931 (-43246) ON-Bar 进程 25971 因问题退出(退出代码 131 (0x83),信号 0)。
答案1
终于有时间进行测试psm
并将onbar
Informix 备份到 Amazon S3。
测试设置是 2 台CentOS 7
虚拟机(machine1
和machine2
),每台虚拟机上都有一台 Informix 服务器。这些机器可以相互通信并与 Amazon S3 通信。
machine1
将有 Informix 服务器ifx_a
,machine2
将有 Informix 服务器ifx_b
。
每台机器上都安装了 Informix 12.10.FC12,使用默认位置(/opt/IBM/informix/12.10/
)。
这是一个root
安装,但其他一切都在用户下运行informix
。
我
machine1
设置并初始化 Informix 服务器ifx_a
。我有以下环境变量:
PATH=/opt/IBM/informix/12.10/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin INFORMIXDIR=/opt/IBM/informix/12.10 INFORMIXSERVER=ifx_a INFORMIXSQLHOSTS=/opt/IBM/informix/12.10/etc/sqlhosts ONCONFIG=onconfig.ifx_a
我在文件中有以下参数
onconfig.ifx_a
:ROOTNAME rootdbs ROOTPATH $INFORMIXDIR/tmp/demo_on.rootdbs SERVERNUM 1 DBSERVERNAME ifx_a NETTYPE soctcp,1,50,NET BAR_ACT_LOG $INFORMIXDIR/tmp/bar_act.log BAR_DEBUG_LOG $INFORMIXDIR/tmp/bar_dbug.log BAR_DEBUG 5 BAR_MAX_BACKUP 3 BAR_RETRY 1 BAR_PROGRESS_FREQ 10 BAR_BSALIB_PATH $INFORMIXDIR/lib/libbsapsm.so BACKUP_FILTER '/usr/bin/gzip -c' RESTORE_FILTER '/usr/bin/gzip -d -c' BAR_PERFORMANCE 3 BAR_CKPTSEC_TIMEOUT 15 BAR_HISTORY 0 PSM_ACT_LOG $INFORMIXDIR/tmp/psm_act.log PSM_DEBUG_LOG $INFORMIXDIR/tmp/psm_dbug.log PSM_DEBUG 5 PSM_CATALOG_PATH $INFORMIXDIR/etc/psm PSM_DBS_POOL DBSPOOL PSM_LOG_POOL LOGPOOL ALARMPROGRAM $INFORMIXDIR/etc/alarmprogram.sh
文件
sqlhosts
:ifx_a onsoctcp machine1.local 15010 k=1 ifx_b onsoctcp machine2.local 15020 k=1
创建根 dbspace 文件并设置权限:
$ touch /opt/IBM/informix/12.10/tmp/demo_on.rootdbs $ chown informix:informix /opt/IBM/informix/12.10/tmp/demo_on.rootdbs $ chmod 660 /opt/IBM/informix/12.10/tmp/demo_on.rootdbs
初始化 Informix 服务器
ifx_a
:$ oninit -vi $ onstat -d IBM Informix Dynamic Server Version 12.10.FC12 -- On-Line -- Up 00:15:50 -- 164468 Kbytes Dbspaces address number flags fchunk nchunks pgsize flags owner name 44c23028 1 0x1 1 1 2048 N B informix rootdbs 1 active, 2047 maximum Chunks address chunk/dbs offset size free bpages flags pathname 44c23268 1 1 0 150000 85073 PO-B-- /opt/IBM/informix/12.10/tmp/demo_on.rootdbs 1 active, 32766 maximum NOTE: The values in the "size" and "free" columns for DBspace chunks are displayed in terms of "pgsize" of the DBspace to which they belong. Expanded chunk capacity mode: always
test_db
在新的 Informix 服务器上创建一个新的数据库:$ printf "CREATE DATABASE test_db WITH LOG;" | dbaccess sysmaster
跟随使用 ON-Bar 和 PSM 备份至 Amazon Simple Storage Service并设置 Amazon S3 存储桶和凭证。以下步骤基于所提及的文档:
psm
只需使用命令即可初始化目录onpsm
:$ onpsm -C detail The Informix Primary Storage Manager catalog is not present in the '/opt/IBM/informix/12.10/etc/psm/' directory. The system will try to create it. Informix Primary Storage Manager catalog creation in the '/opt/IBM/informix/12.10/etc/psm/' directory succeeded. Informix Primary Storage Manager State: PSM Unique ID : 1532732188 Catalog Location : /opt/IBM/informix/12.10/etc/psm/ Catalog State : Unlocked Catalog Owner : 0 Catalog Lock Mode: Regular Sessions: Session ID Process ID Empty SESSION table.
将 Amazon S3 存储桶添加到数据库空间的存储池中 (数据库缓冲池) 和逻辑日志 (日志池):
$ onpsm -D add AMAZON1 \ -g DBSPOOL \ -p HIGHEST \ -t CLOUD \ --url https://ifx-a-cloud-bucket.s3-eu-west-1.amazonaws.com \ --provider S3 \ --user UUUUUUUUUUUUUUUUUUUU \ --password XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \ --container ifx-a-cloud-bucket \ --max_part_size 25600 $ onpsm -D add AMAZON1 \ -g LOGPOOL \ -p HIGHEST \ -t CLOUD \ --url https://ifx-a-cloud-bucket.s3-eu-west-1.amazonaws.com \ --provider S3 \ --user UUUUUUUUUUUUUUUUUUUU \ --password XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \ --container ifx-a-cloud-bucket \ --max_part_size 25600
$ onpsm -D list Informix Primary Storage Manager Device List Type Prio Block/Size (MB) Pool Name Device Name FILE LOW --/-- DBSPOOL /opt/IBM/informix/12.10/backups CLOUD HIGHEST --/-- DBSPOOL AMAZON1 FILE LOW --/-- LOGPOOL /opt/IBM/informix/12.10/backups CLOUD HIGHEST --/-- LOGPOOL AMAZON1
对于最近创建的 Amazon S3 存储桶,应该
url
指向该存储桶的区域,否则 Amazon S3 将返回临时重定向负载并且onpsm
无法很好地处理它(似乎崩溃了)。
对 Informix 服务器进行备份
ifx_a
(在本例中,我进行整个系统备份,选项“-w”):-$ onbar-b-w-L 0
检查 onbar 日志文件
/opt/IBM/informix/12.10/tmp/bar_act.log
:2018-07-28 00:45:26.596713 7539 7537 /opt/IBM/informix/12.10/bin/onbar_d -b -L 0 -w 2018-07-28 00:45:26.757667 7539 7537 Using IBM's PSM version 12.10.FC12 as the Storage Manager. XBSA API version is 1.0.3. 2018-07-28 00:45:26.933961 7539 7537 Archive started on rootdbs (Requested Level 0). 2018-07-28 00:45:26.966597 7539 7537 Begin level 0 backup rootdbs. 2018-07-28 00:45:26.966861 7539 7537 Starting Filter /usr/bin/gzip -c. 2018-07-28 00:45:26.971701 7542 7539 Successfully connected to Storage Manager. 2018-07-28 00:45:34.500992 7542 7539 The child process for the backup and restore filter is terminating with exit code 0. 2018-07-28 00:45:34.507614 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:34.511597 7539 7537 Completed level 0 backup rootdbs (Storage Manager copy ID: 0 1). 2018-07-28 00:45:34.545924 7539 7537 Archive on rootdbs Completed (Requested Level 0). 2018-07-28 00:45:34.549264 7539 7537 Begin backup logical log 1. 2018-07-28 00:45:34.549524 7539 7537 Starting Filter /usr/bin/gzip -c. 2018-07-28 00:45:34.570435 7561 7539 Successfully connected to Storage Manager. 2018-07-28 00:45:38.455047 7561 7539 The child process for the backup and restore filter is terminating with exit code 0. 2018-07-28 00:45:38.461007 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:38.555035 7539 7537 Completed backup logical log 1 (Storage Manager copy ID: 0 2). 2018-07-28 00:45:38.572049 7539 7537 Begin backup logical log 2. 2018-07-28 00:45:38.572251 7539 7537 Starting Filter /usr/bin/gzip -c. 2018-07-28 00:45:38.577040 7576 7539 Successfully connected to Storage Manager. 2018-07-28 00:45:43.152739 7576 7539 The child process for the backup and restore filter is terminating with exit code 0. 2018-07-28 00:45:43.159746 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:43.214322 7539 7537 Completed backup logical log 2 (Storage Manager copy ID: 0 3). 2018-07-28 00:45:43.227226 7539 7537 Begin backup logical log 3. 2018-07-28 00:45:43.227451 7539 7537 Starting Filter /usr/bin/gzip -c. 2018-07-28 00:45:43.231582 7592 7539 Successfully connected to Storage Manager. 2018-07-28 00:45:46.529906 7592 7539 The child process for the backup and restore filter is terminating with exit code 0. 2018-07-28 00:45:46.536171 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:46.561509 7539 7537 Completed backup logical log 3 (Storage Manager copy ID: 0 4). 2018-07-28 00:45:46.586104 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:46.659232 7539 7537 Begin backup of critical file '/opt/IBM/informix/12.10/etc/ixbar.1'. 2018-07-28 00:45:46.662166 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:46.665362 7539 7537 Completed backup of critical file '/opt/IBM/informix/12.10/etc/ixbar.1' (Storage Manager copy ID: 0 5). 2018-07-28 00:45:47.106933 7539 7537 Begin backup of critical file '/opt/IBM/informix/12.10/etc/oncfg_ifx_a.1'. 2018-07-28 00:45:47.111936 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:47.117141 7539 7537 Completed backup of critical file '/opt/IBM/informix/12.10/etc/oncfg_ifx_a.1' (Storage Manager copy ID: 0 6). 2018-07-28 00:45:47.566010 7539 7537 Begin backup of critical file '/opt/IBM/informix/12.10/etc/onconfig.ifx_a'. 2018-07-28 00:45:47.571084 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:47.577958 7539 7537 Completed backup of critical file '/opt/IBM/informix/12.10/etc/onconfig.ifx_a' (Storage Manager copy ID: 0 7). 2018-07-28 00:45:48.216676 7539 7537 Begin backup of critical file '/opt/IBM/informix/12.10/etc/sqlhosts'. 2018-07-28 00:45:48.221868 7539 7537 Successfully connected to Storage Manager. 2018-07-28 00:45:48.227252 7539 7537 Completed backup of critical file '/opt/IBM/informix/12.10/etc/sqlhosts' (Storage Manager copy ID: 0 8). 2018-07-28 00:45:48.649965 7539 7537 /opt/IBM/informix/12.10/bin/onbar_d complete, returning 0 (0x00)
设置逻辑日志完成后的自动备份。
编辑
ALARMPROGRAM
脚本并更改BACKUPLOGS
为Y
:BACKUPLOGS=Y
强制逻辑日志完成/更改,它将备份所有需要的逻辑日志。
$ onmode -l
检查 onbar 日志文件
/opt/IBM/informix/12.10/tmp/bar_act.log
:07/28/18 01:11:02 Logical Log 4 Complete, timestamp: 0x4c867. 07/28/18 01:11:03 Logical Log 4 - Backup Started 07/28/18 01:11:05 Logical Log 4 - Backup Completed 07/28/18 01:11:09 Logical Log 5 Complete, timestamp: 0x55db7. 07/28/18 01:11:10 Logical Log 5 - Backup Started 07/28/18 01:11:12 Logical Log 5 - Backup Completed 07/28/18 01:11:36 Logical Log 6 Complete, timestamp: 0x57a93. 07/28/18 01:11:37 Logical Log 6 - Backup Started 07/28/18 01:11:38 Logical Log 6 - Backup Completed
验证备份对象是否列在
psm
目录中:$ onpsm -O list Informix Primary Storage Manager Object List Object ID Date Created Size (MB) Logical path (name.version) 1 2018-07-28 00:45:26 2.5 /ifx_a/rootdbs/0/ifx_a.1 2 2018-07-28 00:45:34 1.2 /ifx_a/1/1/ifx_a.1 3 2018-07-28 00:45:38 1.4 /ifx_a/1/2/ifx_a.1 4 2018-07-28 00:45:43 0.9 /ifx_a/1/3/ifx_a.1 5 2018-07-28 00:45:46 0.0 /ifx_a/critical_files/ixbar/ifx_a.1 6 2018-07-28 00:45:47 0.0 /ifx_a/critical_files/oncfg/ifx_a.1 7 2018-07-28 00:45:47 0.1 /ifx_a/critical_files/onconfig/ifx_a.1 8 2018-07-28 00:45:48 0.0 /ifx_a/critical_files/sqlhosts/ifx_a.1 9 2018-07-28 01:11:03 0.6 /ifx_a/1/4/ifx_a.1 10 2018-07-28 01:11:10 0.6 /ifx_a/1/5/ifx_a.1 11 2018-07-28 01:11:37 0.1 /ifx_a/1/6/ifx_a.1
导出
psm
目录以便将其移动到machine2
。这将
psm_catalog.exp
在当前目录中创建一个。它将包含要导入到新目录中的文本文件。$ onpsm -C export
另一种方法是仅将
psm
目录复制到machine2
。- 在 Informix 版本 12.10.FC10 中,类型设备的导出选项已损坏
CLOUD
,因此必须复制目录。
- 在 Informix 版本 12.10.FC10 中,类型设备的导出选项已损坏
- 目录
psm
不是备份的一部分。根据文档,它本身应该由外部工具备份HCL Informix 主存储管理器
我
machine2
设置了 Informix 服务器ifx_b
,但我确实不是初始化它。我有以下环境变量:
PATH=/opt/IBM/informix/12.10/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin INFORMIXDIR=/opt/IBM/informix/12.10 INFORMIXSERVER=ifx_b INFORMIXSQLHOSTS=/opt/IBM/informix/12.10/etc/sqlhosts ONCONFIG=onconfig.ifx_b
我在文件中具有以下参数
onconfig.ifx_b
,它们大多与 Informix 服务器相同ifx_a
,但我更愿意为其赋予不同的 SERVERNUM 和 DBSERVERNAME(这不是必需的,因为它们位于不同的机器中):ROOTNAME rootdbs ROOTPATH $INFORMIXDIR/tmp/demo_on.rootdbs SERVERNUM 2 DBSERVERNAME ifx_b NETTYPE soctcp,1,50,NET BAR_ACT_LOG $INFORMIXDIR/tmp/bar_act.log BAR_DEBUG_LOG $INFORMIXDIR/tmp/bar_dbug.log BAR_DEBUG 5 BAR_MAX_BACKUP 3 BAR_RETRY 1 BAR_PROGRESS_FREQ 10 BAR_BSALIB_PATH $INFORMIXDIR/lib/libbsapsm.so BACKUP_FILTER '/usr/bin/gzip -c' RESTORE_FILTER '/usr/bin/gzip -d -c' BAR_PERFORMANCE 3 BAR_CKPTSEC_TIMEOUT 15 BAR_HISTORY 0 PSM_ACT_LOG $INFORMIXDIR/tmp/psm_act.log PSM_DEBUG_LOG $INFORMIXDIR/tmp/psm_dbug.log PSM_DEBUG 5 PSM_CATALOG_PATH $INFORMIXDIR/etc/psm PSM_DBS_POOL DBSPOOL PSM_LOG_POOL LOGPOOL ALARMPROGRAM $INFORMIXDIR/etc/alarmprogram.sh
文件
sqlhosts
:ifx_a onsoctcp machine1.local 15010 k=1 ifx_b onsoctcp machine2.local 15020 k=1
创建根 dbspace 文件并设置权限:
$ touch /opt/IBM/informix/12.10/tmp/demo_on.rootdbs $ chown informix:informix /opt/IBM/informix/12.10/tmp/demo_on.rootdbs $ chmod 660 /opt/IBM/informix/12.10/tmp/demo_on.rootdbs
复制到
machine2
Informix 服务器ifx_a
psm
目录导出。导入 Informix 服务器
ifx_a
psm
目录。导入的目录将假定 Informix 服务器的所有绝对路径都相同ifx_a
。但两个 Informix 服务器都设置为具有相同的绝对路径。在所在的目录中
psm_catalog.exp
,我运行:$ onpsm -C import The Informix Primary Storage Manager catalog is not present in the '/opt/IBM/informix/12.10/etc/psm/' directory. The system will try to create it. Informix Primary Storage Manager catalog creation in the '/opt/IBM/informix/12.10/etc/psm/' directory succeeded. This option replaces the Informix Primary Storage Manager catalog using the contents of the 'psm_catalog.exp' directory. Are you sure you want to continue? (y/n) y
检查
psm
目录:$ onpsm -C detail Informix Primary Storage Manager State: PSM Unique ID : 1532739005 Catalog Location : /opt/IBM/informix/12.10/etc/psm/ Catalog State : Unlocked Catalog Owner : 0 Catalog Lock Mode: Regular Sessions: Session ID Process ID Empty SESSION table. $ onpsm -O list Informix Primary Storage Manager Object List Object ID Date Created Size (MB) Logical path (name.version) 1 2018-07-28 00:45:26 2.5 /ifx_a/rootdbs/0/ifx_a.1 2 2018-07-28 00:45:34 1.2 /ifx_a/1/1/ifx_a.1 3 2018-07-28 00:45:38 1.4 /ifx_a/1/2/ifx_a.1 4 2018-07-28 00:45:43 0.9 /ifx_a/1/3/ifx_a.1 5 2018-07-28 00:45:46 0.0 /ifx_a/critical_files/ixbar/ifx_a.1 6 2018-07-28 00:45:47 0.0 /ifx_a/critical_files/oncfg/ifx_a.1 7 2018-07-28 00:45:47 0.1 /ifx_a/critical_files/onconfig/ifx_a.1 8 2018-07-28 00:45:48 0.0 /ifx_a/critical_files/sqlhosts/ifx_a.1 9 2018-07-28 01:11:03 0.6 /ifx_a/1/4/ifx_a.1 10 2018-07-28 01:11:10 0.6 /ifx_a/1/5/ifx_a.1 11 2018-07-28 01:11:37 0.1 /ifx_a/1/6/ifx_a.1 12 2018-07-28 01:32:40 2.5 /ifx_a/rootdbs/0/ifx_a.2 13 2018-07-28 01:32:47 0.5 /ifx_a/1/7/ifx_a.1 14 2018-07-28 01:32:49 0.0 /ifx_a/critical_files/ixbar/ifx_a.2 15 2018-07-28 01:32:49 0.0 /ifx_a/critical_files/oncfg/ifx_a.2 16 2018-07-28 01:32:50 0.1 /ifx_a/critical_files/onconfig/ifx_a.2 17 2018-07-28 01:32:50 0.0 /ifx_a/critical_files/sqlhosts/ifx_a.2
为了
onbar
工作,它需要一个ixbar
文件(它自己的离线目录)。onsmsync
命令可以重新创建ixbar
文件,但它只能从sysutils
数据库中执行此操作,而数据库在 Informix 服务器中并不存在ifx_b
,因为它尚未初始化(即使初始化,它也是空的)。所以我们需要从psm
存储设备中获取它。- 获取对象 14,因为它是 ixbar 文件的最新备份。
检查对象目录元数据:
$ onpsm -O detail -o 14 Informix Primary Storage Manager Object Detail List Object ID : 14 XBSA PATH : /ifx_a/critical_files/ixbar XBSA CopyId : 0:14 Object Type : C Object version : 2 Physical pieces : https://ifx-a-cloud-bucket.s3.amazonaws.com//ifx_a/critical_files/ixbar/ixbar.14.1 Number of pieces: 1
ixbar
从存储设备 获取(“转储”)文件:onpsm -O dump -o 14
它在当前目录中创建一个文件
ifx_a_critical_files_ixbar.14
。复制并重命名该文件,使其成为ixbar
Informix 服务器ifx_b
(SERVERNUM 2) 的文件:$ cp ifx_a_critical_files_ixbar.14 /opt/IBM/informix/12.10/etc/ixbar.2
启动
onbar
恢复命令。$ onbar -r -w
检查 onbar 日志文件
/opt/IBM/informix/12.10/tmp/bar_act.log
:2018-07-28 01:57:45.727270 11009 11007 /opt/IBM/informix/12.10/bin/onbar_d -r -w 2018-07-28 01:57:45.794570 11009 11007 Using IBM's PSM version 12.10.FC12 as the Storage Manager. XBSA API version is 1.0.3. 2018-07-28 01:57:45.799655 11009 11007 Successfully connected to Storage Manager. 2018-07-28 01:57:45.799874 11009 11007 Starting Filter /usr/bin/gzip -d -c. 2018-07-28 01:57:45.831695 11011 11009 Successfully connected to Storage Manager. 2018-07-28 01:57:46.435703 11009 11007 Begin reserved pages read (level 0 of rootdbs, Storage Manager copy ID: 0 12). 2018-07-28 01:57:46.486687* 11011 11009 Filter closed. 2018-07-28 01:57:46.531063* 11011 11009 Filter closed. 2018-07-28 01:57:46.540890 11009 11007 Completed reserved pages read (level 0 of rootdbs). 2018-07-28 01:57:46.555287 11009 11007 Unable to start logical log salvage: Unable to read boot strap config file - '/opt/IBM/informix/12.10/etc/oncfg_ifx_b.2' . 2018-07-28 01:57:51.563908 11009 11007 Successfully connected to Storage Manager. 2018-07-28 01:57:51.564216 11009 11007 Starting Filter /usr/bin/gzip -d -c. 2018-07-28 01:57:51.575587 11019 11009 Successfully connected to Storage Manager. 2018-07-28 01:57:52.096184 11009 11007 Begin reserved pages read (level 0 of rootdbs, Storage Manager copy ID: 0 12). 2018-07-28 01:57:52.153351* 11019 11009 Filter closed. 2018-07-28 01:57:52.198363* 11019 11009 Filter closed. 2018-07-28 01:57:52.209302 11009 11007 Completed reserved pages read (level 0 of rootdbs). 2018-07-28 01:57:52.222134 11009 11007 Successfully connected to Storage Manager. 2018-07-28 01:57:52.222251 11009 11007 Starting Filter /usr/bin/gzip -d -c. 2018-07-28 01:57:52.227977 11024 11009 Successfully connected to Storage Manager. 2018-07-28 01:57:52.753398 11009 11007 Begin cold level 0 restore rootdbs (Storage Manager copy ID: 0 12). 2018-07-28 01:58:05.396340 11024 11009 The child process for the backup and restore filter is terminating with exit code 0. 2018-07-28 01:58:05.448496 11009 11007 Completed cold level 0 restore rootdbs. 2018-07-28 01:58:05.790012 11009 11007 Completed whole system restore. 2018-07-28 01:58:06.812501 11009 11007 Successfully connected to Storage Manager. 2018-07-28 01:58:06.812747 11009 11007 Starting Filter /usr/bin/gzip -d -c. 2018-07-28 01:58:06.827447 11049 11009 Successfully connected to Storage Manager. 2018-07-28 01:58:07.413841 11009 11007 Begin restore logical log 7 (Storage Manager copy ID: 0 13). 2018-07-28 01:58:09.251399 11049 11009 The child process for the backup and restore filter is terminating with exit code 0. 2018-07-28 01:58:09.382900 11009 11007 Completed restore logical log 7. 2018-07-28 01:58:09.388014 11009 11007 Successfully connected to Storage Manager. 2018-07-28 01:58:09.831410 11009 11007 Completed logical restore. 2018-07-28 01:58:10.046783 11009 11007 Successfully connected to Storage Manager. 2018-07-28 01:58:10.104630 11009 11007 /opt/IBM/informix/12.10/bin/onbar_d complete, returning 0 (0x00)
检查在线日志文件
/opt/IBM/informix/12.10/tmp/online.log
:01:57:53 IBM Informix Dynamic Server Started. 01:57:53 Requested shared memory segment size rounded from 4308KB to 4796KB Sat Jul 28 01:57:55 2018 07/28/18 01:57:55 Requested shared memory segment size rounded from 110629KB to 110632KB 07/28/18 01:57:55 Successfully added a bufferpool of page size 2K. 07/28/18 01:58:00 Restartable Restore has been ENABLED 07/28/18 01:58:00 Recovery Mode 07/28/18 01:58:01 Listen thread init SUCCESS 07/28/18 01:58:01 Physical Restore of rootdbs started. 07/28/18 01:58:02 Chunk 1 '/opt/IBM/informix/12.10/tmp/demo_on.rootdbs' is sparse - inflating... 07/28/18 01:58:09 Logical Recovery has reached the transaction cleanup phase. 07/28/18 01:58:09 Logical Recovery Complete. 8 Committed, 0 Rolled Back, 0 Open, 0 Bad Locks 07/28/18 01:58:09 Logical Recovery Complete. 07/28/18 01:58:09 Quiescent Mode 07/28/18 01:58:09 Checkpoint Completed: duration was 0 seconds. 07/28/18 01:58:09 Sat Jul 28 - loguniq 8, logpos 0x18, timestamp: 0x5f8dd Interval: 25 07/28/18 01:58:09 Maximum server connections 0 07/28/18 01:58:09 Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 19, Llog used 1 07/28/18 01:58:10 Booting Language <spl> from module <> 07/28/18 01:58:10 Loading Module <SPLNULL> 07/28/18 01:58:10 Defragmenter cleaner thread now running 07/28/18 01:58:10 Defragmenter cleaner thread cleaned:0 partitions
Informix 服务器
ifx_b
现在处于Quiescent
模式(内存已初始化,可以执行一些管理任务)。将 Informix 服务器更改ifx_b
为在线模式。$ onmode -m
检查数据库是否
test_db
已恢复。printf "select name from sysdatabases;" | dbaccess sysmaster Database selected. name sysmaster name sysutils name sysuser name sysadmin name test_db 5 row(s) retrieved. Database closed.