/***********************************************************************/
informix onbar
本文使用PSM 进行备份
/***********************************************************************/
一 环境准备
[informix@node1 ~]$ cd /opt/dbs
[informix@node1 dbs]$ ll
total 6250052
-rw-rw----  1 informix informix 2048000000 Mar 23 15:41 llogdbs
-rw-rw----  1 informix informix 2048000000 Mar 23 15:40 plogdbs
-rw-rw----. 1 informix informix 2304038912 Mar 23 15:40 rootdbs

[informix@node1 dbs]$ touch datadbs1 datadbs2 datadbs3
[informix@node1 dbs]$ chmod 660 d*
[informix@node1 dbs]$ ls -al
total 6250060
drwxr-xr-x. 2 informix informix       4096 Mar 23 15:42 .
drwxr-xr-x. 5 root     root           4096 Nov 18 10:54 ..
-rw-rw----  1 informix informix          0 Mar 23 15:42 datadbs1
-rw-rw----  1 informix informix          0 Mar 23 15:42 datadbs2
-rw-rw----  1 informix informix          0 Mar 23 15:42 datadbs3
-rw-rw----  1 informix informix 2048000000 Mar 23 15:41 llogdbs
-rw-rw----  1 informix informix 2048000000 Mar 23 15:40 plogdbs
-rw-rw----. 1 informix informix 2304038912 Mar 23 15:40 rootdbs

onspaces -c -d datadbs1 -p /opt/dbs/datadbs1 -o 0 -s 100000
onspaces -c -d datadbs2 -p /opt/dbs/datadbs2 -o 0 -s 100000
onspaces -c -d datadbs3 -p /opt/dbs/datadbs3 -o 0 -s 100000

[informix@node1 dbs]$ ls -al
total 6550060
drwxr-xr-x. 2 informix informix       4096 Mar 23 15:42 .
drwxr-xr-x. 5 root     root           4096 Nov 18 10:54 ..
-rw-rw----  1 informix informix  102400000 Mar 23 15:45 datadbs1
-rw-rw----  1 informix informix  102400000 Mar 23 15:45 datadbs2
-rw-rw----  1 informix informix  102400000 Mar 23 15:45 datadbs3
-rw-rw----  1 informix informix 2048000000 Mar 23 15:45 llogdbs
-rw-rw----  1 informix informix 2048000000 Mar 23 15:45 plogdbs
-rw-rw----. 1 informix informix 2304038912 Mar 23 15:45 rootdbs

[informix@node1 dbs]$ dbaccess - -
create database test1 in datadbs1 with log;
create database test2 in datadbs2 with log;
create database test3 in datadbs3 with log;

database test1;
create table t1(a int);
insert into t1 values(1);

database test2;
create table t1(a int);
insert into t1 values(11);

database test3;
create table t1(a int);
insert into t1 values(111);

[informix@node1 dbs]$ echo 'select * from t1' |dbaccess test1 -
 a

1

1 row(s) retrieved.

[informix@node1 dbs]$ echo 'select * from t1' |dbaccess test2 -

a

11

1 row(s) retrieved.

[informix@node1 dbs]$ echo 'select * from t1' |dbaccess test3 -

a

111

1 row(s) retrieved.

二 准备工作
1 参数onconfig 文件(支持在线修改)

onmode -wf BAR_BSALIB_PATH=$INFORMIXDIR/lib/libbsapsm.so
onmode -wf ALARMPROGRAM=$INFORMIXDIR/etc/log_full.sh 
onmode -wf LTAPEDEV=/home/informix/backup/LOGPOOL

2 启用 PSM
onpsm -D add /home/informix/backup/DBSPOOL -g DBSPOOL -p HIGHEST -t FILE
onpsm -D add /home/informix/backup/LOGPOOL -g LOGPOOL -p HIGHEST -t FILE

onpsm -D add /home/informix/backup2/DBSPOOL -g DBSPOOL -p HIGHEST -t FILE
onpsm -D add /home/informix/backup2/LOGPOOL -g LOGPOOL -p HIGHEST -t FILE

[informix@node1 backup]$ pwd
/home/informix/backup
[informix@node1 backup]$ ls -al
drwxrwx---  2 informix informix 4096 Mar 23 15:59 DBSPOOL
drwxrwx---  2 informix informix 4096 Mar 23 15:59 LOGPOOL

[informix@node1 backup]$ onpsm -D list

__PSM__ Device List

