数据库名:mydb 表名:myTest
方法一:备份到数据库服务器中 备份速度快但下载慢
# su - db2inst1
[YOU HAVE NEW MAIL]
$ db2 connect to mydb user ccy using ccy123
Database Connection Information
Database server = DB2/AIX64 9.7.8
SQL authorization ID = NBADV
Local database alias = MYDB
1)表备份(备份部分表数据)有日期限制的备份
$ db2 "export to /backup/myTest2018.del of del select * from myTest where substr(d_day,1,4)='2018'"
SQL3104N The Export utility is beginning to export data to file
"/backup/myTest2018.del".
SQL3105N The Export utility has finished exporting "15787008" rows.
2)全表数据备份
$ db2 "export to /backup/myTest2018.del of del select * from myTest
*******************************************************************************************************************************
方法二:备份到本地 备份比较慢,无需下载
例如:
export to c:\myTest 201601.del of del select * from myTest where reportdate=201601@