环境:
操作系统:linux
数据库:9.7
[db2inst1@db01 cg]$ db2licm -l
Product name: "DB2 Enterprise Server Edition"
License type: "CPU Option"
Expiry date: "Permanent"
Product identifier: "db2ese"
Version information: "9.7"
Enforcement policy: "Soft Stop"
Features:
DB2 Database Partitioning: "Not licensed"
DB2 Performance Optimization ESE: "Not licensed"
DB2 Storage Optimization: "Not licensed"
DB2 Advanced Access Control: "Not licensed"
DB2 Geodetic Data Management: "Not licensed"
IBM Homogeneous Replication ESE: "Not licensed"
数据库导出
[root@db01 ~]# su - db2inst1
Last login: Tue Jul 23 17:25:54 CST 2019 on pts/0
导出ddl
[db2inst1@db01 ~]$ mkdir /tmp/testDb/
[db2inst1@db01 ~]$ cd /tmp/testDb/
[db2inst1@db01 testDb]$ db2look -d testDbName -z userName -e -l -o testDbName.sql
- -d testDbName 数据库名称
- -u userName 登录用户名称
- -e 抽取复制数据库所需的ddl文件
- -l 生成数据库布局:数据库分区组、缓冲池和表空间
- -z userName 模式名(schema),如果同时制定 -z 和 -a ,那么将忽略 -z
- -o 将输出重定向到给定的文件名
导出数据
[db2inst1@db01 testDb]$ export LANG=zh_CN.GBK
[db2inst1@db01 testDb]$ db2move testDbName export
数据库导入
创建数据库:
[root@db01 ~]# su - db2inst1
[db2inst1@db01 ~]$ db2 create db myDd using codeset GBK territory CN