1.确定自包含表空间集合。自包含表空间集合是指具有关联关系的表空间集合。当搬移表空间是,如果在两个表空间之间存在关联关系,则必须同时搬移这两个表空间。
通过执行包DBMS_TTS的过程TRANSPORT_SET_CHECK可以完成表空间集合是否为自包含的检测。执行完该过程后,系统将违反子包含表空间集合规则的信息写入到临时表transport_set_violations。
SQL> exec sys.dbms_tts.transport_set_check('VIP2006');
PL/SQL procedure successfully completed.
SQL> select * from sys.transport_set_violations;
no rows selected
2.导出表空间的元数据
[oracle@qht107 ~]$ expdp l5m/l5m directory=dump_dir dumpfile=vip2006.dmp
transport_tablespaces=VIP2006
Export: Release 10.2.0.4.0 - Production on Monday, 09 February, 2009 14:18:13
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "L5M"."SYS_EXPORT_TRANSPORTABLE_01": l5m/******** directory=dump_dir
dumpfile=vip2006.dmp transport_tablespaces=VIP2006
ORA-39123: Data Pump transportable tablespace job aborted
ORA-29335: tablespace 'VIP2006' is not read only
Job "L5M"."SYS_EXPORT_TRANSPORTABLE_01" stopped due to fatal error at 14:18:15
表空间移植时必须readonly表空间。
SQL> alter tablespace vip2006 read only;
Tablespace altered.
[oracle@qht107 ~]$ expdp l5m/l5m directory=dump_dir dumpfile=vip2006.dmp
transport_tablespaces=VIP2006
Export: Release 10.2.0.4.0 - Production on Monday, 09 February, 2009 14:19:49
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "L5M"."SYS_EXPORT_TRANSPORTABLE_01": l5m/******** directory=dump_dir
dumpfile=vip2006.dmp transport_tablespaces=VIP2006
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/INDEX
Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "L5M"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for L5M.SYS_EXPORT_TRANSPORTABLE_01 is:
/u01/oradata/dump_dir/vip2006.dmp
Job "L5M"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 14:20:18
3.将元数据和数据库拷贝到目标库
[oracle@qht107 ~]$ scp /u01/oradata/orcl/VIP2006_01.dbf
172.17.61.131:/u01/app/oracle/admin/orcl/dpdump
[oracle@qht107 oradata]$ cd /u01/oradata/dump_dir/
[oracle@qht107 ~]$ scp vip2006.dmp 172.17.61.131:/u01/app/oracle/admin/orcl/dpdump
4.impdp导入到目录库
[oracle@rhel131 ~]$ impdp system/sys@orcl dumpfile=vip2006.dmp
transport_datafiles='VIP2006_001.dbf' directory=DATA_PUMP_DIR
Import: Release 10.2.0.1.0 - Production on Saturday, 07 February, 2009 1:35:36
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/********@orcl dumpfile=vip2006.dmp
transport_datafiles=VIP2006_001.dbf directory=DATA_PUMP_DIR
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: Data Pump transportable tablespace job aborted
ORA-00721: changes by release 10.2.0.3.0 cannot be used by release 10.2.0.1.0
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" stopped due to fatal error at 01:35:46
发现从高版本无法导入到底版本的数据库。
expdp有个version的参数,不要误以为加了这个参数就是能够导出低版本的dmp文件,这个参数只是导出指定参数版本完全兼容的数据类型。文档上是这样写的:
Specifies the version of database objects to be exported. This can be used to create a dump
file set that is compatible with a previous release of Oracle Database. Note that this does
not mean that Data Pump Export can be used with versions of Oracle Database prior to 10.1.
Data Pump Export only works with Oracle Database 10g release 1 (10.1) or later. The VERSION
parameter simply allows you to identify the version of the objects being exported.
VERSION={COMPATIBLE | LATEST | version_string}
Database objects or attributes that are incompatible with the specified version will not be
exported. For example, tables containing new datatypes that are not supported in the
specified version will not be exported.
接着试着把10.2.0.1版本的expdp文档拷贝过去执行,但是不象exp一样可行。可以从输出看到执行的还是10204的版本。
[oracle@qht107 ~]$ ./expdp10201 l5m/l5m directory=dump_dir dumpfile=vip2006.dmp
transport_tablespaces=VIP2006
Export: Release 10.2.0.4.0 - Production on Monday, 09 February, 2009 15:51:02
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "L5M"."SYS_EXPORT_TRANSPORTABLE_01": l5m/******** directory=dump_dir
dumpfile=vip2006.dmp transport_tablespaces=VIP2006
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/INDEX
Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "L5M"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for L5M.SYS_EXPORT_TRANSPORTABLE_01 is:
/u01/oradata/dump_dir/vip2006.dmp
Job "L5M"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 15:51:27
通过简单的测试,遇到了一点小麻烦,由于10.2.0.4数据库的compatible参数为10.2.0.3,如两台数据库的compatible是一致的,会不会成功?
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/271283/viewspace-1017102/ ,如需转载,请注明出处,否则将追究法律责任。