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.