1. Start the instance (db2inst1 ):
Db2start
2. Stop an instance (db2inst1 ):
Db2stop
3. list all instances (db2inst1)
Db2ilist
5. List the current instance:
Db2 get instance
4. view the sample configuration file:
Db2 get dbm cfg | more
5. Update the Database Manager parameters:
Db2 update dbm cfg using para_name para_value
6. Create a database:
Db2 create db test
7. View Database Configuration Parameter Information
Db2 get db cfg for test | more
8. Update database parameter configuration information
Db2 update db cfg for test using para_name para_value
10. delete a database:
Db2 drop db test
11. Connect to the database
Db2 connect to test
12. list details of all tablespaces.
Db2 list tablespaces show detail
13. query data:
Db2 select * from tb1
14. Data:
Db2 delete from tb1 where id = 1
15. Create an index:
Db2 create index idx1 on tb1 (id );
16. Create a view:
Db2 create view view1 as select id from tb1
17. query view:
Db2 select * from view1
18. node Cataloguing
Db2 catalog tcp node node_name remote server_ip server server_port
19. Check the port number.
Db2 get dbm cfg | grep SVCENAME
20. Test node attachment
Db2 attach to node_name
21. View local nodes
Db2 list node direcotry
22. node deserialization
Db2 uncatalog node node_name
23. Database Cataloguing
Db2 catalog db db_name as db_alias at node node_name
24. view the database catalog
Db2 list db directory
25. Connect to the database
Db2 connect to db_alias user user_name using user_password
26. Database deserialization
Db2 uncatalog db db_alias
27. Export data
Db2 export to myfile of ixf messages msg select * from tb1
28. Import Data
Db2 import from myfile of ixf messages msg replace into tb1
29. Export all table data of the database
Db2move test export
30. Generate database Definitions
Db2look-d db_alias-a-e-m-l-x-f-o db2look. SQL
31. Create a database
Db2 create db test1
32. Generate Definition
Db2-tvf db2look. SQL
33. Import all data in the database
Db2move db_alias import
34. Reorganization check
Db2 reorgchk
35. reorganize the table tb1
Db2 reorg table tb1
36. update statistics
Db2 runstats on table tb1
37. Backup database test
Db2 backup db test
38. Restore database test
Db2 restore db test
399 \. List container Information
Db2 list tablespace containers for tbs_id show detail
40. Create a table:
Db2 ceate table tb1 (id integer not null, name char (10 ))
41. list all tables
Db2 list tables
42. insert data:
Db2 insert into tb1 values (1, 'Sam ');
Db2 insert into tb2 values (2, 'smitty ');
(