linux – 恢复DB2数据库

linux – 恢复DB2数据库,第1张

概述无论如何要将在 Windows XP中进行备份的db2数据库还原到linux机器上吗? 我在两个 *** 作系统上使用相同版本的db2 – > DB2 Express-C 9.7 源 *** 作系统:Windows XP SP2 目标 *** 作系统:Ubuntu 9.04 IBM有针对此方案的文档.请参阅DeveloperWorks上的此页面: Using DB2 utilities to clone database 无论如何要将在 Windows XP中进行备份的db2数据库还原到linux机器上吗?
我在两个 *** 作系统上使用相同版本的db2 – > DB2 Express-C 9.7
源 *** 作系统:windows XP SP2
目标 *** 作系统:Ubuntu 9.04解决方法 IBM有针对此方案的文档.请参阅DeveloperWorks上的此页面: Using DB2 utilities to clone databases across different platforms

Summary: Two DB2 utilitIEs,db2move
and db2look,can be used to clone
databases when there is no support for
cross-platform backup and restore
operations. This article provIDes an
overvIEw of these utilitIEs and gives
a step-by-step example of how to clone
a DB2 database using this approach.

我已经使用了类似的过程(涉及db2move)将DB2数据库从windows传输到AIX,反之亦然.

Introduction

DB2’s native backup utility creates a backup image that is not portable from W2K to AIX or back. This document presents the procedures required for moving any DB2 database from one platform to the other.

Assumptions

For purposes of example,this document assumes that the database to be ported from W2K (source platform) to AIX (target platform) is MYDB.

Procedure Details

Run the db2look command for MYDB database to generate the DDL for the MYDB database.

db2look -d mydb -e –l –x -o mydb_create.sql

Create a directory in which to store the logical backup of the source database MYDB.

mkdir backup

Change to the new directory,and create the logical backup using the db2move utility

cd backup
db2move mydb export

Transfer the backup of the database and DDL script from Source to Destination. Transfer mydb_create.sql in ASCII mode,and all backuP*.ixf files in binary mode.

The following steps are to be performed on the target platform.

Split the mydb_create.sql script into two scripts. The first is named mydb_tables.sql,and should contain all alias,table,and vIEw creation commands. The second script is to be named mydb_ri.sql,and picks up where the first stopped,including check and foreign key constraints and grants. Make sure that both scripts have a CONNECT command at the top,and COMMIT,CONNECT reset,and TERMINATE commands at the end.

Edit the mydb_tables.sql and ensure that any user tablespaces use only relative path names. If absolute path names are used,the database cannot be restored multiple times on the same system without a REDIRECTED RESTORE.

Create an empty MYDB database.

create db mydb

Run the mydb_tables.sql script to create aliases,tables,and vIEws.

db2 –tvf mydb_tables.sql > mydb_tables.out

RevIEw mydb_tables.out for errors. An easy method of doing this is to run the following command.

grep sql0 mydb_tables.out|grep –v sql0403W|grep –v sql0598W|more

import the data to the tables (the INSERT option can be used instead of REPLACE,but REPLACE is rerunnable).

db2move mydb load -lo replace

Run the mydb_ri.sql script to create referential integrity constraints,etc.

db2 –tvf mydb_ri.sql > mydb_ri.out

RevIEw mydb_ri.out for errors. An easy method of doing this is to run the following command.

grep sql0 mydb_ri.out|grep –v sql0403W|grep –v sql0598W|more

Verify that the source and target databases are IDentical.

总结

以上是内存溢出为你收集整理的linux – 恢复DB2数据库全部内容,希望文章能够帮你解决linux – 恢复DB2数据库所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1037490.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存