Type   Prio     Block/Size (MB)  Pool Name     Device Name
FILE   LOW          --/--        DBSPOOL       /home/informix/gbase/backups
FILE   HIGHEST      --/--        DBSPOOL       /home/informix/backup/DBSPOOL

FILE   LOW          --/--        LOGPOOL       /home/informix/gbase/backups
FILE   HIGHEST      --/--        LOGPOOL       /home/informix/backup/LOGPOOL

-- 删除LOW 级别的 备份目录
onpsm -D del /home/informix/gbase/backups -d -g DBSPOOL -y
onpsm -D del /home/informix/gbase/backups -d -g LOGPOOL -y

[informix@node1 backup]$ onpsm -D list

__PSM__ Device List

Type   Prio     Block/Size (MB)  Pool Name     Device Name
FILE   HIGHEST      --/--        DBSPOOL       /home/informix/backup/DBSPOOL

FILE   HIGHEST      --/--        LOGPOOL       /home/informix/backup/LOGPOOL

三 备份 数据库 
1 0级备份
[informix@node1 backup]$ onbar -b -L 0

2 查看日志信息
[informix@node1 ~]$ tail -100 /home/informix/gbase/tmp/online.log 
16:03:21  Level 0 Archive started on datadbs3
16:03:22  Level 0 Archive started on datadbs2
16:03:22  Level 0 Archive started on datadbs1
16:03:22  Level 0 Archive started on plogdbs
16:03:22  Level 0 Archive started on llogdbs
16:03:22  Archive on llogdbs Completed.
16:03:22  Archive on datadbs3 Completed.
16:03:23  Archive on datadbs1 Completed.
16:03:23  Archive on datadbs2 Completed.
16:03:23  Archive on plogdbs Completed.
16:03:23  Logical Log 12 - Backup Started
16:03:23  Logical Log 12 - Backup Completed
16:03:24  Logical Log 12 Complete, timestamp: 0x62ae3.

3 查看BAR 备份日志
[informix@node1 backup]$ onstat -c |grep BAR_ACT
# BAR_ACT_LOG         - The ON-Bar activity log file location.
BAR_ACT_LOG $INFORMIXDIR/tmp/bar_act.log

[informix@node1 backup]$ more $INFORMIXDIR/tmp/bar_act.log
 2017-03-23 15:59:07 2474  2362 The PSM is ready.
 2017-03-23 15:59:07 2474  2362 onpsm -D add /home/informix/backup/DBSPOOL -g DBSPOOL -p HIGHEST -t FILE
 2017-03-23 15:59:07 2474  2362 The __PSM__ catalog is not present in the '/home/informix/gbase/etc/psm/' directory. 
