您好,登錄后才能下訂單哦!
利用python生成導(dǎo)入文件
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
path = r"F:\alien_invasion\DATA_BLKLISTS01A.del"
list = open(path,'w')
count1 = 1
print("開始執(zhí)行!" )
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))
#函數(shù) writelines(list)函數(shù)writelines可以將list寫入到文件中,但是不會(huì)在list每個(gè)元素后加換行符,所以如果想每行都有換行符的話需要自己再加上。
print ("執(zhí)行結(jié)束!")
list.close()
利用db2 load工具導(dǎo)入數(shù)據(jù)
db2 connect to 數(shù)據(jù)庫名
創(chuàng)建500w數(shù)據(jù)表
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)"
導(dǎo)入500萬數(shù)據(jù)
db2 load from /tmp/DATA_BLKLISTS01.del of del insert into XIFENFEI_LOAD1 nonrecoverable
創(chuàng)建1000w數(shù)據(jù)表
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)"
導(dǎo)入1000萬數(shù)據(jù)
db2 load from /tmp/DATA_BLKLISTS01A.del of del insert into XIFENFEI_LOAD4 nonrecoverable
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。