import cx_Oracle
import sys
dsn_tns2 = cx_Oracle.makedsn('
10.125.122.191', '1521', service_name='tt')
targetConnection = cx_Oracle.connect(user=r'test', password='123', dsn=dsn_tns2,encoding="UTF8")
targetCursor = targetConnection.cursor()
targetCursor.arraysize = 50000
dsn_tns = cx_Oracle.makedsn('
10.255.111.81', '1521', service_name='pp')
hh = cx_Oracle.connect(user='test', password='123', dsn=dsn_tns)
sql = "select * from test.test_tab partition (P_20200209) "
src_cursor = hh.cursor()
src_cursor.execute(sql)
while True:
rec=src_cursor.fetchmany(50000)
if not rec:
break
targetCursor.executemany("insert into test.test_tab values (:1, :2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18,:19,:20,:21)", rec)
targetConnection.commit()
src_cursor.close()
targetCursor.close()
targetConnection.close()