Sunday, April 17, 2005

  • DB2Look

    "LOOKing forward with hope is the first step in the Journey of Life"

    DB2 is a "DB2 Statistics and DDL Extraction Tool". Extracts the required DDL statements to reproduce the database objects of a production database on a test database. This tool can also generate the required UPDATE statements used to replicate the statistics on the objects in a test database, as well as the update database configuration and update database manager configuration parameters and the db2set statements so that the registry variables and configuration parameter settings on the test database match those of the production database.

    Authorization
    SELECT privilege on the system catalogs.

    Sample

    db2look -d department -u Prabhu -t staff -e -o db2look.sql

    The above example generates the DDL statements for table STAFF created by user Prabhu in database DEPARTMENT. The db2look output is sent to file db2look.sql .


    Important Parameters for DB2Look Command

    -d DBname : Database Name / Alias Name of the database from where the statistics and DDL are to be generated.

    -u Creator : Creator ID. Limits output to objects with this creator id.

    -a All Objects : When this option is specified the output is not limited to the objects created under a particular creator ID.

    -h Display help information: When this option is specified, all other options are ignored, and only the help information is displayed.

    -r No RUNSTATS : When this option is specified in conjunction with the -m option, db2look does not generate the RUNSTATS command. The default action is to generate the RUNSTATS command

    -c No COMMIT Statements : When this option is specified in conjunction with the -m option, db2look does not generate COMMIT, CONNECT and CONNECT RESET statements. The default action is to generate these statements. The -c option is ignored if the -m option is not specified.

    -t Tname : Table name. Limits the output to a particular table.

    -o OutputFileName : If this option is not specified, output is written to standard output.

    -e Extract DDL statements : Extract DDL statements for database objects.

    -m : Generate the required UPDATE statements to replicate the statistics on tables, columns and indexes. The -p, -g, and -s options are ignored when the -m option is specified.


    -l : If this option is specified, then the db2look utility will generate DDL for user defined table spaces, nodegroups and buffer pools. DDL for the following database objects is extracted when using the -l option:
  • User defined table spaces
  • User defined nodegroups
  • User defined buffer pools

    -x Generate Security Options : If this option is specified, the db2look utility will generate authorization DDL (GRANT statement, for example).

    -i userid : Use this option when working with a remote database.

    -w password : Used with the -i option. The user ID and the password are used by db2look to logon to the remote system.

    -f Config Parameters : Use this option to extract configuration parameters and registry variables. Note: Only configuration parameters and registry variables that affect the DB2 query optimizer are extracted.


    Example

    db2look -d department -u walid -e -m -o db2look.sql

    Generates both the DDL statements for the objects created by user walid and the UPDATE statements to replicate the statistics on the tables and indexes created by the same user. The db2look output is sent to file db2look.sql


    Referance : http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.