利用python生成导入文件
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
path = r"F:\alien_invasion\DATA_BLKLISTS01A.del"
list = open(path,'w')
count1 = 1
print("开始执行!" )
for i in range(10000000):
i = i+1
count1 +=1
randomcount = random.randint(0,9)
print("""%s,"8613%s%08d",1,1,"remarks",""" % (i,str(randomcount),count1))
list.writelines("""%s,"8613%s%08d",1,1,"remarks",\n""" % (i,str(randomcount),count1))
#函数 writelines(list)函数writelines可以将list写入到文件中,但是不会在list每个元素后加换行符,所以如果想每行都有换行符的话需要自己再加上。
print ("执行结束!")
list.close()
利用db2 load工具导入数据
db2 connect to 数据库名
创建500w数据表
db2 "CREATE TABLE XIFENFEI_LOAD(col1 INT NOT NULL primary key,
col2 CHAR(100) NOT NULL,
col3 VARCHAR(20) NOT NULL,
col4 VARCHAR(20) NOT NULL,
col5 VARCHAR(20) NOT NULL)"
导入500万数据
db2 load from /tmp/DATA_BLKLISTS01.del of del insert into XIFENFEI_LOAD1 nonrecoverable
创建1000w数据表
db2 "CREATE TABLE XIFENFEI_LOAD4(col1 BIGINT NOT NULL primary key,
col2 CHAR(100) NOT NULL,
col3 VARCHAR(20) NOT NULL,
col4 VARCHAR(20) NOT NULL,
col5 VARCHAR(20) NOT NULL)"
导入1000万数据
db2 load from /tmp/DATA_BLKLISTS01A.del of del insert into XIFENFEI_LOAD4 nonrecoverable