About the use of DB2 (DB2 data command)

Source: Internet
Author: User
Tags db2 db2 connect db2 connect to db2 error

The database used by the company is Kanakura and DB2

To open the DB2 directly with the command window, you need to enter it in CMD: db2cmd

1: start DB2 database: Db2start

2: Connect to Database: DB2 connect to database name  

3:: Create DATABASE: DB2 Create DB database name

4: Delete database: DB2 drop DB database name

5: View table Spatial structure: DB2 list tablespaces

6: View the physical path of the system tablespace DB2 list tablespaces container For 0

7: Backup DATABASE: DB2 backup DB database name to D: here D: refers to the drive letter

8: Restore DATABASE: DB2 RESTORE database name from D:\ taken at time symbol on D:\

9: Append database restore: DB2 restore database name from the D:\taken at time symbol into SX without rolling forward

10. Copy the current file to a remote server scp/home/xxx.txt [email protected]:/home/root

Version query for 11:DB2: Su-db2insta1 db2level

12: Add column: ALTER TABLE name add column name type

13; Delete column: ALTER TABLE table name drop column name

14: Create user input command useradd-d/home/-M phis enter passwd phis Enter password Confirm password OK gppasswd-a phis Test add phis user to test user group

15: Database repair: 1>:cmd input db2cmd-c DB2 2>:d B2 Connect to user username using password (login database). 3>:reorg table name This is a table fix

16: Deal with DB2 database state inconsistency 1>: db2stop Force stop database .2>:d b2start start database 3>:d B2 connect to database name 4>:d b2 Terminate disconnect

5>: Backup operation command: DB2 backup DB database name to drive letter:

17:DB2 server to modify the computer name can not start the problem in the Server C disk to find the Db2diag.log file, open it has the original computer name, modified back to restart the computer.

18:DB2 Error query DB2 list DB diretory DB2 terminate DB2 Force application DB2 Restore DB database name On/home/db2inst1 redir ECT generate script RHIO2.CLP rolling forward DB2-TVF RHIO2.CLP

About the use of DB2 (DB2 data command)

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.