2. DB2 force application all-force all applications to disconnect from the database.
3, db2 backup dbdb2name < database name >-backup the entire database data.
Db2 recovery database & ltdb2name & gt- recovery database
4. DB2 list application-View all connections (you need to connect to a specific database to view).
5, db 2 start- start the database, db2stop-stop the database.
6. create a database < database name > use the code set utf-8 region CN- create a database using UTF-8 encoding.
7.db2 catalog command
Db2 cataloging tcpip node < contact name > remote < remote database address >; Server < port number >-Mapping a remote database to a local contact is usually 50000.
Db2 catalog database < remote database name >; As< contact name > In node pub 1 1- the remote database name is local contact.
Db2 connects to < contact name > user < user name > with < password >-connects local contacts to access the remote database.
8, database export
db 2 look-d & lt; Database name >-u <; User >-e-o <; Script name >. SQL- Export the table structure of the database, where the user space is generally db2admin/db2inst 1.
db 2 look-d & lt; Database name >-u <; User >-t <; Table1> < Table 2 >-e-o <; Script name >. SQL- Export the table structure of table 1 and table 2 in the database.
Db2move < database name > export-export database data.
Db2move < database name > export-TN <; Table 1 >, < Table 2 >- Export tables and table data in the database.
9, database import
DB2-tvf & lt; Script name >. SQL- Import the table structure exported above into the database table structure.
Db2move & lt database name > Load-lo replace- import the above "db2move Export" into the database and replace the same data in actual use. If you use db2 self-increasing primary key, you need to use it by default, not always. The function is the same, but it will be very convenient for data migration!
10, db2 connect reset or DB2 termin ate- disconnect from the database.
1 1, db 2 set db 2 code page = 1208- modify the page code to 1208.
12, db2 description table < table name >-View table structure (general)
13, DB2 list-View all table structures in the database (General)
List System Tables-Lists all system tables.
14, DB2 list tablespace-list tablespace
15, fetch first 10 rowonly-lists the first10 data in the table.
For example: select * from fetch first10 rows only.
16, coalesce (field name, converted value)-value conversion of empty field.
Value (field name, converted value)-Converts the value of an empty field.
For example: Select Coalesce (ID, 1)from- If the ID in the table is empty, it will be converted to 1.
Select a value (id, 1) from the table date.
17, concatt (parameter 1, connection value)-Add the connection value with the parameter 1 to form a new value.
Example: concat ('aa',' b ')- aab is returned.
18, create aliseadmin.tb _ bianonto tb _ biano create synonyms.
19, query system time "
Select the current timestamp from sysibm; sysdummy1;
Some of them are online. I organized them myself. I hope it helps you!