Some records in the db2 process

Source: Internet
Author: User
Tags db2 connect db2 connect to ibm db2

To learn about the implementation of some records in the db2 process: remotely connect the client to the db2 server (the connection between db2). This article assumes that the client is windows/linux/unix, the client has installed db2 or the client server is windows/linux/unix Client ip Address: 192.168.42.147, and the server ip address is 192.168.42.102. steps: run Db2 catalog tcpip node test remote 192.168.42.102 server 50000 on the client command line to create a server database node on the client. Note: test Is the node defined on the client, the IP address 192.168.42.102 is the IP address of the client and the port used by DB2. If the port is linux on the server, you can access the/etc/services file, if your instance name is db2inst1, find the following line: db2inst1 50000/tcp if the server side is w Indows, view X:/WINNT/System32/drivers/etc/services binding node and client database run the following command db2 catalog db coshine at node test note: coshine is the name of the database you want to connect to on the server. "Test" is a defined node used in step 1 to make the binding take effect. Execute db2 terminate to set the client db2codepage (code page setting) that is, the character encoding first queries db2codepage on the server side, run db2set-all [I] DB2_EXTENDED_OPTIMIZATION = ON [I] restart = ON [I] AUTOSTART = YES [I] DB2_STRIPED_CONTAINERS = ON [I] DB2_HASH_JOIN = Y [I] DB2COMM = tcpip [I] DB2CODEPAGE = 819 [I] DB2_PARALLEL _ IO = * you can see that the DB2CODEPAGE on the server is 819, so the client must also set this number to execute db2set db2codepage = 819 for connection and execute db2 connect to coshine user user_name using password annotation Db2codepage: that is, the encoding method of the db2 database is db2codepage = 1386 (Simplified Chinese) db2country = 86 (China). Once a database is created, its code page cannot be changed, db2set DB2CODEPAGE = 1386 only the code page environment can be changed, but the database code page cannot be connected. Check whether the following information is correct and ensure that the server can be pinged: ping 192.168.42.102 to ensure that db2 on the server has been started: db2start: Make sure that the client DB2COMM is set to tcpip. View db2comm settings first: db2set-all. If this registry is not set, run db2set Db2comm = does tcpip set SVCENAME to the port number or service name in/etc/services? Run db2 get dbm cfg to check and find SVCENAME. If the current value is not the server port number or service name, run the following update settings: db2 update dbm cfg SVCENAME db2inst1 Note: db2inst1 is the service name, in the/etc/services file, db2inst1 50000/tcp is consistent with that of the DB2 database, and 30 basic operation commands are provided. in the command window for viewing the local node directory, 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> in the local database directory Databases not in the system database directory cannot be accessed. You can select <database> right-click and choose add from the control center, enter the name of the database to be added, or click Refresh to select a database, after joining the database, you can access it. 6. cataloguing database db2 catalog database as at node 7. cancel database cataloguing db2 uncatalog database 8. test the connection to the remote database db2 connect to user using 9. any user can set the default mode for a specific database connection by setting the CurrentSchema special register. The initial default value is the permission ID of the current session user. Set schema = can be used interactively or in applications. If you bind a package with the DynamicrulesBind option, this statement does not work. This statement is not under transaction control. 10. code page settings when creating a database set Character Set create database using codeset territory example: create database dbtest using codeset IBM-437 territory US can also set the code page for the entire database, in win2000/NT/xp, in my computer --> properties --> advanced --> environment variables, add the variable DB2CODEPAGE =, 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. For migration from an earlier version of DB2 to a later version, first import the backup and recovery functions of the earlier version to a later version of the database, and then enter the db2 migrate database in the Command window. 12. when the table name or mode contains quotation marks, access the table command window: db2 select * from \ "tabschema \". \ "tabname \" command line processor: db2 => select * from "tabschema ". "tabname" 13. command window for generating DDL file for exporting database table structure: db2look-d-e-c-o 14. run the script file command window: db2-tvf 15. code Page conversion 16. obtain the current DB2 version select * from sysibm. sysversions 17. restrictions on modifying fields in the DB2 table? Only the VARCHAR2 type can be modified, and only the alter table alter column set data type varchar (SIZE) can be increased. 18. How can I view the table structure? Describe table or describe select * from. 19. How to quickly clear a large table? Alter table TABLE_NAME active not logged initally with empty table 20. How to view the database stored procedures? SELECT * from syscat. PROCEDURES 21. How do I view table constraints? SELECT * from syscat. checks where tabname = 22. How to view the complete reference constraints of a table? SELECT * from syscat. references where tabname = 23. How do I know the BUFFERPOOLS status? Select * from SYSCAT. BUFFERPOOLS 24. How can I view and modify instance and database configuration parameters in the command line? View instance configuration parameters: db2 get dbm cfg modify instance configuration parameters: db2 update dbm cfg using parameter name new value view database configuration parameters: db2 get db cfg for modify Database configuration parameters: db2 update db cfg for using parameter name new value 25. how to modify the buffer? Add a buffer: create bufferpool size [pagesize 4096] {[not] extended storage} modify the buffer: alter bufferpool size {[not] extended storage} Delete the buffer: drop bufferpool if the buffer size is set to-1, the number of pages in the buffer pool is determined by the Database Configuration Parameter buffpage. Note: The Database Configuration Parameter buffpage only applies to the buffer pool with the buffer size set to-1. 26. how to use in/not in select * from tabschema without using the select clause when multiple fields exist. tabname where (colA, colB, colC) [not] in (valueA1, valueB1, valueC1), (valueA2, valueB2, valueC2 ),... (valueAn, valueBn, valueCn) 27. view the applications currently connected to the database db2 list application [show detail] 28. how to check the consistency of the DB2 database db2dart/DB indicates to check the consistency of the entire database 29. export the data export to a table, for example, export the user table export to c: \ user. ixf of ixf select * from user 30. import data from E. g.: import data. Enter the user table. You can create a new table directly during import. If the table exists, you can use INSERT or UPDATE.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.