1. See which libraries the database server has
DB2 List DB Directory
2. Connect to the database
DB2 Connect to DBNAME (database name)
If you are connecting to a remote DB2 client, you need to enter a user name and password
DB2 Connect to DBNAME (database name) user USERNAME (user name) using PASSWD (password)
3. View DB2 service occupancy port
DB2 Get DB CFG | grep TCP
In general, the DB2 service occupies a port of 50000, confirming that you can use Netstat-an | GREP:50, to confirm the port starting with 50, if there is a large number of 50000 or 55000 ports interacting with other hosts, then the port is DB2 occupied port
DB2 Get DB CFG view data path configuration
4, view the information of the table
DB2 describe table TABLENAME (table name)
5. Export Data
DB2 "Export To/path/to/filenae (exported file name) of del select * from TABLENAME (table name)";
6. Import data
DB2 "Import from/path/to/filename (file importing data) of Del INSERT into TABLENAME (table name)";
7. Query data
SELECT * from TABLENAME (table name) where Mer_shop_name (query condition) like '% Pizza Hut% '
% Pizza Hut% for fuzzy query, content has Pizza Hut field that matches
SELECT * from TABLENAME (table name) where Mer_shop_name (query field) = Pizza Hut
= indicates exact match
8. Comprehensive inquiry
Select COUNT (1) from TABLENAME (table name 1) where order_id (query field) in (select order_id from TABLENAME (table name 2) where Pay_way (query field) in (' 1 ', ' 4 ', ' 5 ')) and Crt_time (query field) like ' 2016-12-28% '
9. Update data
Update TABLENAME (table name) set Mobile (query condition: mobile number) = ' 123456789 ' where user_id (query condition: User id) = 123456789;
10, query the first few rows of data
Search 2017 year ago 10 data
SELECT * from TABLENAME (table name) where Crt_time (query condition: creation time) like '%2017% ' fetch first ten rows only
This article is from the "Xiaoxiaozhou" blog, make sure to keep this source http://xiaoxiaozhou.blog.51cto.com/4681537/1953082
Operations and maintenance personnel DB2 daily operation commands