The system will try to create it.
 2017-03-23 15:59:07 2474  2362 __PSM__ catalog creation in the '/home/informix/gbase/etc/psm/' directory succeeded.
 2017-03-23 15:59:07 2474  2362 __PSM__ session 1 opened.
 2017-03-23 15:59:07 2474  2362 __PSM__ session 1 closed
 2017-03-23 15:59:07 2474  2362 onpsm complete, returning 0
 2017-03-23 15:59:17 2477  2362 The PSM is ready.
 2017-03-23 15:59:17 2477  2362 onpsm -D add /home/informix/backup/LOGPOOL -g LOGPOOL -p HIGHEST -t FILE
 2017-03-23 15:59:17 2477  2362 __PSM__ session 2 opened.
 2017-03-23 15:59:17 2477  2362 __PSM__ session 2 closed
 2017-03-23 15:59:17 2477  2362 onpsm complete, returning 0
 2017-03-23 16:00:12 2484  2362 The PSM is ready.
 2017-03-23 16:00:12 2484  2362 onpsm -D list
 2017-03-23 16:00:12 2484  2362 __PSM__ session 3 opened.
 2017-03-23 16:00:12 2484  2362 __PSM__ session 3 closed
 2017-03-23 16:00:12 2484  2362 onpsm complete, returning 0
 2017-03-23 16:01:31 2503  2362 The PSM is ready.
 2017-03-23 16:01:31 2503  2362 onpsm -D del /home/informix/gbase/backups -d -g DBSPOOL -y
 2017-03-23 16:01:31 2503  2362 __PSM__ session 4 opened.
 2017-03-23 16:01:31 2503  2362 __PSM__ session 4 closed
 2017-03-23 16:01:31 2503  2362 onpsm complete, returning 0
 2017-03-23 16:01:34 2504  2362 The PSM is ready.
 .......
 .......
  copy ID: 0 9).
 2017-03-23 16:03:23 2514  2512 __PSM__ session 15 closed
 2017-03-23 16:03:23 2514  2512 Begin backup of critical file '/home/informix/gbase/etc/onconfig.gbaseserver'.
 2017-03-23 16:03:23 2514  2512 The PSM is ready.
 2017-03-23 16:03:23 2514  2512 __PSM__ session 16 opened.
 2017-03-23 16:03:23 2514  2512 Successfully connected to Storage Manager.
 2017-03-23 16:03:23 2514  2512 Completed backup of critical file '/home/informix/gbase/etc/onconfig.gbaseserver' (Storage Manage
r copy ID: 0 10).
 2017-03-23 16:03:23 2514  2512 __PSM__ session 16 closed
 2017-03-23 16:03:23 2514  2512 Begin backup of critical file '/home/informix/gbase/etc/sqlhosts.gbaseserver'.
 2017-03-23 16:03:23 2514  2512 The PSM is ready.
 2017-03-23 16:03:23 2514  2512 __PSM__ session 17 opened.
 2017-03-23 16:03:23 2514  2512 Successfully connected to Storage Manager.
 2017-03-23 16:03:23 2514  2512 Completed backup of critical file '/home/informix/gbase/etc/sqlhosts.gbaseserver' (Storage Manage
r copy ID: 0 11).
 2017-03-23 16:03:23 2514  2512 __PSM__ session 17 closed
 2017-03-23 16:03:23 2514  2512 /home/informix/gbase/bin/onbar_d complete, returning 0 (0x00)
 2017-03-23 16:03:24 2539  2537 /home/informix/gbase/bin/onbar_d -b -l
 2017-03-23 16:03:24 2539  2537 Using GBASE's PSM version 12.10.FC4G1 as the Storage Manager. XBSA API version is 1.0.3.
 2017-03-23 16:03:24 2539  2537 /home/informix/gbase/bin/onbar_d complete, returning 0 (0x00)

4 备份目录 
 [informix@node1 DBSPOOL]$ cd gbaseserver/
[informix@node1 gbaseserver]$ ls -al
total 36
drwxrwx--- 9 informix informix 4096 Mar 23 16:03 .
drwxrwx--- 3 informix informix 4096 Mar 23 16:03 ..
drwxrwx--- 6 informix informix 4096 Mar 23 16:03 critical_files
drwxrwx--- 3 informix informix 4096 Mar 23 16:03 datadbs1
drwxrwx--- 3 informix informix 4096 Mar 23 16:03 datadbs2
drwxrwx--- 3 informix informix 4096 Mar 23 16:03 datadbs3
drwxrwx--- 3 informix informix 4096 Mar 23 16:03 llogdbs
drwxrwx--- 3 informix informix 4096 Mar 23 16:03 plogdbs
drwxrwx--- 3 informix informix 4096 Mar 23 16:03 rootdbs

[informix@node1 12]$ pwd
/home/informix/backup/LOGPOOL/gbaseserver/0/12
[informix@node1 12]$ ll
total 17536
-rw-rw---- 1 informix informix 17955031 Mar 23 16:03 gbaseserver.1.1

[informix@node1 12]$ onpsm -O list

__PSM__ Object List

Object ID            Date Created         Size (MB) Logical path (name.version)
1                    2017-03-23 16:03:18       16.4 /gbaseserver/rootdbs/0/gbaseserver.1
2                    2017-03-23 16:03:21        2.5 /gbaseserver/datadbs3/0/gbaseserver.1
3                    2017-03-23 16:03:22        2.5 /gbaseserver/datadbs2/0/gbaseserver.1
4                    2017-03-23 16:03:22        0.1 /gbaseserver/plogdbs/0/gbaseserver.1
5                    2017-03-23 16:03:22        2.5 /gbaseserver/datadbs1/0/gbaseserver.1
6                    2017-03-23 16:03:22        0.1 /gbaseserver/llogdbs/0/gbaseserver.1
7                    2017-03-23 16:03:23       17.1 /gbaseserver/0/12/gbaseserver.1
8                    2017-03-23 16:03:23        0.0 /gbaseserver/critical_files/ixbar/gbaseserver.1
9                    2017-03-23 16:03:23        0.0 /gbaseserver/critical_files/oncfg/gbaseserver.1
10                   2017-03-23 16:03:23        0.1 /gbaseserver/critical_files/onconfig/gbaseserver.1
11                   2017-03-23 16:03:23        0.0 /gbaseserver/critical_files/sqlhosts/gbaseserver.1

