首页 > 代码库 > 数据迁移案例

数据迁移案例

/*

  项目需求

    源数据库:192.168.56.130

    被迁移对象:arcer

    所属表空间:users  

  

    目标数据库:192.168.52.234

    目标迁移对象:ARCER

    所属表空间:ACTION_EIMS_TBS

*/

 

实施过程

/*    --目标数据库*/--创建表空间create tablespace action_eims_tbs datafile /u01/app/oracle/oradata/ORCL/action_eims_tbs01.dbfsize 200Mautoextend on next 200Mmaxsize 2048M;--创建用户create user ARCER identified by ARCER DEFAULT TABLESPACE  action_eims_tbs;grant dba,connect,resource to ARCER;--查看目录对象set linesize 200col OWNER for a15col DIRECTORY_NAME for a30col DIRECTORY_PATH for a80select * from dba_directories;--创建目录对象create directory expdp_dir as /home/oracle/workstation/dump_dir;--授权目录对象grant read,write on directory expdp_dir to ARCER;--查看用户对象信息set linesize 200col SEGMENT_NAME for a30col SEGMENT_TYPE for a30col TABLESPACE_NAME for a30select segment_name,segment_type,tablespace_name from user_segments;/*    --源数据库*/--导出数据expdp arcer/arcer directory=dmp_dir dumpfile=arcer_20140910.dmp logfile=arcer_20140910.log /*    --目标数据库*/--导入数据impdp ARCER/ARCER dumpfile=20140626_arcer.dmp directory=EXPDP_DIR remap_schema=arcer:ARCER remap_tablespace=users:action_eims_tbs

 

数据迁移案例