最后就可以执行导入过程了
[oracle@jingyong1 ~]$ export ORACLE_SID=jy
[oracle@jingyong1 ~]$ export NLS_DATE_FORMATE='yyyy-mm-dd hh24:mi:ss'
[oracle@jingyong1 ~]$ impdp test/test directory=mytest dumpfile=dmpfile.dmp logfile=testtransport.log transport_datafiles= /u02/tspitr01.dbf, /u02/test01.dbf
Import: Release 10.2.0.5.0 - Production on Friday, 27 March, 2015 20:28:39
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "TEST"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "TEST"."SYS_IMPORT_TRANSPORTABLE_01": test/******** directory=mytest dumpfile=dmpfile.dmp logfile=testtransport.log transport_datafiles= /u02/tspitr01.dbf, /u02/test01.dbf
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "TEST"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 20:28:55
进入数据库中检查一下
SQL> select count(*) from tspitr.tspitr;
COUNT(*)
----------
50641
SQL> select count(*) from test.test;
COUNT(*)
----------
50680
与2015-03-27 16:48:29之前的状态一致。
下面演示使用还原点来执行传输表空间
1.确认源数据库与目标数据库所在平台是不是传输表空间所支持的操作系统平台。
确认源数据库操作系统平台:
SQL> select d.platform_name,endian_format from v$transportable_platform tp,v$database d
2 where tp.platform_name=d.platform_name ;
PLATFORM_NAME ENDIAN_FORMAT
----------------------------------------------------------------------------------------------------- --------------
Linux IA (32-bit) Little
确认目数据库操作系统平台:
SQL> select d.platform_name,endian_format from v$transportable_platform tp,v$database d
2 where tp.platform_name=d.platform_name ;
PLATFORM_NAME ENDIAN_FORMAT
----------------------------------------------------------------------------------------------------- --------------
Linux IA (32-bit) Little
这里操作系统平台都是Linux
2.确认要被传输的表空间是否是自包含表空间(TSPITR,TEST):
SQL> exec sys.dbms_tts.transport_set_check('TSPITR',true);
PL/SQL procedure successfully completed.
SQL> exec sys.dbms_tts.transport_set_check('TEST',true);
PL/SQL procedure successfully completed.
SQL> select * from sys.transport_set_violations;
no rows selected
如果没有行选择,表示该表空间只包含表数据,可以传输。
修改表tspitr与test中的记录,在修改之前创建一个还原点,在执行传输表空间时指定这个还原点
SQL> select count(*) from test;
COUNT(*)
----------
0
SQL> select count(*) from tspitr.tspitr;
COUNT(*)
----------
101282
SQL> create restore point before_update;
Restore point created.
SQL> insert into test select * from dba_objects;
50683 rows created.
SQL> commit;
Commit complete.
SQL> delete from tspitr.tspitr;
101282 rows deleted.
SQL> commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
50683
SQL> select count(*) from tspitr.tspitr;
COUNT(*)
----------
0
在创建还原点before_update之后,表tspitr中的记录数为0,表test的记录数为50683,before_update之前,表tspitr中的记录数为101282,表test的记录数为0。