您好,登錄后才能下訂單哦!
這篇文章主要講解了“ORACLE和MYSQL怎么互相導(dǎo)入數(shù)據(jù)”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“ORACLE和MYSQL怎么互相導(dǎo)入數(shù)據(jù)”吧!
只是一個(gè)列子和方法具體的選項(xiàng)按需求添加
1、ORACLE卸載數(shù)據(jù)
DECLARE
row_result varchar2(4000);
selectsql varchar2(4000);
qrycursor SYS_REFCURSOR;
txt_handle UTL_FILE.file_type;
BEGIN
--selectsql := 'select id || '','' || name || '','' || dti from testdump where name = ''gaopeng'' and dti > to_date(''2015-03-17 00:00:00'', ''yyyy-mm-dd hh34:mi:ss'')';
selectsql := 'select nvl(to_char(id),''\N'')||'',''||nvl(name,''\N'')||'',''||nvl(to_char(dt,''yyyy-mm-dd''),''\N'') from txt';
txt_handle := UTL_FILE.FOPEN('DATA_PUMP_DIR', 'testnull1.txt', 'w', 32767);
open qrycursor for selectsql;
loop
fetch qrycursor
into row_result;
exit when qrycursor%notfound;
UTL_FILE.PUT_LINE(txt_handle, row_result);
end loop;
--關(guān)閉游標(biāo)
close qrycursor;
UTL_FILE.FCLOSE(txt_handle);
end;
2、導(dǎo)入到MYSQL
MYSQL LOAD DATA INFILE
1,gaopeng,2010-10-10
2,gaopeng2,2011-11-12
3,gaopeng3,2011-12-13
load data infile '/tmp/testnull1.txt' into table txt fields terminated by ',' LINES TERMINATED BY '\n';
3、MYSQL卸載數(shù)據(jù)
SELECT id,name,dt into outfile "/tmp/test2.txt"
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
FROM txt ;
4、導(dǎo)入到ORACLE
1,gaopeng,2010-10-10
2,gaopeng2,2011-11-12
3,gaopeng3,2011-12-13
append 可以換成 replace
按需求修改
load data
infile '/home/oradba/loadr/in.txt'
badfile '/home/oradba/loadr/bad.txt'
DISCARDFILE '/home/oradba/loadr/dc.txt'
append
into table txt
fields terminated by ','
(id,
name,
dt char "to_date(:dt,'YYYY-MM-DD')"
)
sqlldr userid=ppzhu/gelc123 control=/home/oradba/loadr/ld.ctl log=/home/oradba/loadr/log.log
感謝各位的閱讀,以上就是“ORACLE和MYSQL怎么互相導(dǎo)入數(shù)據(jù)”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)ORACLE和MYSQL怎么互相導(dǎo)入數(shù)據(jù)這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。