db2look -h
db2look: Generates DDLs to recreate the objects defined in a database
Syntax: db2look -d DBname [-e] [-xs] [-xdir Path] [-u Creator] [-z Schema]
[-t Tname1 Tname2...TnameN] [-tw Tname] [-h]
[-o Fname] [-a] [-m] [-c] [-r] [-l] [-x] [-xd] [-f]
[-fd] [-td x] [-noview] [-i userID] [-w password]
[-v Vname1 Vname2 ... VnameN] [-dp] [-ct]
[-wrapper WrapperName] [-server ServerName] [-nofed]
[-wlm] [-ap]
[-wrapper WrapperName] [-server ServerName][-fedonly]
[-nofed]
db2look [-h]
-d: Database Name: This must be specified
-e: Extract DDL file needed to duplicate database
This option generates a script. containing DDL statements
This script. can be ran against another database to recreate database objects
This option can be used in conjunction with the -m option
-xs: Export XSR objects and generate a script. containing DDL statements
This script. can be run against another database to re-register the XSR objects
The set of XSR objects is specified using the -u, -z, and -a options
-xdir: Path name: the directory in which XSR objects will be placed
If not specified, the current directory is used
This option is ignored if the -xs option is not specified
-u: Creator ID: If -u and -a are both not specified then $USER will be used
If the -a option is specified then the -u option will be ignored
-z: Schema name: If -z and -a are both specified then -z will be ignored
Schema name is ignored for the Federated Section
-t: Generate statistics for the specified tables
The maximum number of tables that can be specified is 30
-tw: Generate DDLs for tables whose names match the pattern criteria (wildcard characters) of the table name
The -t option is ignored when -tw is specified
-ap: Generate AUDIT USING Statements
-wlm: Generate WLM specific DDL Statements
These include ddls for Histograms, Service Classes, Workloads,
Thresholds, Work Class Sets, Work Action Sets and WLM Event monitors
This option can be used along with -e and -x/xd options
-v: Generate DDL for view only, this option is ignored when -t is specified
-dp: Generate DROP statement before CREATE statement
-h: More detailed help message
-o: Redirects the output to the given file name
If the -o option is not specified then output goes to stdout
-a: Generate statistics for all creators
If this option is specified then the -u option will be ignored
-m: Run the db2look utility in mimic mode
This option generates a script. containing SQL UPDATE statements
These SQL UPDATE statements capture all the statistics
This script. can be run against another database to replicate the original one
When the -m option is specified, the -p,-g and -s options are ignored
-c: Do not generate COMMIT statements for mimic
This option will be ignored unless -m or -e is specified
CONNECT and CONNECT RESET statements will not be generated as well
COMMIT is omitted. Explicit commit is required after executing the script.
-r: Do not generate RUNSTATS statements for mimic
The default is RUNSTATS. This option is only valid when -m is specified
-l: Generate Database Layout: Database partition groups, Bufferpools and Tablespaces
-x: If this option is specified, the db2look utility will generate authorization DDL
for existing granted privileges, excluding the original definer of the object
-xd: If this option is specified, the db2look utility will generate authorization DDL
for existing granted privileges, including the original definer of the object
-f: Extract configuration parameters and environment variables
If this option is specified, -wrapper and -server options will be ignored
-fd: Generates db2fopt statements for opt_buffpage and opt_sortheap along with other cfg and env parameters.
-td: Specifies x to be statement delimiter (default is semicolon(;))
Should be used with -e option if triggers or SQL routines present
-i: User ID to log on to the server where the database resides
-w: Password to log on to the server where the database resides
-noview: Do not generate CREATE VIEW ddl statements
-wrapper: Generates DDLs for federated objects that apply to this wrapper
The generated objects may include the following:
Wrappers, servers, user mappings, nicknames, type mappings,
function templates, function mappings, and index specifications
-server: Generates DDLs for federated objects that apply to this server
The generated objects may include the following:
Wrappers, servers, user mappings, nicknames, type mappings,
function templates, function mappings, and index specifications
-fedonly: Only created Federated DDL Statements
-nofed: Do not generate Federated DDL
If this option is specified, -wrapper and -server options will be ignored
-ct: Generate DDL Statements by object creation time
LaTeX Typeseting: latex filename.tex to obtain filename.dvi
Example: db2look -d DEPARTMENT -u walid -e -o db2look.sql
-- This generates DDL statements for all tables and federated objects created by user WALID
-- The db2look output is sent to a file called db2look.sql
Example: db2look -d DEPARTMENT -z myscm1 -e -o db2look.sql
-- This generates DDL statements for all tables with schema name MYSCM1
-- DDLs for all federated objects created by $USER will also be generated
-- The db2look output is sent to a file called db2look.sql
Example: db2look -d DEPARTMENT -u walid -m -o db2look.sql
-- This generates UPDATE statements to capture statistics on tables/nicknames created by user WALID
-- The db2look output is sent to a file called db2look.sql
Example: db2look -d DEPARTMENT -u walid -e -wrapper W1 -o db2look.sql
-- This generates DDL statements for all tables created by user WALID
-- DDLs for all federated objects created by user WALID that apply to the wrapper W1 will also be generated
-- The db2look output is sent to a file called db2look.sql
Example: db2look -d DEPARTMENT -u walid -e -server S1 -o db2look.sql
-- This generates DDL statements for all tables created by user WALID
-- DDLs for all federated objects created by user WALID that apply to the server S1 will also be generated
-- The db2look output is sent to a file called db2look.sql
登录远程数据库查看指定表的DDLs
db2look -d {db_name} -t {table_names 用空格分隔} -z {schema_name} -e -i {user_name} -w {password}
db2look: Generates DDLs to recreate the objects defined in a database
Syntax: db2look -d DBname [-e] [-xs] [-xdir Path] [-u Creator] [-z Schema]
[-t Tname1 Tname2...TnameN] [-tw Tname] [-h]
[-o Fname] [-a] [-m] [-c] [-r] [-l] [-x] [-xd] [-f]
[-fd] [-td x] [-noview] [-i userID] [-w password]
[-v Vname1 Vname2 ... VnameN] [-dp] [-ct]
[-wrapper WrapperName] [-server ServerName] [-nofed]
[-wlm] [-ap]
[-wrapper WrapperName] [-server ServerName][-fedonly]
[-nofed]
db2look [-h]
-d: Database Name: This must be specified
-e: Extract DDL file needed to duplicate database
This option generates a script. containing DDL statements
This script. can be ran against another database to recreate database objects
This option can be used in conjunction with the -m option
-xs: Export XSR objects and generate a script. containing DDL statements
This script. can be run against another database to re-register the XSR objects
The set of XSR objects is specified using the -u, -z, and -a options
-xdir: Path name: the directory in which XSR objects will be placed
If not specified, the current directory is used
This option is ignored if the -xs option is not specified
-u: Creator ID: If -u and -a are both not specified then $USER will be used
If the -a option is specified then the -u option will be ignored
-z: Schema name: If -z and -a are both specified then -z will be ignored
Schema name is ignored for the Federated Section
-t: Generate statistics for the specified tables
The maximum number of tables that can be specified is 30
-tw: Generate DDLs for tables whose names match the pattern criteria (wildcard characters) of the table name
The -t option is ignored when -tw is specified
-ap: Generate AUDIT USING Statements
-wlm: Generate WLM specific DDL Statements
These include ddls for Histograms, Service Classes, Workloads,
Thresholds, Work Class Sets, Work Action Sets and WLM Event monitors
This option can be used along with -e and -x/xd options
-v: Generate DDL for view only, this option is ignored when -t is specified
-dp: Generate DROP statement before CREATE statement
-h: More detailed help message
-o: Redirects the output to the given file name
If the -o option is not specified then output goes to stdout
-a: Generate statistics for all creators
If this option is specified then the -u option will be ignored
-m: Run the db2look utility in mimic mode
This option generates a script. containing SQL UPDATE statements
These SQL UPDATE statements capture all the statistics
This script. can be run against another database to replicate the original one
When the -m option is specified, the -p,-g and -s options are ignored
-c: Do not generate COMMIT statements for mimic
This option will be ignored unless -m or -e is specified
CONNECT and CONNECT RESET statements will not be generated as well
COMMIT is omitted. Explicit commit is required after executing the script.
-r: Do not generate RUNSTATS statements for mimic
The default is RUNSTATS. This option is only valid when -m is specified
-l: Generate Database Layout: Database partition groups, Bufferpools and Tablespaces
-x: If this option is specified, the db2look utility will generate authorization DDL
for existing granted privileges, excluding the original definer of the object
-xd: If this option is specified, the db2look utility will generate authorization DDL
for existing granted privileges, including the original definer of the object
-f: Extract configuration parameters and environment variables
If this option is specified, -wrapper and -server options will be ignored
-fd: Generates db2fopt statements for opt_buffpage and opt_sortheap along with other cfg and env parameters.
-td: Specifies x to be statement delimiter (default is semicolon(;))
Should be used with -e option if triggers or SQL routines present
-i: User ID to log on to the server where the database resides
-w: Password to log on to the server where the database resides
-noview: Do not generate CREATE VIEW ddl statements
-wrapper: Generates DDLs for federated objects that apply to this wrapper
The generated objects may include the following:
Wrappers, servers, user mappings, nicknames, type mappings,
function templates, function mappings, and index specifications
-server: Generates DDLs for federated objects that apply to this server
The generated objects may include the following:
Wrappers, servers, user mappings, nicknames, type mappings,
function templates, function mappings, and index specifications
-fedonly: Only created Federated DDL Statements
-nofed: Do not generate Federated DDL
If this option is specified, -wrapper and -server options will be ignored
-ct: Generate DDL Statements by object creation time
LaTeX Typeseting: latex filename.tex to obtain filename.dvi
Example: db2look -d DEPARTMENT -u walid -e -o db2look.sql
-- This generates DDL statements for all tables and federated objects created by user WALID
-- The db2look output is sent to a file called db2look.sql
Example: db2look -d DEPARTMENT -z myscm1 -e -o db2look.sql
-- This generates DDL statements for all tables with schema name MYSCM1
-- DDLs for all federated objects created by $USER will also be generated
-- The db2look output is sent to a file called db2look.sql
Example: db2look -d DEPARTMENT -u walid -m -o db2look.sql
-- This generates UPDATE statements to capture statistics on tables/nicknames created by user WALID
-- The db2look output is sent to a file called db2look.sql
Example: db2look -d DEPARTMENT -u walid -e -wrapper W1 -o db2look.sql
-- This generates DDL statements for all tables created by user WALID
-- DDLs for all federated objects created by user WALID that apply to the wrapper W1 will also be generated
-- The db2look output is sent to a file called db2look.sql
Example: db2look -d DEPARTMENT -u walid -e -server S1 -o db2look.sql
-- This generates DDL statements for all tables created by user WALID
-- DDLs for all federated objects created by user WALID that apply to the server S1 will also be generated
-- The db2look output is sent to a file called db2look.sql
登录远程数据库查看指定表的DDLs
db2look -d {db_name} -t {table_names 用空格分隔} -z {schema_name} -e -i {user_name} -w {password}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11976525/viewspace-676657/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11976525/viewspace-676657/