qq_35281950 2018-05-02 08:15 采纳率: 0%
浏览 2686
已结题

plsql导出30G的数据(orcale),怎么快点?

有个orcale数据库,用工具plsql 导出30G的数据,再导入到备用数据库里面。请问怎么快一点?

  • 写回答

3条回答 默认 最新

  • 游泳的魚 2018-05-02 08:34
    关注

    你好,导出这么大数据,最好使用exp或者数据泵方式导出和导入,效率会更高,现将这两种方式使用方式说明如下:
    一、exp\imp方式,在cmd命令窗口输入:
    1、导出:exp user/password file=d:\exp.dmp log=d:\exp.log full=y
    2、导入:imp user/password file=d:\exp.dmp log=d:\imp.log full=y
    二、数据泵方式
    1、新建逻辑目录
    最好以system等管理员创建逻辑目录,Oracle不会自动创建实际的物理目录“D:\oracleData”(务必手动创建此目录),仅仅是进行定义逻辑路径dump_dir;
    sql> conn system/123456a?@orcl as sysdba;
    sql>create directory dump_dir as 'D:\oracleData';
    2、查看管理员目录(同时查看操作系统是否存在该目录,因为oracle并不关心该目录是否存在,假如不存在,则出错)
    sql>select * from dba_directories;
    3、用expdp导出数据
    1)导出用户及其对象
    expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp directory=dump_dir;
    2)导出指定表
    expdp scott/tiger@orcl tables=emp,dept dumpfile=expdp.dmp directory=dump_dir;
    3)按查询条件导
    expdp scott/tiger@orcl directory=dump_dir dumpfile=expdp.dmp tables=empquery='where deptno=20';
    4)按表空间导
    expdp system/manager@orcl directory=dump_dir dumpfile=tablespace.dmptablespaces=temp,example;
    5)导整个数据库
    expdp system/manager@orcl directory=dump_dir dumpfile=full.dmp full=y;
    4、用impdp导入数据
    在正式导入数据前,要先确保要导入的用户已存在,如果没有存在,请先用下述命令进行新建用户
    --创建表空间
    create tablespace tb_name datafile 'D:\tablespace\tb_name.dbf' size 1024m AUTOEXTEND ON;
    --创建用户
    create user user_name identified by A123456a default tablespace tb_name temporary tablespace TEMP;
    --给用户授权
    sql>grant read,write on directory dump_dir to user_name;
    sql>grant dba,resource,unlimited tablespace to user_name;
    1)导入用户(从用户scott导入到用户scott)
    impdp scott/tiger@orcl directory=dump_dir dumpfile=expdp.dmp schemas=scott;
    2)导入表(从scott用户中把表dept和emp导入到system用户中)
    impdp system/manager@orcl directory=dump_dir dumpfile=expdp.dmptables=scott.dept,scott.emp remap_schema=scott:system;
    3)导入表空间
    impdp system/manager@orcl directory=dump_dir dumpfile=tablespace.dmp tablespaces=example;
    4)导入数据库
    impdb system/manager@orcl directory=dump_dir dumpfile=full.dmp full=y;
    5)追加数据
    impdp system/manager@orcl directory=dump_dir dumpfile=expdp.dmp schemas=systemtable_exists_action
    以上是日常工作中实际工作中用到的,希望能够给你得到帮助。

    评论

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配