Run the db2look command to obtain the DDL script of the database object.

Source: Internet
Author: User
We use the db2look command to obtain the database object's DDL script DB2's db2look command interpretation: db2look version 8.2db2look: generate the DDL to recreate

We use the db2look command to obtain the database object's DDL script DB2's db2look command interpretation: db2look version 8.2 db2look: generate the DDL to recreate

Run the db2look command to obtain the DDL script of the database object.
DB2's db2look command is interpreted as follows:
Db2look 8.2
Db2look: Generate DDL to recreate objects defined in the database
Syntax: db2look-d DBname [-e] [-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]
[-Wrapper WrapperName] [-server ServerName] [-nofed]

Db2look-d DBname [-u Creator] [-s] [-g] [-a] [-t Tname1 Tname2.... TnameN]
[-P] [-o Fname] [-I userID] [-w password]
Db2look [-h]

-D: Database Name: This must be specified

-E: extract the DDL files required for database replication.
This option will generate scripts containing DDL statements
You can run this script on another database to recreate the database object.
This option can be used with the-m Option
-U: ID of the program to be created: If-u and-a are not specified, $ USER is used.
If the-a option is specified, the-u option is ignored.
-Z: Mode name: if both-z and-a are specified,-z is ignored.
The Mode name of the union is ignored.
-T: Generate Statistics for the specified table
You can specify a maximum of 30 tables.
-Tw: generates DDL statements for tables whose names match the table's schema condition (wildcard ).
If the-tw option is specified, the-t option is ignored.
-V: Only DDL is generated for the view. This option is ignored when-t is specified.
-H: More Detailed Help messages
-O: redirects the output to the specified file name.
If the-o option is not specified, the output is forwarded to stdout.
-A: generate statistics for all created programs
If this option is specified, the-u option is ignored.
-M: run the db2look utility in simulated mode.
This option generates a script containing the SQL UPDATE statement.
These SQL UPDATE statements capture all statistics
You can run this script on another database to copy the initial one.
If the-m option is specified, the-p,-g, and-s options are ignored.
-C: do not generate a simulated COMMIT statement
This option is ignored unless-m or-e is specified.
CONNECT and connect reset statements will not be generated
COMMIT is omitted. After the script is executed, it must be implemented explicitly.
-R: do not generate a simulated RUNSTATS statement.
The default value is RUNSTATS. This option is valid only when-m is specified.
-L: generate the database layout: database partition group, buffer pool, and tablespace.
-X: If this option is specified, the db2look utility generates the authorization DDL
For existing authorized privileges, excluding the object's original definer
-Xd: If this option is specified, the db2look utility generates the authorization DDL
For existing authorized privileges, including the object's original definer
-F: Extracts configuration parameters and environment variables.
If this option is specified, the-wrapper and-server options are ignored.
-Fd: generates the db2fopt statement for opt_buffpage, opt_sortheap, and other configuration and environment parameters.
-Td: Specify x as the statement delimiter (the default Delimiter is semicolon (;))
It should be used with the-e Option (if the trigger or SQL routine exists)
-P: in plaintext format
-S: generate a postscript File
This option will generate a postscript file for you
When this option is set, all latex and tmp ps files are removed.
Required (non-IBM) software: LaTeX and dvips
Note: The file psfig. tex must be in the LaTeX input path.
-G: displays index page access pairs using graphs.
Gnuplot must be installed and Must be in your LaTeX input path
It will also be generated along with the LaTeX File File
-I: the user ID used to log on to the server where the database resides.
-W: The password used to log on to the server where the database resides.
-Noview: do not generate the create view ddl statement.
-Wrapper: Generate DDL for the Union object that applies to this wrapper
The generated object may contain the following items:
Package, server, user ing, nickname, type ing,
Function templates, function ing, and index specifications
-Server: Generate DDL statements for the associated objects on this server.
The generated object may contain the following items:
Package, server, user ing, nickname, type ing,
Function templates, function ing, and index specifications
-Nofed: do not generate Federated DDL
If this option is specified, the-wrapper and-server options are ignored.

LaTeX layout: latex filename. tex to get filename. dvi

Example: db2look-d DEPARTMENT-u walid-e-o db2look. SQL

-- This generates DDL statements for all tables and associated objects created by user WALID.
-- The db2look output is sent to a file named db2look. SQL.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.