informix-onbar

/***********************************************************************/
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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值