四 恢复数据库
1 模拟 全部 DBSPACE 损坏
1) 删除   
cd /opt/dbs
rm -fr *
touch llogdbs plogdbs rootdbs datadbs1 datadbs2 datadbs3
chmod 660 *

2) 恢复 损坏  DBSPACE

[informix@node1 dbs]$ onbar -r

3) 将数据库从 Quiescent 改为 On-Line
[informix@node1 dbs]$ onstat -

GBase 8t Database Server Version 12.10.FC4G1AEE -- Quiescent -- Up 00:08:54 -- 535708 Kbytes

[informix@node1 dbs]$ onmode -m
[informix@node1 dbs]$ onstat -

GBase 8t Database Server Version 12.10.FC4G1AEE -- On-Line -- Up 00:09:04 -- 535708 Kbytes

2 模拟 部分 DBSPACE 损坏
1) 删除   
cd /opt/dbs
rm -fr datadbs1 datadbs2 datadbs3
touch   datadbs1 datadbs2 datadbs3
chmod 660 *

2) 恢复 损坏  DBSPACE ( 删掉的空间在线恢复 需要加 -O 参数)
[informix@node1 dbs]$ oninit -vy
[informix@node1 dbs]$ onstat -

GBase 8t Database Server Version 12.10.FC4G1AEE -- On-Line -- Up 00:02:17 -- 535708 Kbytes

[informix@node1 dbs]$ ll
total 6250052
-rw-rw---- 1 informix informix          0 Mar 23 17:06 datadbs1
-rw-rw---- 1 informix informix          0 Mar 23 17:06 datadbs2
-rw-rw---- 1 informix informix          0 Mar 23 17:06 datadbs3
-rw-rw---- 1 informix informix 2048000000 Mar 23 17:12 llogdbs
-rw-rw---- 1 informix informix 2048000000 Mar 23 17:11 plogdbs
-rw-rw---- 1 informix informix 2304038912 Mar 23 17:11 rootdbs

[informix@node1 dbs]$ onbar -r  datadbs1 datadbs2 datadbs3
[informix@node1 dbs]$ ll
total 6550064
-rw-rw---- 1 informix informix  102400000 Mar 23 17:14 datadbs1
-rw-rw---- 1 informix informix  102400000 Mar 23 17:14 datadbs2
-rw-rw---- 1 informix informix  102400000 Mar 23 17:14 datadbs3
-rw-rw---- 1 informix informix 2048000000 Mar 23 17:14 llogdbs
-rw-rw---- 1 informix informix 2048000000 Mar 23 17:14 plogdbs
-rw-rw---- 1 informix informix 2304038912 Mar 23 17:14 rootdbs

[informix@node1 dbs]$ dbaccess test1 -

Database selected.

> select * from t1;

a

1

1 row(s) retrieved.

注: 参数 ONDBSPACEDOWN 需要设置为0 
[informix@node1 etc]$ vi onconfig.gbaseserver 
# ONDBSPACEDOWN  - Specifies how Informix behaves when it encounters a
#                  dbspace that is offline. Acceptable values
#                  are:
#                  0 Continue
#                  1 Stop
#                  2 Wait for DBA action
###################################################################
#ONDBSPACEDOWN 2
ONDBSPACEDOWN 0

3 恢复到某个时间点
1) 模拟数据
[informix@node1 dbs]$ dbaccess test1 -

Database selected.

> create table t2(a int ,b datetime year to second);

>  insert into t2 values(1,current);

1 row(s) inserted.

> select * from t2;

a b

1 2017-03-24 09:24:44
          1 2017-03-24 09:24:47
          1 2017-03-24 09:24:51
          1 2017-03-24 09:25:30
          1 2017-03-24 09:25:35
          2 2017-03-24 09:26:58
 
          2 2017-03-24 09:27:04
          2 2017-03-24 09:27:07
          3 2017-03-24 09:27:38
          3 2017-03-24 09:27:44
          3 2017-03-24 09:27:48
          4 2017-03-24 09:28:24
          4 2017-03-24 09:28:28
          4 2017-03-24 09:28:32
          5 2017-03-24 09:28:43
          5 2017-03-24 09:28:46
          5 2017-03-24 09:28:50
          6 2017-03-24 09:29:19
          6 2017-03-24 09:29:23

19 row(s) retrieved.

