Click Start menu-All Programs-->ibm-->db2-->db2copy1--> command-line tools--command Window
First, DB2 instance operation
1, view the DB2 database version and installation directory
E:\Program Files (x86) \ibm\sqllib\bin>db2leveldb21085i instances "DB2" using "both" and DB2 code distributions " SQL09074 ", the level is identified as"08050107". The reference is labeled "DB2 v9. 7.400. 501"," s110330 "and" IP23237 ", the revision package is"4". The product is installed in E:\PROGRA ~ 2 \ibm\sqllib using the DB2 replica name "db2copy1".
2. View current Instance
E:\Program Files (x86) \ibm\sqllib\bin>DB2 Get instance current Database Manager instance is: DB2
3. View all instances
E:\Program Files (x86) \ibm\sqllib\bin>db2ilistdb2
4. View the database that was created under the current instance
E:\Program Files (x86) \ibm\sqllib\bin>DB2 number of entries in the list DB Directory system database catalog directory= 2Database1entry: Database aliases=TESTDB2 Database name=TESTDB2 Local Database directory=E: Database release level=D.xxNotes=Directory Entry Type=Indirect Catalog Database partition number= 0Alternate server host name=Alternate server port number=Database2entry: Database aliases=Sample Database name=sample Local Database directory=E: Database release level=D.xxNotes=Directory Entry Type=Indirect Catalog Database partition number= 0Alternate server host name=Alternate server port number=
5. Start and close DB2 instances
E:\Program Files (x86) \ibm\sqllib\bin>Db2stop --Geneva- to A: -:xx 0 0sql1064n db2stop processing succeeded. sql1064n db2stop processing succeeded. E:\Program Files (x86) \ibm\sqllib\bin>Db2start --Geneva- to A: -: . 0 0sql1063n Db2start processing succeeded. sql1063n Db2start processing succeeded.
6. View instance configuration parameters
E:\Program Files (x86) \ibm\sqllib\bin>DB2 get dbm CFG Database Manager configuration node type=Enterprise Server Edition Database Manager configuration release level with local and remote clients= 0x0d00CPU Speed (MS/directive) (Cpuspeed)= 1.417033e-007Communication bandwidth (MB/seconds) (Comm_bandwidth)= 1.000000e+002Maximum number of concurrent active databases (NUMDB)= 8Federated Database System Support (federated)=No transaction processor monitor name (tp_mon_name)=Default offset Payment account (DFT_ACCOUNT_STR)=Java Development Kit Installation Path (Jdk_path)=E:\PROGRA~2\IBM\SQLLIB\JAVA\JDK Diagnostic Error capture level (Diaglevel)= 3notification level (Notifylevel)= 3Diagnostic Data Directory path (DIAGPATH)=Alternate Diagnostic Data Directory path (Alt_diagpath)=size of rotation DB2DIAG and notification log (MB) (diagsize)= 0...
7. View database configuration Parameters
E:\Program Files (x86) \ibm\sqllib\bin>DB2 The database configuration database of the Get DB CFG database configuration release level= 0x0d00Database Release Level= 0x0d00Database Geography=CN Database code page= 1208Database Code Set=UTF-8Database Country/Area code= theDatabase Grooming Order= IDENTITYAlternate collating order (alt_collate)=Digital Compatibility= OFFVarchar2Compatibility= OFFDate Compatibility= OFFDatabase Page Size= 8192Dynamic SQL Query Management (DYN_QUERY_MGMT)=Disable Statement concentrator (STMT_CONC)= OFFDiscovery support for this database (discover_db)=ENABLE ...
8. Connect to the database
E:\Program Files (x86) \ibm\sqllib\bin>to= DB2/9.7. 4 == SAMPLE
9. List the active database
E:\Program Files (x86) \ibm\sqllib\bin>==1= E:\DB2\NODE0000\SQL00001\
10. Disconnect the database
E:\Program Files (x86) \ibm\sqllib\bin>DB2 terminatedb20000i TERMINATE command completed successfully. E:\Program Files (x86) \ibm\sqllib\bin>DB2 list Active DATABASESSQL1611W "Database System Monitor" did not return any data.
Second, table space operation
1. List all table spaces under the database
before you can list tablespaces, you must connect to the database to view tablespace information under the database. Open the DB2 command window, connect to the sample database, and then use the DB2 List tablespaces command to view: E:\Program Files (x86) \ibm\sqllib\bin>DB2 Connect toSample database connection information database server=DB2/Nt9.7.4SQL Authorization ID=administ ... Local Database aliases=Samplee:\program Files (x86) \ibm\sqllib\bin>DB2 list tablespaces table space tablespace identifier for current database= 0name=syscatspace Type=Database Management space content=all persistent data. Regular table Space State= 0x0000detailed explanation: Normal table space identification= 1name=TEMPSPACE1 Type=System Management Space content=system Temporary Data status= 0x0000detailed explanation: normal ...
2. View table Space Details
E:\Program Files (x86) \ibm\sqllib\bin>DB2 List tablespaces Show Detail tablespace tablespace identifier of the current database= 0name=syscatspace Type=Database Management space content=all persistent data. Regular table space. Status= 0x0000detailed Explanation: normal total pages= 12288Available Pages= 12284pages already used= 11740Available Pages= 544High Water mark (page)= 11740page size (in bytes)= 8192Extended chunk Size (page)= 4prefetch Size (page)= 4Number of containers= 1Table Space Identification= 1name=TEMPSPACE1 Type=System Management Space content=system Temporary Data status= 0x0000detailed Explanation: normal total pages= 1Available Pages= 1pages already used= 1Available Pages=high water mark not applicable (page)=page size Not applicable (in bytes)= 8192Extended chunk Size (page)= +prefetch Size (page)= +...
3. View container information for table spaces
E:\Program Files (x86) \ibm\sqllib\bin>for 00= 0 == file
4. View container Details
E:\Program Files (x86) \ibm\sqllib\bin>DB2 List tablespace containers for 0Show Detail table Space0Table Space Container container identity= 0name=E:\DB2\NODE0000\SAMPLE\T0000000\C0000000. Cat Type=total pages of files= 12288Available Pages= 12284access to=Is
DB2 database Common Basic Operations Command