1. 准备工作:
查询源数据库平台信息
SQL> col platform_name for a40
SQL> SELECT d.PLATFORM_NAME, ENDIAN_FORMAT
FROM V$TRANSPORTABLE_PLATFORM. tp, V$DATABASE d
WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;
查询目标数据库平台信息
SQL> col platform_name for a40
SQL> SELECT d.PLATFORM_NAME, ENDIAN_FORMAT
FROM V$TRANSPORTABLE_PLATFORM. tp, V$DATABASE d
WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;
查询Oracle10g 支持的平台转换
SQL> select * from v$transportable_platform;
2. 创建一个独立的自包含表空间
创建一个独立的自包含表空间用于测试:
$ sqlplus "/ as sysdba"
SQL> select name from v$datafile;
SQL> create tablespace trans datafile '/data1/oradata/systemfile/trans01.dbf' size 10M;
SQL> create user trans identified by trans default tablespace trans;
SQL> grant connect,resource to trans;
SQL> connect trans/transConnected.
SQL> create table test as select * from user_objects;
SQL> select count(*) from test;
SQL> select * from test;
3. 导出要传输的表空间
$ sqlplus "/ as sysdba"
SQL> alter tablespace trans read only;
$ expdp eygle/eygle dumpfile=trans.dmp directory=dpdata TRANSPORT_TABLESPACES=trans
4. 使用rman 转换文件格式
RMAN> convert tablespace trans
2> to platform. 'Microsoft Windows IA (32-bit)'
3> Format '/tmp/%U';
5. 确认导出文件已生成
$ ls /tmp/data*
/tmp/data_D-EYGLE_I-1337390772_TS-TRANS_FNO-8_01fk92hg
$ chmod 777 /tmp/data*
$ chmod 777 /opt/oracle/dpdata/*
6. 通过ftp 传输文件至目标主机
ftp> bin
ftp> cd /tmp
ftp> mget data*
ftp> cd /opt/oracle/dpdata
ftp> mget trans.dmp
ftp> bye
7. 使用rman 在目标数据库转换文件
RMAN> CONVERT DATAFILE 'E:Oracleoradatavilendpdatadata_D-EYGLE_I-1337390772_TS-TRANS_FNO-8_01fk92hg'
2> DB_FILE_NAME_CONVERT
3>'E:Oracleoradatavilendpdatadata_D-EYGLE_I-1337390772_TS-TRANS_FNO-8_01fk92hg','E:OracleoradatavilenVILENDATAFILE rans01.dbf';
8. 在目标数据库plugin 数据文件
注意目标数据库中的目标用户必须存在,否则会报错
sqlplus "/ as sysdba"
SQL> create user trans identified by trans;
SQL> grant connect,resource to trans;
impdp eygle/eygle dumpfile=trans.dmp directory=dpdata transport_datafiles='E:OracleoradatavilenVILENDATAFILETRANS01.DBF'
9. 检查数据
sqlplus trans/trans
SQL> select count(*) from test;
SQL> alter tablespace trans read write;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/658698/viewspace-348209/ ,如需转载,请注明出处,否则将追究法律责任。