2) 删除   
cd /opt/dbs
rm -fr rootdbs datadbs1 datadbs2 datadbs3
touch rootdbs datadbs1 datadbs2 datadbs3
chmod 660 *

3) 恢复到某个时间点 2017-03-24 09:26:58
(
可多次执行,但是如果执行过某个时间的恢复后,要恢复到最好,要执行时间,否则还是上次恢复的数据
更改/home/informix/gbase/etc/ixbar.0 文件最后的记录或可能,但是 其文件内容不知,更改难度大)

export GL_DATETIME="%iY-%m-%d %H:%M:%S"

[informix@node1 dbs]$ onbar -r -t "2017-03-24 09:26:58"

[informix@node1 dbs]$ onbar -r -t "2017-03-24 09:28:50"

3) 将数据库从 Quiescent 改为 On-Line
[informix@node1 dbs]$ onstat -

GBase 8t Database Server Version 12.10.FC4G1AEE -- Quiescent -- Up 00:08:54 -- 535708 Kbytes

[informix@node1 dbs]$ onmode -m
[informix@node1 dbs]$ onstat -

GBase 8t Database Server Version 12.10.FC4G1AEE -- On-Line -- Up 00:09:04 -- 535708 Kbytes

> insert into t11 (b ) values(current);

1 row(s) inserted.

> select * from t11;

a  1636145
b  2017-03-27 13:49:43

a  1636146
b  2017-03-27 13:49:47

a  1636147
b  2017-03-27 13:51:04

a  1636148
b  2017-03-27 13:51:08

a  1636149
b  2017-03-27 13:51:12

a  1636150
b  2017-03-27 13:51:33

a  1636151
b  2017-03-27 13:51:38

a  1636152
b  2017-03-27 13:51:59

a  1636153
b  2017-03-27 13:52:04

a  1636154
b  2017-03-27 13:52:08

a  1636155
b  2017-03-27 13:52:23

a  1636156
b  2017-03-27 13:52:28

a  1636157
b  2017-03-27 13:52:32

13 row(s) retrieved.


[informix@node1 ~]$ onpsm -D list

__PSM__ Device List

Type   Prio     Block/Size (MB)  Pool Name     Device Name
FILE   READ-ONLY    --/--        DBSPOOL       /home/informix/backup/DBSPOOL

FILE   HIGHEST      --/--        LOGPOOL       /home/informix/backup/LOGPOOL

onpsm -D update /home/informix/backup/DBSPOOL    -g DBSPOOL -p HIGHEST

[informix@node1 ~]$ onpsm -D list

__PSM__ Device List

Type   Prio     Block/Size (MB)  Pool Name     Device Name
FILE   HIGHEST      --/--        DBSPOOL       /home/informix/backup/DBSPOOL

FILE   HIGHEST      --/--        LOGPOOL       /home/informix/backup/LOGPOOL

onpsm -D del /home/informix/backups/DBSPOOL -d -g DBSPOOL -y
onpsm -D del /home/informix/backups/LOGPOOL -d -g LOGPOOL -y

onpsm -D add /home/informix/backup/DBSPOOL -g DBSPOOL -p HIGHEST -t FILE
onpsm -D add /home/informix/backup/LOGPOOL -g LOGPOOL -p HIGHEST -t FILE

rm -fr dbs3
touch dbs3
chmod 660 dbs3
[informix@node1 dbs]$ onbar -r dbs3
 2017-04-07 16:46:08 5603  5601 /home/informix/gbase/bin/onbar_d -r dbs3
 2017-04-07 16:46:08 5603  5601 Using GBASE's PSM version 12.10.FC4G1 as the Storage Manager. XBSA API version is 1.0.3.
 2017-04-07 16:46:08 5603  5601 (-43394) Storage space dbs3 is not down so it will not be restored.
 2017-04-07 16:46:08 5603  5601 There are no storage spaces/logical logs to backup/restore.
 2017-04-07 16:46:08 5603  5601 /home/informix/gbase/bin/onbar_d complete, returning 147 (0x93)

