db2导出全库定义
① db2look -d sample(库名称) -a -e -l -x -o ddl20210420.out
② db2look -d sample(库名称) -a -e -x -f -o ddl20210420.out (导出表,索引,序列等对象)
③ db2look -d sample -createdb -printdbcfg -l -o ddl0423.out(数据库建库语句,包含buffpool,tablesapces,参数)
-- db2look -d sample(库名称) -a -ct -x -o ddl20210420.out(导出表,索引,序列等对象)
导出数据
[db2inst1@long-ibm1 ~]$ db2 "select * from db2inst1.org"
DEPTNUMB DEPTNAME MANAGER DIVISION LOCATION
-------- -------------- ------- ---------- -------------
10 Head Office 160 Corporate New York
15 New England 50 Eastern Boston
20 Mid Atlantic 10 Eastern Washington
38 South Atlantic 30 Eastern Atlanta
42 Great Lakes 100 Midwest Chicago
51 Plains 140 Midwest Dallas
66 Pacific 270 Western San Francisco
84 Mountain 290 Western Denver
8 record(s) selected.
[db2inst1@long-ibm1 ~]$ db2 "export to db2inst1.org of ixf select * from db2inst1.org"
删除数据
db2 "delete from db2inst1.org"
导入数据
[db2inst1@long-ibm1 ~]$ db2 "export to db2inst1.org of ixf select * from db2inst1.org"
db2 "select * from db2inst1.org"