Summary of operational commands for DB2 Databases

Source: Internet
Author: User
Tags db2 connect

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

 
 
  1. db2 create bufferpool user8   size 100000 pagesize 8k  
  2. db2 create bufferpool user16 size 100000 pagesize 16k  
  3. db2 create bufferpool user32 size 100000 pagesize 32k 

6. Create a tablespace

 
 
  1. db2 create regular tablespace ts_user8 pagesize 8k managed by system using('fsms_8k_1') bufferpool user8  
  2. db2 create regular tablespace ts_user16 pagesize 16k managed by system using('fsms_16k_1') bufferpool user16  
  3. db2 create regular tablespace ts_user32 pagesize 32k managed by system using('fsms_32k_1') bufferpool user32 

7. Grant Permissions

 
 
  1. db2 grant dbadm,createtab,bindadd,connect on database to user userson  
  2. 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.

 
 
  1. 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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.