Db2 command list has been working for more than a month. Because the company wants to use DB2 databases, it always tries its best to read this book. For a while, I have some experiences and summarized some commonly used DB2 commands, share it with you! I hope you will be helpful .. Start the DB2 service: db2start disable the DB2 service: db2stop 1. load data: 1. load data with the default separator. The default value is ", "db2" import from btpoper.txt of del insert into btpoper "2. Load db2" import from btpoper.txt of del modified by coldel | insert into btpoper "2. Uninstall data: 1. Uninstall all data in a table: db2 "export to btpoper.txt of del select * from btpoper" db2 "export to btpoper.txt of del modified by coldel | select * from btpoper" 2. Conditional uninstall data in one table: db2 "export to btpope R.txt of del select * from btpoper where brhid = '000000' "db2" export to cmcode.txt of del select * from cmcodewhere codtp = '01' "db2" export to cmcode.txt of del modified by coldel | select * from cmscloud where codtp = '01' 3. query the data structure and data: db2 "select * from btpoper" db2 "select * from btpoper where brhid = '000000' and oprid = '000000'" db2 "select oprid, oprnm, brhid, passwd from btpoper "4. Delete table data: d B2 "delete from btpoper" db2 "delete from btpoper where brhid = '000000' or brhid = '000000'" 5. Modify Table data: db2 "update svmmst set prtlines = 0 where brhid = '000000' and jobtp = '02'" db2 "update svmmst set prtlines = 0 where jobtp = '02' or jobtp = '03 '"6. connect to the database db2 connect to btpdbs 7. Clear the database connection db2 connect reset disconnect from the database db2 terminate disconnect from the database db2 force applications all disconnect from all databases 8. Back up the database 1, db2 backup db btpdb S2, db2move btpdbs export db2look-d btpdbs-e-x [-a]-o crttbl. SQL 9. restore database 1. db2 restore db btpdbs without rolling forward2 and db2-tvf crtdb. SQL crtdb. SQL file content: create db btpdbs on/db2catalog db2-stvf crttbl. SQL db2move btpdbs import 10. DB2 HELP command: db2? Db2? Restroe db2? Sqlcode (for example: db2? Sql0803) Note: The code must be 4-digit, not 4-digit, followed by the 011 and bind commands: bind the application to the database. After each database restoration, we recommend that you perform one bind (1) db2 bind br8200.bnd (2) /btp/bin/bndall/btp/bnd/btp/bin/bndall/btp/tran/bnd 12. view the database parameters: db2 get dbm cfg db2 get db cfg for btpdbs XIII. After modifying the database parameters: db2 update db cfg for btpdbs using LOGBUFSZ 20 db2 update db cfg for btpdbs using LOGFILSIZ 5120, execute the following command to make it take effect: db2 stop db2 start supplement: db2 set schema btp change current mode to "btp" db2 l Ist tablespaces show detail View Current Database tablespace allocation status db2 list tablespace containers for 2 show detail View tablespace id = 2 use the container directory db2 list application db2 list db directory to list all databases db2 list active databases list all active databases db2 list tables for all list all tables in the current database db2 list tables for schema btp list tables in the current database where schema is btp db2 list tablespaces show detail display Database spatial usage db2 list packages for all db2 "import from tab76.ixf of ixf Commitcount 5000 insert into achact "db2" create table achact_t like achact "db2" rename table achact_t to achact "db2" insert into achact_t select * from achact where txndt> = (select lstpgdt from acmact where actno = achact. actno) "db2 get snapshot for dynaimic SQL on jining deletes an instance: # cd/usr/lpp/db2_07_01/instance #. /db2idrop InstName: # cd/usr/lpp/db2_07_01/bin #. /db2ilist creates a catalog for the database $ Db2 catalog db btpdbs on/db2catalog cancel the compiled destination database btpdbs $ db2 uncatalog db btpdbs view version # db2level displays the current database management instance $ db2 get instance sets whether the instance system starts automatically when it starts. $ Db2iauto-on: $ db2iauto-off: Database optimization commands are not automatically started: reorg and runstats. When the database is used for a period of time, the data space will become larger and larger. Some deleted data is still stored in the database, occupying data space and affecting system performance. Therefore, you need to regularly run the reorg and runstats commands to clear Deleted Data and optimize the data structure. Db2 reorg table name db2 runstats on table name with distribution and indexes all a sh program runsall is provided in the/btp/bin directory because many tables need to be optimized, runsall can be run after the business ends on the current day to optimize the database.