用ON-Bar初始化HDR

用ON-Bar初始化HDR
14:51 2009-4-22

Part I: 实验环境设置
OS:Red Hat Enterprise Linux AS release 4 (Nahant Update 5)

Pri:myserver1(192.168.138.250) online_web_tcp
Sec:myserver1(192.168.138.251) online_web_tcp_hdr

Part II: 实验步骤
说明:
本文所有单行以#开头的,是注释说明
[username@hostname dirname]#($) command 为实际执行语句

首先执行导入恢复的以下步骤,接着启动HDR并在目标计算机上执行仅物理恢复
要点:如果使用onbar执行备份和恢复,在两台数据库服务器上都需要ontape。
1. 要执行导入恢复:
1.1 设置导入恢复

**************************************************************************************
* Begin 设置源服务器ISM
**************************************************************************************
设置源服务器ISM
1. 初始化ISM

# 第一次启动ISM,发出ism_startup -init命令
#要使informix成为ISM用户并因此而确保informix可以在日常事务中执行ISM操作
#必须在任何ism_startup -init或ISM安装后运行以下命令(保存以下脚本命令到脚本文件中ismsetup.sh):

#!/bin/csh
# scriptname:ismsetup.sh 
# setup for ISM storage manager
echo "ISM setup begins"
# the user must edit these two lines to select
# appropriate disk locations for storage manager use.
setenv SM_DISKDEV1 /usr/backup/ptape
setenv SM_DISKDEV2 /usr/backup/ltape
# start ISM server
echo "initialize ISM server, must be done as root"
ism_startup -init

ism_add -admin informix@myserver1
# create some devices and media
# the ISM user, defined in ism_add -admin, can do these tasks
echo "create and mount ISM devices and pools"
ism_add -device $SM_DISKDEV1 -type file
ism_add -device $SM_DISKDEV2 -type file
ism_op -label $SM_DISKDEV1 -pool ISMDiskData -volume ISMData
ism_op -label $SM_DISKDEV2 -pool ISMDiskLogs -volume ISMLogs
# ism_catalog -create_bootstrap -pool ISMData
# ism_config -retention 7
ism_op -mount $SM_DISKDEV1
ism_op -mount $SM_DISKDEV2
echo "end of ISM setup"

# 运行脚本(如果运行过程中出现create failed提示,则可能是已经安装,要删除/home/informix/ism目录下队了

ISMVersion文件的其它所有内容,然后再次执行脚本)

[root@myserver1 ~]# ./ismsetup.sh
ISM setup begins
initialize ISM server, must be done as root
start_ism: is starting the ISM daemons.

*** The environment variable PRINTER is not set.
The ISM server cannot print important bootstrap information.
To perform a full ISM recovery, e.g. from a disk failure, use
‘ism_catalog -find_bootstrap’.

ism_startup: Initializing the ISM server.
ism_startup: finished initializing the ISM server.
ism_startup: Configure devices manually using ism_add.
create and mount ISM devices and pools
file disk ISMData mounted on /usr/backup/ptape, write enabled
file disk ISMLogs mounted on /usr/backup/ltape, write enabled
end of ISM setup

2 设置ISM环境变量和ONCONFIG参数
1) 设置卷池名
# 更改${INFORMIXDIR}/etc/$ONCONFIG文件中对应参数

ISM_LOG_POOL ISMDiskLogs //逻辑日志备份池
ISM_DATA_POOL ISMDiskData //物理数据备份池

2) 更新onbar脚本
# 如果ISM和ON-Bar来使用除ISMData以外的存储池,则需要编辑onbar脚本来将ism_catalog定向至正在使用的存储池。
# 如,使用ISMDiskData池,则在onbar脚本的ism_catalog行中进行下列更改:

[informix@myserver1 bin]$ cat onbar | grep create_bootstrap
${INFORMIXDIR}/bin/ism_catalog -create_bootstrap -pool ISMData > /dev/null 2>&1

${INFORMIXDIR}/bin/ism_catalog -create_bootstrap -pool ISMDiskData

**************************************************************************************
* End 设置源服务器ISM
**************************************************************************************

3. 使用导入的复原传送数据
Step1:将源数据库服务器备份至ISM
Step2:将ISM移植至不同物理主机的目标计算机上
Step3:将数据从ISM复原到目标计算机上具有相同实例的目标数据库服务器

