AIX环境下实现DB2向Windows 2000迁移

2019-02-15 18:24

DB2数据库实现从AIX系统向Win2000迁移

◆1、Win下打开DB2 CLP,连接到AIX上数据库(ZJGL)db2 connect to zjgl user zjgl using zjgl

◆2、用db2look导出建库表的SQL脚本。

db2 db2look -d 数据库 -i 用户 -w 密码 -e -c -o c:zjgllook.sql;不指定路径,默认保存在..SQLLIBin下

更改zjgllook.sql脚本,更改连接数据库名,去掉IN \\\INDEX IN \\\和IN \\\内容,把脚本中数据库名两边双引号去掉。 ◆3、在Win下DB2建立数据库ZJDEP,采用AIX上ZJGL的脚本保存未zjdep.sql

CREATE DATABASE zjdep ON 'd:' ALIAS zjdep

USING CODESET ISO8859-1 TERRITORY US

COLLATE USING Compatibility NUMSEGS 1 DFT_EXTENT_SZ 32

CATALOG TABLESPACE MANAGED BY SYSTEM USING

('d:db2NODE0000SQL00001SQLT0000.0' )

EXTENTSIZE 32 PREFETCHSIZE 32 OVERHEAD 24.10

TRANSFERRATE 0.90

USER TABLESPACE MANAGED BY SYSTEM USING

('d:db2NODE0000SQL00001SQLT0002.0' )

EXTENTSIZE 32 PREFETCHSIZE 32 OVERHEAD 24.10 TRANSFERRATE 0.90

TEMPORARY TABLESPACE MANAGED BY SYSTEM USING

('d:db2NODE0000SQL00001SQLT0001.0' )

EXTENTSIZE 32 PREFETCHSIZE 32 OVERHEAD 24.10 TRANSFERRATE 0.90; ◆4、在DB2 CLP下

执行:db2 connect to zjdep

而后执行:db2 -tvf d:zjgllook.sql (在批处理中执行DB2的SQL脚本文件)

DB2跨平台备份与恢复

跨平台

一、DB29.1 For AIX操作系统数据库跨平台迁移至DB29.1 For Windows操作系统的方法 由于跨平台进行数据库的备份,因此需要使用db2move和db2look命令,对不同平台的DB2数据进行转

移.

首先在AIX操作系统下,进行数据库的备份.

运行db2命令窗口

db2cmd 运行

db2命令,进入命令行处理器界面,在此界面下,可以执行db2的日常命令.

Db2->

Db2move nc5011 export

Db2look –d nc5011 –a –e –x –o create.sql

…………

数据库备份后,会生成上述文件.

重构数据库时,如果想修改表的SCHEMA和TABLESPACE,可以直接修改create.sql文件中tablespace脚本和db2move.lst文件中的schema脚本, 即修改示例中的db2admin为指定的schema即可。

db2move.lst的内容示例:

!\!\

说明:

db2admin 表示schema名称

ebank_dfdk_loh_h 表示导出的数据库表的名称

tab250.ixf 表示导出的数据文件 tab251.msg 表示导出数据时的输出信息

Db2look参数说明:

-d DBname :数据库名称,这是必须的.

-e :抽取数据库对象的DDL,这个参数是必须的.对象包括Tables |Views | Automatic summary

tables (AST) | Aliases | Indexes |

Triggers | Sequences | User-defined distinct types | Primary key, referential integrity, and check constraints | User-defined structured types | User-defined functions | User-defined

methods |

User-defined transforms | Wrappers | Servers | User mappings | Nicknames | Type mappings

|

Function templates | Function mappings | Index specifications | 7 Stored procedures.

注意抽取的stored procedures的没有明细内容 -u Creator :指定用户.如果和-a同时使用,-u被忽略. -z schema :指定模式.如果和-a同时使用,-z被忽略.

-t Tname1 Tname2 ... TnameN :表的名称.N的最大数是30个,如果要区分大小写格式如\否则会认为是MY_TABLE.如果table name间有空格还有小写字符格式如\ -tw Tname :模糊查询表的名称.通配符-代表任意字符,%代表任意好多个字符及字符串.使用-tw参

数时,-t参数会被忽略.

-v Vname1 Vname2 ... VnameN :视图名称.N的最大数是30个.-t的参数被指定时,-v参数会被

忽略. -h :help

-o :输出到文件的名称.

-a :所有的用户和模式.-a -u都没有指定时,使用当前登陆用户.

-m :生成对表的列表和索引统计的update语句.-m被指定时, -p, -g, and -s被忽略.

-c :不生成COMMIT, CONNECT and CONNECT |RESET 语句.-c需要和-m联合使用,如果没有指

定-m ,-c不起作用.

-r :不生成 RUNSTATS command.-r需要和-m联合使用,如果没有指定-m ,-r不起作用. -l :定义表空间的DDL.User-defined table spaces | User-defined database partition groups |

User-defined buffer pools. -x :生成授权的DDL. -xd:表/视图上的权限语句 -f :数据库和“数据库管理器”配置参数

-td :指定定界符,默认的为分号;.使用时-td后加空格 如:-td @.

-noview :If this option is specified, CREATE VIEW DDL statements will not be |extracted

-i :userid.当远程登陆时使用. -w assword 远程登陆的用户密码.

db2move 参数说明:

*** Please read the DB2 Administration Guide for more info!

--------db2move - database movement tool--------

Usage: \

is the name of the database.

is one of:

EXPORT - Export all tables that meet the filtering criteria in [options]

(If no [options] specified, export all tables).

Internal staging information is stored in file 'db2move.lst'.

Messages are stored in 'EXPORT.msg'.

IMPORT - Import all tables listed in the staging file 'db2move.lst'.

Messages are stored in 'IMPORT.msg'.. Use the -io option for IMPORT specific actions.

LOAD - Load all tables listed in the staging file 'db2move.lst'.

Messages are stored in 'LOAD.msg'. Use the -lo option for LOAD specific actions.

COPY - Duplicate a schema(s) into a target database. Use the -sn option to specify one or more schemas.

See the -co option for COPY specific options.

Use the -tn or -tf option to filter tables in LOAD_ONLY mode.

Messages are stored in 'COPY..msg' Error only messages in 'COPY..err' Load messages in 'LOADTABLE..msg'

List of tables that failed Load in 'LOADTABLE..err'

[options] are one or more of:

Option Description Use for Notes

Action

------------------------------------------------------------------------ -tc Table Definers. Filter on EXPORT Comma seperated list, SYSCAT.TABLES.DEFINER Wildcard (*) allowed.

-tn Table Names. Filter on EXPORT Comma seperated list, SYSCAT.TABLES.TABNAME COPY Wildcard (*) allowed for

EXPORT (not COPY).

-sn Schema Names. Filter on EXPORT, Comma seperated list,


AIX环境下实现DB2向Windows 2000迁移.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:120平方的装修合同(12万左右)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: