Syntax: db2look -d DBname [-e] [-xs] [-xdir Path] [-u Creator] [-z Schema]
[-t Tname1 Tname2...TnameN] [-tw Tname] [-xdep] [-xddep]
[-o Fname] [-a] [-m] [-c] [-r] [-l] [-x] [-xd] [-f] [-h]
[-fd] [-td x] [-noview] [-i userID] [-w password]
[-v Vname1 Vname2 ... VnameN] [-dp] [-ct]
[-wrapper WrapperName] [-server ServerName] [-nofed]
[-wlm] [-ap] [-mod] [-cor] [-wrap] [-noimplschema] [-nostatsclause]
[-wrapper WrapperName] [-server ServerName][-fedonly] [-nofed]
--生成 数据库 testdb 中 模式 peter 的所有对象的 DDL,输出被存储在 alltables.sql 中。
db2look -d testdb -z peter -e -o all_objects.sql
--生成模式db2inst1下的表 t1和t2 的ddl
db2look -d sample -z db2inst1 -t t1 t2 -e -o t1.ddl
--数据库 sample DDL
db2look -d sample -a -e -l -x -f -o db2look.sql
* 数据库 sample 中所有对象的 DDL(由 -d、-a 和 -e 选项指定)。
* GRANT 授权语句(由选项 -x 指定)。
* 用于数据库管理器和数据库配置参数的 UPDATE 语句和用于概要注册表的 db2set 命令(由选项 -f 指定)。
--In the testdb database, the command extracts the DDL from the staff, department, and
employee tables, and generates UPDATE statements used to replicate statistics of the
tables and the associated runstats commands.
db2look –d testdb –t staff department employee –m -r
[-t Tname1 Tname2...TnameN] [-tw Tname] [-xdep] [-xddep]
[-o Fname] [-a] [-m] [-c] [-r] [-l] [-x] [-xd] [-f] [-h]
[-fd] [-td x] [-noview] [-i userID] [-w password]
[-v Vname1 Vname2 ... VnameN] [-dp] [-ct]
[-wrapper WrapperName] [-server ServerName] [-nofed]
[-wlm] [-ap] [-mod] [-cor] [-wrap] [-noimplschema] [-nostatsclause]
[-wrapper WrapperName] [-server ServerName][-fedonly] [-nofed]
-d Database Name: This must be specified
-a 所有用户下的对象
-e Extract DDL file needed to duplicate database
-o Redirects the output to the given file name
-t tabname,tabname2 表名,最多30个
-tw tname 匹配表名含有 tname ,_ 任意单个字符,% 包含零个或零个以上任意字符。 忽略 -t 选项
-l Generate Database Layout: Database partition groups, Bufferpools and Tablespaces
-x Generate Authorization statements DDL excluding the original definer of the object
-z schema_name 模式 If -z and -a are both specified then -z will be ignored
-u 创建者 Creator ID: If -u and -a are both not specified then $USER will be used
-f Extract configuration parameters and environment variables
-m UPDATE 语句,用于复制数据库中所有表和索引的统计信息。
-a 所有用户下的对象
-e Extract DDL file needed to duplicate database
-o Redirects the output to the given file name
-t tabname,tabname2 表名,最多30个
-tw tname 匹配表名含有 tname ,_ 任意单个字符,% 包含零个或零个以上任意字符。 忽略 -t 选项
-l Generate Database Layout: Database partition groups, Bufferpools and Tablespaces
-x Generate Authorization statements DDL excluding the original definer of the object
-z schema_name 模式 If -z and -a are both specified then -z will be ignored
-u 创建者 Creator ID: If -u and -a are both not specified then $USER will be used
-f Extract configuration parameters and environment variables
-m UPDATE 语句,用于复制数据库中所有表和索引的统计信息。
-r 不收集统计信息
If you specify this option with the -m parameter, the db2look command does not generate the RUNSTATS command.
The default action is to generate the RUNSTATS command.
-fd Generates db2fopt statements for opt_buffpage and opt_sortheap along with other cfg and env parameters.
db2look -d testdb -z peter -e -o all_objects.sql
--生成模式db2inst1下的表 t1和t2 的ddl
db2look -d sample -z db2inst1 -t t1 t2 -e -o t1.ddl
--数据库 sample DDL
db2look -d sample -a -e -l -x -f -o db2look.sql
* 数据库 sample 中所有对象的 DDL(由 -d、-a 和 -e 选项指定)。
* GRANT 授权语句(由选项 -x 指定)。
* 用于数据库管理器和数据库配置参数的 UPDATE 语句和用于概要注册表的 db2set 命令(由选项 -f 指定)。
--In the testdb database, the command extracts the DDL from the staff, department, and
employee tables, and generates UPDATE statements used to replicate statistics of the
tables and the associated runstats commands.
db2look –d testdb –t staff department employee –m -r
--生成表空间及分区组等信息
db2look -d testdb -l -o 1.out
db2look -d testdb -l -o 1.out
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22661144/viewspace-1477202/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22661144/viewspace-1477202/