Step1:将源数据库服务器备份至ISM(source_host):
1. 在源和目标计算机上执行hostname命令,查看主机名

[root@myserver1 ~]$ hostname
myserver1
[root@myserver2 ~]# hostname
myserver2

2. 使数据库服务器处于静默状态:

[informix@myserver1 ~]$ onmode -s
Incorrectly built binary which accesses errno or h_errno directly. Needs to be fixed.

This will perform a GRACEFUL SHUTDOWN –
Do you wish to continue (y/n)? y
[informix@myserver1 ~]$ onstat –
Incorrectly built binary which accesses errno or h_errno directly. Needs to be fixed.

Informix Dynamic Server 2000 Version 9.21.UC2 — Quiescent — Up 00:03:31 — 18888 Kby

3. 设置ISM环境变量
在$HOME/.bash_profile(root/informix)文件中添加如下内容:

ISM_SERVER=myserver1
ISM_DATA_VOLUME_POOL=ISMDiskData
ISM_LOG_VOLUME_POOL=ISMDiskLogs
export ISM_SERVER
export ISM_DATA_VOLUME_POOL
export ISM_LOG_VOLUME_POOL

4. 执行数据库的0级备份

[informix@myserver1 ~]$ onbar -b -L 0
Incorrectly built binary which accesses errno or h_errno directly. Needs to be fixed.

5. 备份$INFORMIXDIR/etc目录下的关键文件,当以另一个计算机系统为目标执行导入恢复时,将需要复原这些文件
oncfg_source_dbservername.servernum
ixbar.servernum
$ONCONFIG
sqlhosts

[informix@myserver1 etc]$ tar zcvf keyfiles.tar.gz oncfg_online_web_tcp.0 ixbar.0 onconfig_web sqlhosts

6. 完成以下步骤以使安全性可移植到新的计算机:

[root@myserver1 ~]# ism_add -admin root@myserver2
[root@myserver1 ~]# ism_add -admin informix@myserver2

7. 保存源ISM服务器的自举设置:

[root@myserver1 ~]# ism_catalog -create_bootstrap -pool $ISM_DATA_VOLUME_POOL

(该自举设置是$INFORMIXDIR/ism/mm、index、res中文件和目录副本。将把这些目录备份至称为自举设置的单个保存集)

/home/informix/ism/logs/daemon.log
04/21/09 12:13:32 nsrd: savegroup info: starting ISMDiskData (with 1 client(s))
04/21/09 12:13:32 nsrd: myserver1:/home/informix/ism/index/myserver1 saving to pool ‘ISMDiskData’ (ISMData)
04/21/09 12:13:32 nsrd: myserver1:/home/informix/ism/index/myserver1 done saving to pool ‘ISMDiskData’

(ISMData) 23 KB
04/21/09 12:13:32 nsrd: myserver1:bootstrap saving to pool ‘ISMDiskData’ (ISMData)
04/21/09 12:13:34 nsrmmdbd: media db is saving its data. This may take a while.
04/21/09 12:13:34 nsrmmdbd: media db is open for business.
04/21/09 12:13:34 nsrd: myserver1:bootstrap done saving to pool ‘ISMDiskData’ (ISMData) 53 KB
04/21/09 12:13:34 nsrd: savegroup notice: ISMDiskData completed, 1 client(s) (All Succeeded)
04/21/09 12:13:35 nsrd: index notice: nsrim has finished checking the media db
04/21/09 12:14:09 nsrd: write completion notice: Writing to volume ISMData complete

Step 2:将ISM移植至目标数据库服务器(target_host)

一、要将ISM移植到目标数据库服务器
1. root登录
2. 关闭informix和ISM

[informix@myserver2 ~]$ onmode -ky
[root@myserver2 ~]# ism_shutdown

3. 取消ISM_CLIENT环境变量

[root@myserver2 ~]# unset ISM_CLIENT

4. 编辑ism_startup脚本
# 在$INFORMIXDIR/bin/ism_startup 脚本中找到以下行:

hostname=$(hostname)
紧接此行添加以下行:

hostname=myserver1

[root@myserver2 tmp]# cat /home/informix/bin/ism_startup | grep hostname
# Abbreviated capitalized hostname.
hostname=$(hostname)
hostname=myserver1
host=${hostname%%.*}

5.重新初始化ISM

[root@myserver2 ~]# ism_startup -init
start_ism: is starting the ISM daemons.

