The DB2 Online Export method may not be known to everyone. The following describes the detailed steps for online DB2 export. If you are interested in online DB2 export, take a look.
DB2 Online Export
1. Export table structures, views, stored procedures, triggers, functions, sequences, etc., excluding binary objects such as blob to the specified file
Run the following command on the DB2 console:
Db2look-d tb33-e-a-x-I tb33-w tb33-o TB33. SQL
Parameter description:
-D: Specifies the database name.
-E: extract the DDL files required for database replication.
-A: generate statistics for all created programs
-X: generate the "Authorization" Statement DDL for the original definition program of the exclusion object
-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.
-O: redirects the output to the specified file name.
2. Export table data
Export table data is executed in two steps: generate the Export command script file and execute the Export command script file.
1. Generate the Export command script file:
Run the following statement using the DB2Manager tool to generate the export table data command. type = 'T' indicates that only table data is exported;
-- Export table data statement
Select 'export to H: \ db2 \ TB33 \ '| rtrim (tabname) | '. ixf of ixf select * from '| rtrim (tabname) |'; 'from syscat. tables where tabschema = 'tb33' and type = 'T'
Command Execution instructions:
Export command for generating all table data in database TB33; this export command specifies to save the table data of each table as the table name. the ixf file is saved in the directory H: \ db2 \ TB33 \. The generated command is saved as an export.txt file.
2. Execute the Export command script file:
Run the following command on the DB2 console:
Db2-tvf export.txt.
Parameter description:
-T: Specifies the statement termination character.
-V: display the execution content on the console
-F: Read the input file.
After the script is successfully executed, the table name. ixf table data is generated in the directory H: \ db2 \ TB33.
Common db2 stored procedure statements
Usage of DB2 Merge statements
Overview of DB2 Flow Control clauses
In-depth discussion of DB2 table connection principles
Common DB2 cycle usage