Common DB2 commands

Source: Internet
Author: User

Operations under the DB2 command line CLP

Note: The Blue font indicates the variable. You can replace the value you need as appropriate.

1. Connect to the database

-Connect to dbname User Username using Password

 

2. List all databases

-List dB directory

-List activated databases: List active databases

 

3. List the database tables under the current database

-List tables

-List tables for all/system/user

-List tables whose schema is db2admin: List tables for schema db2admin

 

4. display table structure

-Describe table tablename

 

5. list all tablespaces

-List tabspaces show detail

 

6. view the tablespace and schema of a table.

-Select a. tbspace, A. tabschema from syscat. Tables A where tabname = 'tabalename'

 

7. Modify the schema of Table

-Use an alias to Access Table A whose schema is administrator through itmuser: Create alias itmuser. A for administrator.

 

8. Specify the schema and tablespace when creating a database table.

-Create Table "itmuser". "schema_test" ("tmzdiff" integer not null, "timestamp" char (16) in tabspace;

-The tablespace is not specified. It is created under userspace1 by default.

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.