[informix@node1 dbs]$ onbar -r -O dbs3
2017-04-07 16:48:11 5615  5613 /home/informix/gbase/bin/onbar_d -r -O dbs3
 2017-04-07 16:48:11 5615  5613 Using GBASE's PSM version 12.10.FC4G1 as the Storage Manager. XBSA API version is 1.0.3.
 2017-04-07 16:48:11 5615  5613 (-43385) Restoring dbs3 even though it is online.
 2017-04-07 16:48:12 5615  5613 The PSM is ready.
 2017-04-07 16:48:12 5615  5613 __PSM__ session 1710 opened.
 2017-04-07 16:48:12 5615  5613 Successfully connected to Storage Manager.
 2017-04-07 16:48:12 5615  5613 Begin warm level 0 restore dbs3 (Storage Manager copy ID: 0 1061).
 2017-04-07 16:48:15 5615  5613 Completed warm level 0 restore dbs3.
 2017-04-07 16:48:15 5615  5613 __PSM__ session 1710 closed
 2017-04-07 16:48:15 5615  5613 Begin backup logical log 63.
 2017-04-07 16:48:15 5615  5613 The PSM is ready.
 2017-04-07 16:48:15 5615  5613 __PSM__ session 1711 opened.
 2017-04-07 16:48:15 5615  5613 Successfully connected to Storage Manager.
 2017-04-07 16:48:15 5615  5613 Completed backup logical log 63 (Storage Manager copy ID: 0 1076).
 2017-04-07 16:48:15 5615  5613 __PSM__ session 1711 closed
 2017-04-07 16:48:16 5615  5613 The PSM is ready.
 2017-04-07 16:48:16 5615  5613 __PSM__ session 1712 opened.
 2017-04-07 16:48:16 5623  5621 /home/informix/gbase/bin/onbar_d -b -l
 2017-04-07 16:48:16 5615  5613 Successfully connected to Storage Manager.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 55 (Storage Manager copy ID: 0 1064).
 2017-04-07 16:48:16 5623  5621 Using GBASE's PSM version 12.10.FC4G1 as the Storage Manager. XBSA API version is 1.0.3.
 2017-04-07 16:48:16 5623  5621 /home/informix/gbase/bin/onbar_d complete, returning 0 (0x00)
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 55.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 56 (Storage Manager copy ID: 0 1069).
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 56.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 57 (Storage Manager copy ID: 0 1070).
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 57.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 58 (Storage Manager copy ID: 0 1071).
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 58.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 59 (Storage Manager copy ID: 0 1072).
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 59.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 60 (Storage Manager copy ID: 0 1073).
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 60.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 61 (Storage Manager copy ID: 0 1074).
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 61.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 62 (Storage Manager copy ID: 0 1075).
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 62.
 2017-04-07 16:48:16 5615  5613 Begin restore logical log 63 (Storage Manager copy ID: 0 1076).
 2017-04-07 16:48:16 5615  5613 Completed restore logical log 63.
 2017-04-07 16:48:17 5615  5613 Completed logical restore.
 2017-04-07 16:48:17 5615  5613 __PSM__ session 1712 closed
 2017-04-07 16:48:17 5615  5613 /home/informix/gbase/bin/onbar_d complete, returning 177 (0xb1)

五 镜像的CHUNK 的恢复
 1 启用镜像
[informix@node1 dbs]$ onspaces -c -d data1 -p /u02/gbase/dbs/data1 -o 0 -s 100000 -m /u02/gbase/dbs/data1-2 0
GBase 8t Database Server was initialized with no mirroring.

[informix@node1 dbs]$ onstat -c|grep MIRROR
MIRROR 1
#MIRRORPATH $INFORMIXDIR/tmp/demo_on.root_mirror
MIRROROFFSET 0

2 创建使用镜像的 SPACE
[informix@node1 dbs]$ touch data1 data1-2
[informix@node1 dbs]$ chmod 660 *
[informix@node1 dbs]$ onspaces -c -d data1 -p /u02/gbase/dbs/data1 -o 0 -s 100000 -m /u02/gbase/dbs/data1-2 0
Verifying physical disk space, please wait ...
Verifying physical disk space, please wait ...
Space successfully added.

** WARNING **  A level 0 archive of Root DBSpace will need to be done.

[informix@node1 dbs]$ dbaccess - -
> create database db1 in data1 with log;

Database created.

> select count(1) from t1;

(count)

128

1 row(s) retrieved.

[informix@node1 gbaseexam]$ onstat -d|grep data
462895b0         9        0x40002    13       1        2048     M  BA    informix data1
                                 Metadata 3389       2522       3389    
7ea91028         13     9      0          50000      48201                 PO-B-- /u02/gbase/dbs/data1
7ea70028         13     9      0          50000      0                     MO-B-- /u02/gbase/dbs/data1-2

