同种平台之间的移植
备份与恢复
db2 force applications all
db2 backup db ldapdb2 to directory_or_device
db2 restore db ldapdb2 from directory_or_device replace existing
异种平台之间的移植
把指定用户及其模式下的DDL导出(包括视图、表、存储过程、函数、序列等)
DB2LOOK -D MDB -E -U USER -Z S-SCHEMA -I USERID -W PASS -O C:/AAA
-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/",否则会认为是MY_TABLE.如果table name间有空格还有小写字符格式如"/"My Table/""
-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 远程登陆的用户密码.
-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/",否则会认为是MY_TABLE.如果table name间有空格还有小写字符格式如"/"My Table/""
-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 MDB EXPORT -U USERID -P PASS -SN S—SCHEMA