ITPub博客

首页 > 数据库 > 数据库开发技术 > db2 9 new feature:db2move dbname COPY

db2 9 new feature:db2move dbname COPY

原创 数据库开发技术 作者:orapkdb2 时间:2007-05-13 17:41:49 0 删除 编辑

db2move增加新特性 db2move dbname COPY
可以将schema 及其拥有的数据copy到目标库中

db2sampl -name sample -schema schema1


db2move sample COPY -sn schema1 -co target_db test user schema1 using password schema_map "((schema1,test))"


db2 create db testdb using codeset utf-8 territory us

db2 "CREATE LARGE TABLESPACE largetbs PAGESIZE 4096 MANAGED BY DATABASE USING (FILE 'd:db2tbslargetbs.dat' 50M)"


db2move sample COPY -sn schema1 -co target_db testdb user schema1 using password schema_map "((schema1,test))" TABLESPACE_MAP "((ibmdb2samplerel,largetbs),(ibmdb2samplexml,largetbs), SYS_ANY))"

notice:因为sample codepage为utf-8,而且对于db2 9,只支持 UTF-8 数据库使用 XML 数据。

为创建 UTF-8 数据库,发出 create db testdb using codeset utf-8 territory us 命令。

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

Usage: "db2move [options]"

is the name of the database.

is one of:

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'

-co COPY specific options. COPY See options listed below.

TARGET_DB [USER [USING ]
This mandatory option specifies the target database (and optional
user/passwd) where the schema(s) will be created. (Default
user/passwd are current user/passwd).
MODE
The mode is one of DDL_AND_LOAD (default), DDL_ONLY, or LOAD_ONLY.
SCHEMA_MAP
To rename the schema on the target db. For example, to rename schema
'srcsch1' to 'tgtsch1', and schema 'srcsch2' to 'tgtsch2', use:
"((srcsch1,tgtsch1), (scrsch2,tgtsch2))".
TABLESPACE_MAP
To override tablespaces on the target db. For example, to
recreate all tables that reside in TS1 on the source db, into TS2 on
the target db, and all other tablespaces to use the default tablespace
on the target, use: "((TS1,TS2), SYS_ANY)".
NONRECOVERABLE
To override the default Load recoverability action COPY-NO, to
NONRECOVERABLE.
OWNER
To override the owner of each new object created on the target db.
example:
Use db2move to duplicate schema 'schema1' from source database 'dbsrc'
to target database 'dbtgt', rename the schema to 'newschema1' on the
target, and map source tablespace 'ts1' to 'ts2' on the target:
>db2move dbsrc COPY -sn schema1 -co TARGET_DB dbtgt
USER myuser1 USING mypass1 SCHEMA_MAP ((schema1,newschema1))
TABLESPACE_MAP ((ts1,ts2), SYS_ANY))

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9419303/viewspace-914856/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论
  • 博文量
    2
  • 访问量
    2122