3 模拟损坏data1-2 恢复
1) 损坏  
[informix@node1 dbs]$ dd if=/dev/null of=data1-2 bs=1 count=100
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000120653 s, 0.0 kB/s

[informix@node1 dbs]$ ll
total 5966936
-rw-rw---- 1 informix informix  102400000 Apr 13 09:23 data1
-rw-rw---- 1 informix informix          0 Apr 13 09:25 data1-2

[informix@node1 dbs]$ onstat -d |grep data
462895b0         9        0x40002    13       1        2048     M  BA    informix data1
                                 Metadata 3389       2522       3389    
7ea91028         13     9      0          50000      48201                 PO-B-- /u02/gbase/dbs/data1
7ea70028         13     9      0          50000      0                     MO-B-- /u02/gbase/dbs/data1-2

2) 将一个CHUNK 标记为DOWN
[informix@node1 dbs]$ onspaces -s data1 -p /u02/gbase/dbs/data1-2 -o 0 -D
Warning: bringing down a chunk.
Do you really want to continue? (y/n)y
Chunk status successfully changed.

[informix@node1 dbs]$ onstat -d|grep data
462895b0         9        0x60002    13       1        2048     M  BA    informix data1
                                 Metadata 3389       2522       3389    
7ea91028         13     9      0          50000      48201                 PO-B-- /u02/gbase/dbs/data1
7ea70028         13     9      0          50000      0                     MD-B-- /u02/gbase/dbs/data1-2

3)恢复CHUNK
[informix@node1 gbaseexam]$   onspaces -s data1 -p /u02/gbase/dbs/data1-2 -o 0 -O
WARNING: bringing a down chunk into recovery state.
Do you really want to continue? (y/n)y
Verifying physical disk space, please wait ...
Chunk status successfully changed.

[informix@node1 gbaseexam]$ onstat -d|grep data
462895b0         9        0x60002    13       1        2048     M  BA    informix data1
                                 Metadata 3389       2522       3389    
7ea91028         13     9      0          50000      48201                 PO-B-- /u02/gbase/dbs/data1
7ea70028         13     9      0          50000      0                     MO-B-- /u02/gbase/dbs/data1-2

4 损坏另一个CHUNK
1)损坏
[informix@node1 dbs]$ dd if=/dev/null of=data1 bs=1 count=100
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.0003378 s, 0.0 kB/s

[informix@node1 dbs]$ ll
total 5966936
-rw-rw---- 1 informix informix          0 Apr 13 09:34 data1
-rw-rw---- 1 informix informix  102400000 Apr 13 09:32 data1-2

[informix@node1 dbs]$ onstat -d|grep data
462895b0         9        0x60002    13       1        2048     M  BA    informix data1
                                 Metadata 3389       2522       3389    
7ea91028         13     9      0          50000      48201                 PO-B-- /u02/gbase/dbs/data1
7ea70028         13     9      0          50000      0                     MO-B-- /u02/gbase/dbs/data1-2

2) 标记DOWN
[informix@node1 dbs]$ onspaces -s data1 -p /u02/gbase/dbs/data1 -o 0 -D
Warning: bringing down a chunk.
Do you really want to continue? (y/n)y
Chunk status successfully changed.

[informix@node1 dbs]$ onstat -d|grep data
462895b0         9        0x60002    13       1        2048     M  BA    informix data1
                                 Metadata 3389       2522       3389    
7ea91028         13     9      0          50000      0                     PD-B-- /u02/gbase/dbs/data1
7ea70028         13     9      0          50000      48201                 MO-B-- /u02/gbase/dbs/data1-2

3) 恢复
[informix@node1 dbs]$ onspaces -s data1 -p /u02/gbase/dbs/data1 -o 0 -O
WARNING: bringing a down chunk into recovery state.
Do you really want to continue? (y/n)y
Verifying physical disk space, please wait ...
Chunk status successfully changed.

[informix@node1 dbs]$ onstat -d|grep data
462895b0         9        0x60002    13       1        2048     M  BA    informix data1
                                 Metadata 3389       2522       3389    
7ea91028         13     9      0          50000      48201                 PO-B-- /u02/gbase/dbs/data1
7ea70028         13     9      0          50000      0                     MO-B-- /u02/gbase/dbs/data1-2

5 2个CHUNK 不能同时损坏
[informix@node1 dbs]$ onspaces -s data1 -p /u02/gbase/dbs/data1 -o 0 -D
Warning: bringing down a chunk.
Do you really want to continue? (y/n)y
Chunk status successfully changed.
[informix@node1 dbs]$ onspaces -s data1 -p /u02/gbase/dbs/data1-2 -o 0 -D
Cannot bring this chunk down, it is currently the only chunk up.

informix-onbar相关推荐

  1. [转载]informix onbar规复饬令用法

      转载于:https://www.cnblogs.com/zgqjymx/archive/2011/03/06/1972745.html

  2. [转载]Netvault:操作Informix APM将A机备份的数据恢复到B机

    目的:操作NetVault 6 Informix APM ONBAR东西将A机在磁带库中备份过的Informix 数据库的存储集恢复到同网络的B机上的Informix数据库中 条件: 1)A机和B诡秘 ...

  3. RedHat Linux安装Informix v10.x(图文详解)

    如需转载,请注明出处,http://www.川江号子.cn  . 另,本人有Word电子文档格式,如需要,请联系本人:asima127@gmail.com 1Informix安装 1.1 准备安装文件 ...

  4. 如何综合掌握 DB2 和 Informix

    级别: 中级 Suma C Shastry (suma.chakrabarti@in.ibm.com), 高级软件工程师, IBM Mohan Kumar (mohankumarsp@in.ibm.c ...

  5. informix 常用命令

    命令 说明 备注 onstat命令集   onstat  -  查看数据库当前的状态 onstat  -c  查看数据库的配置文件 onstat  -d  查看数据库空间的使用情况 onstat  - ...

  6. 用户信息检索另一台服务器,客户机上一用户访问另一台机器上的informix数据库...

    客户机上一用户访问另一台机器上的informix数据库[@more@] ip=126 : informix 数据库服务器(INFORMIXSERVER 为 primary_ins1) ip=64 : ...

  7. Informix执行onmonitor出错的解决办法

    [root@db01]# su - informix [informix@db01]$ onmonitor Termcap entry too long Too many tc= indirectio ...

  8. 完美解决Informix的中文乱码问题

    完美解决Informix的中文乱码问题 参考文章: (1)完美解决Informix的中文乱码问题 (2)https://www.cnblogs.com/equation/p/5545967.html ...

  9. Informix IDS 11体系打点(918考试)认证指南,第 5 局部: 数据库管事器操作(4)

    更改数据库管事器方法 在 Windows 中,数据库管事器作为管事运转.Windows 供应了一个管事控制使用轨范(也称 Services 器械),用于启动.中止和暂停管事.这个管事控制使用轨范在控制 ...

最新文章

  1. python怎么找资源_新手Python学习资源哪里找好呢 视频?
  2. 编写yara规则 检测恶意软件
  3. 【算法与数据结构】一道检测inversion count的初级算法
  4. 【POJ 2503】Babelfish(水题)stl map存取即可
  5. 基于Apache POI 向xlsx写入数据
  6. Doxygen学习小记
  7. 狼道:强者的成人礼(第2版)
  8. 2.mysql数据库如何安装_MySQL数据库如何安装
  9. 对于DSH算法损失函数的理解
  10. 转发和重定向的区别[来源于网络]
  11. python类的构造方法名称_Python的面向对象、Class 概念与使用
  12. Linux系统--CentOS 7.6.1810 安装 nginx 1.16.0
  13. 计算机应用基础考试质量分析,基于SPSS软件的试卷分析与应用
  14. 一篇文章看明白 TCP/IP,TCP,UDP,IP,Socket 之间的关系
  15. 对List集合嵌套了map集合的排序
  16. React.js基础知识总结一
  17. CCNA Security 网院期末考试
  18. Java生成纳秒时间戳
  19. STM32F103 GPIOA->CRL=0XFFF0FFFF配置端口方向
  20. Linux---基础部分

热门文章

  1. 尝试建立一个可运行HAPI(HoudiniEngine API)的独立C++程序
  2. 基于蒙特卡洛的电动车有序充放电(Matlab代码实现)
  3. 数据库系统概念 | 第七章:使用E-R模型的数据库设计 | ER图设计| ER图转化为关系模型 | 强实体和弱实体
  4. php 提取登录QQsid_PHP实现QQ登录实例代码
  5. 俄语难写吗-难学吗-舞台俄语有哪些
  6. 消息队列之Kafka
  7. 实现上一页和下一页的效果
  8. log4c日志库的用法,再封装及其完整例子
  9. 用jk触发器设计一个011序列检测器的设计分析过程
  10. UWA 2021Unity性能优化汇总