您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Oracle超大数据导出为文本文件

2024/3/17 3:16:18发布13次查看
要从oracle导出部分数据到文本文件中(flatfile),由于数据表很大,使用toad时导出失败,居然说内存溢出。看来还是用oracle自己的命
要从oracle导出部分数据到文本文件中(flatfile),由于数据表很大,使用toad时导出失败,,居然说内存溢出。看来还是用oracle自己的命令来完成吧。
首先需要准备导出的目录,假设为 /opt/tmp,该目录需要oracle的帐户可以读写。
create or replace directory utlexportpath as '/opt/tmp';
然后在sqlplus中即可使用如下方式把文件导出:
declare
    outfile utl_file.file_type;
begin
    outfile := utl_file.fopen('utlexportpath','exp.txt','w');
    for rec in (select col1,col2 from sometable where your conditions)
    loop
       utl_file.put_line(outfile, rec.col1||','||rec.col2);
    end loop;
    utl_file.fclose(f);
end;
即便是导出上g的数据,也会非常的快。
试试吧。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product