DB2 databaseIt is mainly used in large-scale application systems and has good scalability. It can be used in operating systems/2, Windows, and other platforms from the mainframe to the single-user environment. The DB2 database provides high-level data availability, integrity, security, recoverability, and execution capabilities for small-scale to large-scale applications. It has basic platform-independent functions and SQL commands. The skills described in this article can greatly simplify our work process and improve our work efficiency.
1. view the local node directory
In the command window, enter db2 list node directory.
2. cataloguing a TCP/IP Node
Command window: db2 catalog tcpip node remote server ostype
3. Cancel node Cataloguing
Db2 uncatalog node
4. view the system database directory
Db2 list database directory
5. view the local database directory
Db2 list database directory on <drive letter>
If the database is in the local database directory but not in the system database directory, you can right-click <database> in the control center and choose add, enter the name of the database to be added or click the refresh button to select a database. After joining the database, you can access the database.
6. cataloguing Database
Db2 catalog database as at node
7. Cancel database Cataloguing
Db2 uncatalog database
8. Test the remote database connection.
Db2 connect to user using
9. Any user can set the default mode for a specific database connection by setting the Current Schema special register. The initial default value is the permission ID of the Current session user.
Set schema =
This statement can be used interactively or in applications. If the Dynamicrules Bind option is used to Bind a package, this statement does not work. This statement is not under transaction control.
10. code page settings
Set character sets when creating databases
Create database using codeset territory
Example:
The following is a reference clip:
Create database dbtest using codeset IBM-437 territory US
You can also set the code page of the entire database. In win2000/NT/xp, add the variable DB2CODEPAGE = to my computer --> properties --> advanced --> environment variable, for example: DB2CODEPAGE = 437 or DB2CODEPAGE = 1386. Alternatively, enter db2set DB2CODEPAGE = 1386 in the IBM DB2 command window. After the settings, restart DB2 to take effect.
11. migration of data from earlier DB2 versions to later versions
First, import the data backup of earlier versions to the database of later versions using the restoration function, and then enter db2 migrate database in the Command window.
12. Access the table when the table name or mode contains quotation marks
Command window: db2 select * from \ "tabschema \". \ "tabname \"
Command Line processor: db2 => select * from "tabschema". "tabname"
13. Export the table structure of the database to generate the DDL File
Command window: db2look-d-e-c-o
14. Execute the script file
Command window: db2-tvf
The above are the 14 classic tips that I want to introduce to you about using DB2 databases. I hope to help you. At the same time, I am very happy to share these tips with you.