源库:11.2.0.3及以上的版本
目标库:12c
可以在不同字节序直接转换
无需做自包含检查
无法使用exclude排除表空间
只能全库导出导入
system,sysaux
sys用户下的数据不会导出。
在普通用户下创建的表(存储在system表空间)可以导出
1.创建oracle 外部文件目录
mkdir /u01/app/oracle/mydump
create directory mydump as '/u01/app/oracle/mydump';
grant read,write on directory mydump to public;
2.创建被传输的表空间
create tablespace fte datafile '/u01/app/oracle/oradata/orcl/fet.dbf' size 20m ;
create tablespace fte1 datafile '/u01/app/oracle/oradata/orcl/fet1.dbf' size 20m ;
3.创建测试用户
create user fx identified by fx default tablespace fte;
grant connect ,resource ,dba to fx;
4.创建测试数据
conn fx
create table t1 (id int) ;
insert into t1 values(1);
insert into t1 values(2);
insert into t1 values(3);
create table t2 (name varchar2(50)) tablespace fte1;
insert into t2 values ('aa');
insert into t2 values ('bb');
insert into t2 values ('cc');
5.将除系统表空间之外所有的表空间设置为只读
alter tablespace fte read only;
alter tablespace fte1 read only;
alter tablespace users read only;
alter tablespace example read only;
6.导出数据
expdp fx/fx dumpfile=exp.dmp directory=mydump transportable=always full=y logfile=export.log
7.创建导入目录
create directory mydump as '/opt/oracle/mydump/';
grant read ,write on directory mydump to public;
8.导入数据
拷贝导出dmp文件和数据文件dbf
impdp system/Oracle123 dumpfile = exp.dmp directory = mydump transport_datafiles='/opt/oracle/oradata/ORCL/datafile/example01.dbf','/opt/oracle/oradata/ORCL/datafile/fet.dbf','/opt/oracle/oradata/ORCL/datafile/fet1.dbf','/opt/oracle/oradata/ORCL/datafile/users01.dbf' full=y logfile=import.log