3.DB2 常用命令

 

DB2 常用命令

建立连接

1
$ db2 connect to [database_name] user [user_name] using [password]

进入客户端

1
$ db2

查询数据库

1
db2 => list db directory

查询表

1
db2 => list tables

执行 sql 语句

1
db2 => select * from [table_name]

表数据导出

1
db2 => export to [file_path] of [file_type] [select查询语句]

file_type:

  • ASC = ASCII
  • DEL = Delimited ASCII
  • WSF = Worksheet format
  • IXF = Integrated Exchange Format