使用tpc_ds生成db2测试数据

#通过tpc_ds生成db2数据参考
https://www.cnblogs.com/webDepOfQWS/p/10544528.html

#tpc-ds重新编译
安装依赖包:yum install gcc make flex bison byacc git byacc
解压重新编译
tpcds-kit-master/tools
make  -f  Makefile.suite
生成dsdgen dsqgen表示成功

#db2执行建表语句,建表脚本可根据需要指定表空间
db2 -txvf /opt/tpcds-kit-master/tools/tpcds.sql   

#dsdgen生成数据
#-scale指定生成数据大小
#-dir指定生成数据存放路径
./dsdgen  -scale 1 -dir /opt/data
 

#删除主键约束,导入数据
db2 connect to sample
db2 "alter table CATALOG_RETURNS drop primary key"
db2 "alter table CATALOG_PAGE drop primary key"
db2 "alter table CATALOG_RETURNS drop primary key"
db2 "alter table CATALOG_SALES drop primary key"
db2 "alter table CUSTOMER_ADDRESS drop primary key"
db2 "alter table CUSTOMER_DEMOGRAPHICS drop primary key"
db2 "alter table DBGEN_VERSION drop primary key"
db2 "alter table HOUSEHOLD_DEMOGRAPHICS drop primary key"
db2 "alter table INCOME_BAND drop primary key"
db2 "alter table INVENTORY drop primary key"
db2 "alter table ITEM drop primary key"
db2 "alter table PROMOTION drop primary key"
db2 "alter table REASON drop primary key"
db2 "alter table SHIP_MODE drop primary key"
db2 "alter table STORE drop primary key"
db2 "alter table STORE_RETURNS drop primary key"
db2 "alter table STORE_SALES drop primary key"
db2 "alter table TEST drop primary key"
db2 "alter table TIME_DIM drop primary key"
db2 "alter table T_TEST01 drop primary key"
db2 "alter table WAREHOUSE drop primary key"
db2 "alter table WEB_PAGE drop primary key"
db2 "alter table WEB_RETURNS drop primary key"
db2 "alter table WEB_SALES drop primary key"
db2 "alter table WEB_SITE drop primary key"

#导入数据
db2 import from /opt/data/item.dat of del modified by coldel0x7c insert into item
db2 import from /opt/data/call_center.dat of del modified by coldel0x7c insert into call_center
db2 import from /opt/data/catalog_page.dat of del modified by coldel0x7c insert into catalog_page
db2 import from /opt/data/catalog_returns.dat of del modified by coldel0x7c insert into catalog_returns
db2 import from /opt/data/catalog_sales.dat of del modified by coldel0x7c insert into catalog_sales
db2 import from /opt/data/customer_address.dat of del modified by coldel0x7c insert into customer_address
db2 import from /opt/data/customer_demographics.dat of del modified by coldel0x7c insert into customer_demographics
db2 import from /opt/data/date_dim.dat of del modified by coldel0x7c insert into date_dim
db2 import from /opt/data/income_band.dat of del modified by coldel0x7c insert into income_band
db2 import from /opt/data/household_demographics.dat of del modified by coldel0x7c insert into household_demographics
db2 import from /opt/data/inventory.dat of del modified by coldel0x7c insert into inventory
db2 import from /opt/data/customer.dat of del modified by coldel0x7c insert into customer
db2 import from /opt/data/promotion.dat of del modified by coldel0x7c insert into promotion
db2 import from /opt/data/ship_mode.dat of del modified by coldel0x7c insert into ship_mode
db2 import from /opt/data/reason.dat of del modified by coldel0x7c insert into reason
db2 import from /opt/data/store.dat of del modified by coldel0x7c insert into store
db2 import from /opt/data/store_sales.dat of del modified by coldel0x7c insert into store_sales
db2 import from /opt/data/store_returns.dat of del modified by coldel0x7c insert into store_returns
db2 import from /opt/data/warehouse.dat of del modified by coldel0x7c insert into warehouse
db2 import from /opt/data/time_dim.dat of del modified by coldel0x7c insert into time_dim
db2 import from /opt/data/web_page.dat of del modified by coldel0x7c insert into web_page
db2 import from /opt/data/web_returns.dat of del modified by coldel0x7c insert into web_returns
db2 import from /opt/data/web_sales.dat of del modified by coldel0x7c insert into web_sales
db2 import from /opt/data/web_site.dat of del modified by coldel0x7c insert into web_site
db2 import from /opt/data/dbgen_version.dat of del modified by coldel0x7c insert into dbgen_version

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值