DB2 databaseOperationsCommandThere are many. We have summarized some commands in this article. Next we will introduce these, hoping to help you.
1. connect to the database: connect to mas user lujiadontcru using mas
2. Set the character set of the database
Db2set db2codepage = 819 is produced according to the ISO-8809-1 Western European character set;
Db2set db2codepage = 1386 is generated by GBK;
Db2set db2codepage = 1208 install the UTF-8 to generate.
3. create a new database: db2 create database temp
4. Connect to the database: db2 to mas1 user lujiadontcry using mas
5. Create a buffer pool
- db2 create bufferpool user8 size 100000 pagesize 8k
- db2 create bufferpool user16 size 100000 pagesize 16k
- db2 create bufferpool user32 size 100000 pagesize 32k
6. Create a tablespace
- db2 create regular tablespace ts_user8 pagesize 8k managed by system using('fsms_8k_1') bufferpool user8
- db2 create regular tablespace ts_user16 pagesize 16k managed by system using('fsms_16k_1') bufferpool user16
- db2 create regular tablespace ts_user32 pagesize 32k managed by system using('fsms_32k_1') bufferpool user32
7. Grant Permissions
- db2 grant dbadm,createtab,bindadd,connect on database to user userson
- db2 grant dbadm,createtab,bindadd,connect,load on database to user userson
8. Set the stack size and set the stack size of mas1 to 512.
- db2 update db cfg for mas1 using applheapsz 512
9. unmount the database
Db2move mas1 export
10. Export Database statements (export the relevant statements of the database in mas1 to mas1. SQL)
Db2look-d mas1-e-a-o mas1. SQL
11. Database loading
Db2move mas1 import-l/home/lujiadontcry/wk/mas1
Db2-tvf db2look. SQL restores tables in the database;
12. list all instances
Db2 list database directory
13. Disconnect
Db2 connect reset
14. Stop db2
Db2 terminate
Db2stop force
Db2 stop database manager
15. View db2set
Sometimes sql5043n is reported during db2start. The communication protocol is incorrect. The solution is as follows.
1. View db2comm = tcpip in db2set-all.
2. db2 get dbm cfg | grep SVCENAME to check whether the port number is correctly configured.
3. netstat-an | grep port number to check whether the port number is in conflict or listening status.
The operation commands for the DB2 database are introduced here. I hope this introduction will be helpful to you!