*** The environment variable PRINTER is not set.
The ISM server cannot print important bootstrap information.
To perform a full ISM recovery, e.g. from a disk failure, use
‘ism_catalog -find_bootstrap’.

ism_startup: Initializing the ISM server.
ism_startup: finished initializing the ISM server.
ism_startup: Configure devices manually using ism_add.

6. 创建时间文件nsr1.tmp,输入以下内容

[root@myserver2 tmp]# cat nsr1.tmp
create type: NSR client; name: myserver1; remote access: root@myserver2, informix@myserver2

7. 针对临时文件运行以下命令:
# nsradmin -s myserver2 -i nsr1.tmp

[root@myserver2 tmp]# nsradmin -s myserver2 -i nsr1.tmp
created resource id 103.0.1.18.197.90.238.73.192.168.138.251(1)

这步可能收到错误消息,忽略错误继续

二、要复制具有与源主机上所拥有的相同将源的ISM,必须恢复自举设置

1. 确认两台服务器INFORMIXDIR源是否相同,否则要创建相关连接
# 如:若源计算机上的INFORMIXDIR是/usr2/informix,而目标计算机上的INFORMIXDIR是/usr/local/informix,则按以下方式在目标计算机上创建/usr2目录和符号链接

mkdir /usr2
ln -s /usr/local/informix /usr2/informix

2. 添加包含具有自举设置文件的卷池的设备
# ism_add -device device_name -type device_type

[root@myserver2 ism]# ism_add -device /usr/backup/ptape -type file
[root@myserver2 ism]# ism_add -device /usr/backup/ltape -type file

3. 为其它池添加剩余的设备

4. 安装ISM数据池中包含最新备份的存储卷
# ism_op -label /usr/backup/ptape -pool ISMDiskData -volume ISMData
# ism_op -label /usr/backup/ltape -pool ISMDiskLogs -volume ISMDLogs

[root@myserver2 ism]# ism_op -label /usr/backup/ptape -pool ISMDiskData -volume ISMData
[root@myserver2 ism]# ism_op -label /usr/backup/ltape -pool ISMDiskLogs -volume ISMDLogs
[root@myserver2 ism]# ism_op -mount /usr/backup/ptape
file disk ISMData mounted on /usr/backup/ptape, write enabled
[root@myserver2 ism]# ism_op -mount /usr/backup/ltape
file disk ISMDLogs mounted on /usr/backup/ltape, write enabled

5. 安装剩余的存储卷
# copy backup 及ism内容到对应位置
# 要打包源服务器上的内容:
/usr/backup
$INFORMIXDIR/etc目录下的关键文件
$INFORMIXDIR/ism目录
# 获取源服务器上的打包内容,解压到目标服务器对应位置,注意文件权限,特别是$INFORMIXDIR/etc目录下的关键文件的属组、主

6. 扫描以找到最新的自举设置保存集
# ism_catalog -find_bootstrap device_name

[root@myserver2 ism]# ism_catalog -find_bootstrap /usr/backup/ptape
scanner: scanning file disk ISMData on /usr/backup/ptape
scanner: done with file disk ISMData

scanner: Bootstrap 1013706532 of 4/22/09 7:35:52 located on volume ISMData, file 1013706532.

# ISM显示卷上所有自举设置保存集的ssid号(这里是1013706532),下面将要用到

7. 恢复最新的自举设置保留集
# ism_catalog -recover
# 注意提示输入,只需要输入上面的ssid号,其它直接回车

[root@myserver2 ism]# ism_catalog -recover
ism_catalog: Using myserver2 as server

NOTICE: ism_catalog is used to recover the ISM
server’s on-line file and media indexes from media
(backup tapes or disks) when either of the server’s
on-line file or media index has been lost or damaged.
Note that this command will OVERWRITE the server’s
existing on-line file and media indexes. ism_catalog
is not used to recover ISM clients’ on-line
indexes; normal recover procedures may be used for
this purpose. See the mmrecov(8) and nsr_crash(8)
man pages for more details.

/dev/nrst8 /usr/backup/ptape /usr/backup/ltape
What is the name of the device you plan on using [/dev/nrst8]? /usr/backup/ptape
/usr/backup/ptape: unmounted ISMData

Enter the latest bootstrap save set id []: 1013706532 # 这是是手工输入的上面的ssid号
Enter starting file number (if known) [0]:
Enter starting record number (if known) [0]:

