Online DB2 import is a frequently used operation. The following describes the implementation of online DB2 import. If you are interested, take a look.
DB2 online Import
Note: Make sure that the tablespace name and page size are consistent with those of the schema before importing.
1. Import table structures, views, stored procedures, triggers, functions, sequences, and so on, excluding binary objects such as Blob exported to the specified file
Run the following command on the DB2 console:
-- Log on to DB2
Db2 connect to tb33_s
-- Specify schema
Db2 set current schEmA tb33
-- Import the export file TB33. SQL as DB2
Db2-tvf TB33. SQL
-T: Specifies the statement termination character.
-V: display the execution content on the console
-F: Read the input file.
2. Import table data
You can import table data in two steps: generate an import Command Script file and execute an import command script file.
1. Generate the import Command Script file:
Run the following statement using the DB2Manager tool to generate the import table data command. type = 'T' indicates that only table data is exported;
-- Import table data statement
Select 'import from H: \ DB2 \ TB33 \ '| rtrim (tabname) | '. ixf of ixf insert into '| ''| rtrim (tabname) |'; 'from syscat. tables where tabschema = 'tb33' and type = 'T'
Command Execution instructions:
Import command for generating table data in the database schema TB33; import all table structure files in the path H: \ db2 \ TB33;
Save the generated commands as an import.txt file.
2. Execute the import Command Script:
Run the following command on the DB2 console:
Db2-tvf import.txt
-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, You can query the data table in DB2Manager and view the imported data.
Common db2 stored procedure statements
Usage of the DB2 create server statement
Usage of DB2 Merge statements
In-depth discussion of DB2 table connection principles
Common DB2 cycle usage