使用WebSphere中间件构建数据库环境

http://tech.ddvip.com   2007年07月03日    社区交流

内容摘要:本文向您介绍使用 IBM WebSphere® Application Server Network Deployment V6.1 作为客户端应用程序并利用 DB2 HADR 和自动客户端重新路由功能构建高可用性数据库环境的步骤。

  清单 4. 主要计算机上的备份数据库>cd tmpdir
>db2 backup db sample
Backup successful. The timestamp for this backup image is :20061101161943

  将主要机计算机上生成的备份文件传输到备用计算机。要将数据库还原到备用计算机,请使用您的 DB2 用户 ID 登录到备用计算机。下面的命令将把数据库还原到备用计算机上(清单 5)。您需要对每个数据库重复此命令:

  db2 restore db <database_name> from <temp_restore_directory> replace history file

  清单 5. 将数据库还原到备用计算机上>cd tmpdir
>db2 restore db sample replace history file
     
DB20000I The RESTORE DATABASE command completed successfully.

  在将所有数据库还原到备用计算机上之后,必须将清单 6 中所示的用于各个数据库的所有 DB2 HADR 变量从主要 DB2 服务器复制到备用服务器。从备用 DB2 服务器的角度看,主要 DB2 服务器就是远程主机。因此,您需要修改备用计算机上的 hadr_local_host、hadr_remote_host、hadr_local_svc 和 hadr_remote_svc 值。另外,必须更新自动客户端重新路由,以指向主要计算机。

  请注意,端口 60000 是主要计算机上的 DB2 实例端口号。

  清单 6. 备用计算机上 Sample 数据库的 HADR 变量>db2 update db cfg for Sample using hadr_local_host   <standby machine IP address>
>db2 update db cfg for Sample using hadr_remote_host  <primary machine IP address>
>db2 update db cfg for Sample using hadr_local_svc   ha_sample_int
>db2 update db cfg for Sample using hadr_remote_svc   ha_sample
>db2 update alternate server for database Sample using hostname <Primary machine IP
address> port 60000

来源:ibm.com    作者:Li-Fang Lee    责编:豆豆技术应用

正在加载评论...