Please insert the volume on which save set id 1013706532 started
into /usr/backup/ptape. When you have done this, press :

Scanning /usr/backup/ptape for save set 1013706532; this may take a while…
scanner: Reading the file label
scanner: Reading the file label
scanner: scanning file disk ISMData on /usr/backup/ptape
scanner: volume id 1012384245 record size 32768
created 4/22/09 7:29:51 expires 4/22/11 7:29:51
scanner: searching for ssid(s): 1013706532
scanner: scanning file 1013706532, record 0
scanner: ssid 1013706532: found beginning of myserver1:bootstrap
scanner: spawning `uasm -r -v -iY’ for ssid 1013706532 (myserver1:bootstrap)
/nsr
/nsr: file exists, overwriting
/home/informix/ism/res/nsrla.res
/home/informix/ism/res/nsrjb.res
/home/informix/ism/res/nsr.res
/home/informix/ism/res/
/home/informix/ism/mm/
scanner: ssid 1013706532: scan complete
scanner: ssid 1013706532: 47 KB, 14 file(s)
/home/informix/ism/index/myserver1/
/home/informix/ism/index/
/home/informix/ism/
/home/informix/
/home/
/
nsrindexasm -r /home/informix/ism/index/myserver1/db/
nsrmmdbasm -r /home/informix/ism/mm/mmvolume/
ism_catalog: Can’t set ISM server back to normal state!
nsrindexasm: Can’t connect to index service
[root@myserver2 ism]#

8. 关闭ISM

[root@myserver2 ism]# ism_shutdown

9. 从源数据库服务器恢复res.R文件
res.R文件包含源数据库服务器的将源配置信息

[root@myserver2 ism]# pwd
/home/informix/ism
[root@myserver2 ism]# ll
总用量 40
drwxrwxrwx 2 root root 4096 4月 22 07:50 applogs
drwx—— 11 root root 4096 4月 22 07:52 cores
drwxr-xr-x 2 root root 4096 4月 22 07:46 debug
drwxr-xr-x 4 root root 4096 4月 22 07:29 index
-r–r–r– 1 informix informix 17 4月 22 07:50 ISMVersion
drwxr-xr-x 2 root root 4096 4月 22 07:46 logs
drwxr-xr-x 3 root root 4096 4月 22 07:52 mm
———- 1 root root 0 4月 22 07:50 product.res
drwxr-xr-x 2 root root 4096 4月 22 07:52 res
drwxr-xr-x 2 root root 4096 4月 22 07:35 res.R
drwxr-xr-x 3 root root 4096 4月 22 07:50 tmp
[root@myserver2 ism]# rm -rf res
[root@myserver2 ism]# mv res.R res

10. 启动ISM

[root@myserver2 ism]# ism_startup

11. 从源计算机上除去目标计算机上不存在的设备条目
# ism_show -devices
# ism_rm -device device_name

[root@myserver1 ptape]# ism_show -devices
(nothing) mounted on 8mm 5GB tape /dev/nrst8
file disk ISMData mounted on /usr/backup/ptape, write enabled
file disk ISMLogs mounted on /usr/backup/ltape, write enabled

[root@myserver2 ism]# ism_show -devices
(nothing) mounted on 8mm 5GB tape /dev/nrst8
file disk ISMData mounted on /usr/backup/ptape, write enabled
file disk ISMLogs mounted on /usr/backup/ltape, write enabled

12. 创建未出现在ISM中的任何附加介质设备条目来与目标主机上存在的那些条目匹配
# ism_show -devices
# ism_add -device device_name -type device_type

13. 为本地用户授予访问源客户机的索引的许可权
创建临时文件(nsr2.tmp)并输入以下信息(注意中间空行不可少):

print type: NSR client; name: myserver1

update remote access: informix@myserver2,
root@myserver2

[root@myserver2 tmp]# cat nsr2.tmp
print type: NSR client; name: myserver1

update remote access: informix@myserver2,
root@myserver2

14. 针对临时文件运行以下命令:
# nsradmin -s target_hostname -i nsr2.tmp

[root@myserver2 tmp]# nsradmin -s myserver2 -i nsr2.tmp
type: NSR client;
name: myserver1;
server: myserver2;
archive services: Disabled;
schedule: Default;
browse policy: 6 Months;
retention policy: 6 Months;
directive: ;
group: Default;
save set: All;
remote access: ;
remote user: ;
password: ;
backup command: ;
aliases: myserver1;
archive users: ;
client OS type: Linux;
CPUs: 1;
NetWorker version: ISM.2.20.UC1.114;
enabler in use: Yes;

type: NSR client;
name: myserver1;
server: myserver2;
archive services: Disabled;
schedule: Default;
browse policy: 6 Months;
retention policy: 6 Months;
directive: ;
group: ISMDiskData;
save set: /dev/null;
remote access: ;
remote user: ;
password: ;
backup command: ;
aliases: myserver1;
archive users: ;
client OS type: Linux;
CPUs: 1;
NetWorker version: ISM.2.20.UC1.114;
enabler in use: Yes;

type: NSR client;
name: myserver1;
server: myserver2;
archive services: Disabled;
schedule: Default;
browse policy: 6 Months;
retention policy: 6 Months;
directive: ;
group: ISMDiskLogs;
save set: /dev/null;
remote access: ;
remote user: ;
password: ;
backup command: ;
aliases: myserver1;
archive users: ;
client OS type: Linux;
CPUs: 1;
NetWorker version: ISM.2.20.UC1.114;
enabler in use: Yes;

type: NSR client;
name: myserver1;
server: myserver2;
archive services: Disabled;
schedule: Default;
browse policy: 6 Months;
retention policy: 6 Months;
directive: ;
group: ISMData;
save set: /dev/null;
remote access: ;
remote user: ;
password: ;
backup command: ;
aliases: myserver1;
archive users: ;
client OS type: Linux;
CPUs: 1;
NetWorker version: ISM.2.20.UC1.114;
enabler in use: Yes;

type: NSR client;
name: myserver1;
server: myserver2;
archive services: Disabled;
schedule: Default;
browse policy: 6 Months;
retention policy: 6 Months;
directive: ;
group: ISMLogs;
save set: /dev/null;
remote access: ;
remote user: ;
password: ;
backup command: ;
aliases: myserver1;
archive users: ;
client OS type: Linux;
CPUs: 1;
NetWorker version: ISM.2.20.UC1.114;
enabler in use: Yes;

type: NSR client;
name: myserver1;
server: myserver2;
archive services: Disabled;
schedule: Default;
browse policy: 6 Months;
retention policy: 6 Months;
directive: ;
group: ISMData Clone;
save set: /dev/null;
remote access: ;
remote user: ;
password: ;
backup command: ;
aliases: myserver1;
archive users: ;
client OS type: Linux;
CPUs: 1;
NetWorker version: ISM.2.20.UC1.114;
enabler in use: Yes;

type: NSR client;
name: myserver1;
server: myserver2;
archive services: Disabled;
schedule: Default;
browse policy: 6 Months;
retention policy: 6 Months;
directive: ;
group: ISMLogs Clone;
save set: /dev/null;
remote access: ;
remote user: ;
password: ;
backup command: ;
aliases: myserver1;
archive users: ;
client OS type: Linux;
CPUs: 1;
NetWorker version: ISM.2.20.UC1.114;
enabler in use: Yes;
updated resource id 53.0.160.16.217.86.238.73.192.168.138.250(23)
updated resource id 79.0.160.16.217.86.238.73.192.168.138.250(21)
updated resource id 83.0.160.16.217.86.238.73.192.168.138.250(19)
updated resource id 87.0.160.16.217.86.238.73.192.168.138.250(17)
updated resource id 91.0.160.16.217.86.238.73.192.168.138.250(15)
updated resource id 95.0.160.16.217.86.238.73.192.168.138.250(13)
updated resource id 99.0.160.16.217.86.238.73.192.168.138.250(11)

Step3:将数据从ISM复原至目标数据库
1. informix登录

2. 如果informix数据库服务器已联机,则关闭它

[informix@myserver2 ~]$ onmode -ky

3. 为此会话配置以下ISM环境变量(建议root/informix下皆添加)

ISM_CLIENT=myserver1
ISM_SERVER=myserver2
ISM_DATA_VOLUME_POOL=ISMDiskData
ISM_LOG_VOLUME_POOL=ISMDiskLogs
export ISM_CLIENT ISM_SERVER
export ISM_DATA_VOLUME_POOL
export ISM_LOG_VOLUME_POOL

4. 为每个数据池恢复介质数据库

[root@myserver2 tmp]# ism_catalog -recreate_from /usr/backup/ptape
scanner: scanning file disk ISMData on /usr/backup/ptape
scanner: file disk ISMData already exists in the media index
scanner: ssid 1013706528: scan complete
scanner: ssid 1013706528: 93 MB, 1 file(s)
scanner: ssid 1013706527: scan complete
scanner: ssid 1013706527: 63 KB, 1 file(s)
scanner: ssid 1013706531: scan complete
scanner: ssid 1013706531: 5 KB, 7 file(s)
scanner: ssid 1013706525: scan complete
scanner: ssid 1013706525: 3.0 MB, 1 file(s)
scanner: ssid 1013706529: scan complete
scanner: ssid 1013706529: 63 KB, 1 file(s)
scanner: ssid 1013706532: scan complete
scanner: ssid 1013706532: 47 KB, 14 file(s)
scanner: ssid 1013706526: scan complete
scanner: ssid 1013706526: 63 KB, 1 file(s)
scanner: done with file disk ISMData

5. 使介质索引数据库同步

[root@myserver2 tmp]# nsrim -v
myserver1:/home/informix/ism/index/myserver1, retention policy: 6 Months, 1 browsable cycle(s)
1013706531 4/22/09 f 7 files 5 KB browse(scanned in)
7 browsable files of 7 total, 5 KB recoverable of 5 KB total

myserver1:INFORMIX:/online_web_tcp/0/27, retention policy: 6 Months, 1 browsable cycle(s)
1013706530 4/22/09 f 1 files 909 KB browse
1 browsable files of 1 total, 909 KB recoverable of 909 KB total

myserver1:INFORMIX:/online_web_tcp/datadbs/0, retention policy: 6 Months, 1 browsable cycle(s)
1013706528 4/22/09 f 1 files 93 MB browse(scanned in)
1 browsable files of 1 total, 93 MB recoverable of 93 MB total

myserver1:INFORMIX:/online_web_tcp/idxdbs/0, retention policy: 6 Months, 1 browsable cycle(s)
1013706527 4/22/09 f 1 files 63 KB browse(scanned in)
1 browsable files of 1 total, 63 KB recoverable of 63 KB total

myserver1:INFORMIX:/online_web_tcp/logdbs/0, retention policy: 6 Months, 1 browsable cycle(s)
1013706529 4/22/09 f 1 files 63 KB browse(scanned in)
1 browsable files of 1 total, 63 KB recoverable of 63 KB total

myserver1:INFORMIX:/online_web_tcp/phydbs/0, retention policy: 6 Months, 1 browsable cycle(s)
1013706526 4/22/09 f 1 files 63 KB browse(scanned in)
1 browsable files of 1 total, 63 KB recoverable of 63 KB total

myserver1:INFORMIX:/online_web_tcp/rootdbs/0, retention policy: 6 Months, 1 browsable cycle(s)
1013706525 4/22/09 f 1 files 3.0 MB browse(scanned in)
1 browsable files of 1 total, 3.0 MB recoverable of 3.0 MB total

myserver1:bootstrap, retention policy: 6 Months, 1 browsable cycle(s)
1013706532 4/22/09 f 14 files 47 KB browse(scanned in)
14 browsable files of 14 total, 47 KB recoverable of 47 KB total

ISMData: 97 MB used, 7 save sets, read-only, 7 browsable save sets
ISMLogs: 928 KB used, 1 save sets, appendable, 1 browsable save sets

Compressing media db… done.
[root@myserver2 tmp]#

6. 要将介质标记为对于每个卷池是可附加的,完成以下步骤:
# ism_show -devices
# ism_op -unmount device_name
# ism_show -volumes
# ism_config -volume volume_name -only_restore no
# ism_op -mount device_name

[root@myserver2 tmp]# ism_show -devices
(nothing) mounted on 8mm 5GB tape /dev/nrst8
file disk ISMData mounted on /usr/backup/ptape, write enabled
file disk ISMLogs mounted on /usr/backup/ltape, write enabled
[root@myserver2 tmp]# ism_op -unmount /usr/backup/ptape
[root@myserver2 tmp]# ism_op -unmount /usr/backup/ltape
[root@myserver2 tmp]# ism_show -volumes
volume pool flags written (%) expires
ISMData ISMDiskData r 97 MB 100% 04/22/11
ISMLogs ISMDiskLogs 928 KB 100% 04/22/11

[root@myserver2 tmp]# ism_config -volume ISMData -only_restore no
[root@myserver2 tmp]# ism_op -mount /usr/backup/ptape
file disk ISMData mounted on /usr/backup/ptape, write enabled
[root@myserver2 tmp]# ism_op -mount /usr/backup/ltape
file disk ISMLogs mounted on /usr/backup/ltape, write enabled

7) 复原$INFORMIXDIR/etc目录的以下关键文件副本(如果上面已经做到,跳过)
oncfg_source_dbservername.servernum
ixbar.servernum
$ONCONFIG
sqlhosts

8) 更新sqlhosts文件及目标数据库服务器的共享内存设置:
必要时,在sqlhosts文件中更改每行的第一和第四个条目中的数据库服务器名称,将第三个条目的主机名更改为目标主机名

9) 更新ONCONFIG文件并用目标数据库服务器名称替换源数据库服务器名称。

DBSERVERNAME target_dbservername
[root@myserver2 tmp]# cat /home/informix/etc/onconfig_web | grep DBSERVERNAME
DBSERVERNAME online_web_tcp_hdr # Name of default database server

10) 创建新的数据库空间(如果尚未创建)
# 确保它们驻留在与它们在源数据库服务器上相同的路径位置。用户informix和组informix也应拥有这些数据库空间

11) 在目标数据库服务器上执行导入的复原

onbar -r

注:如果是HDR Secondary上的恢复,请执行
onbar -r -p
,见下面2.2节

12) 为日常备份和复原操作重新配置ISM设置
# 不要更改ISM_CLIENT和ISM_SERVER环境变量设置

要点:如果导入的复原由于源主机名不具有访问权的错误而失败,则为本地用户授予许可权来访问源客户机的索引。
创建临时文件(temporary_file),内容如下(空行保留):
print type: NSR client; name: source_hostname

update remote access: informix@target_hostname,
root@target_hostname

# nsradmin -s target_hostname -i temporary_file

1.2 在源计算机上,向sqlhosts文件添加条目以识别目标实例(上面已经做过,跳过)
1.3 执行导入恢复(上面已经做过,跳过)
1.4 将紧急引导文件、oncfg文件、ONCONFIG文件和存储管理器文件从源计算机复制到目标计算机上(上面已经做过,跳过)

2. 要初始化HDR

注意:
要使两台服务器间相互信任,请在$HOME下创建.rhosts文件,内容如下:
myserver1 informix
myserver2 informix

2.1 要在源数据库器上启动HDR
# onmode -d primary serconary_dbservname

[informix@myserver1 etc]$ onmode -d primary online_web_tcp_hdr

可以在数据库服务器消息日志中查看到以下消息:

08:10:19 DR: new type = primary, secondary server name = online_web_tcp_hdr
08:11:40 DR: Cannot connect to secondary server
08:11:40 DR: Turned off on primary server

2.2 在目标计算机上执行仅物理恢复
# onbar -r -p

[informix@myserver2 etc]$ onbar -r -p

2.3 检查数据库服务器消息日志、onbar活动日志和存储管理器错误日志,以查看恢复是否成功
# 查看${INFORMIXDIR}/online.log、${INFORMIXDIR}/bar_act.log
实际操作过程中,在恢复后出现如下提示:
2009-05-14 14:04:57 2986 2984 SQL -349 Database not selected yet.
2009-05-14 14:04:57 2986 2984 /home/informix/bin/onbar_d complete, returning 148 (0x94)
原因未知,从我实际的配置来看,对HDR配置好像没有影响。这一点很奇怪,如果有人知道原因及解决办法,请不吝赐教!

2.4 要在目标数据库服务器上启动HDR
# onmode -d secondary primary_dbservername

[informix@myserver2 etc]$ onmode -d secondary online_web_tcp

2.5 如果同步两个数据库服务器所需的逻辑日志仍然在源数据库服务器上,则目标数据器从源数据库服务器上检索它们

2.6 数据库服务器同步过程中,逻辑日志将自动从源服务器传送到目标服务器。

2.7 如果逻辑日志不在数据库服务器上,则会提示您恢复所需的逻辑日志。如果目标数据数据库服务器需要的日志编号因为被覆盖而不再存在时,onbar将从备份检索该逻辑日志

3. 检查及测试HDR运行状态
# onstat -m
# 测试在主服务器上创建数据库、表等,查看从服务器是否正常同步

发表回复