|
;
SEGMENT_NAME PARTITION_ TABLESPACE
-------------------- ---------- ----------
T1 P1 USERS
T1_INDX P1 USERS
T1_INDX P2 TBS2_INDX
T1 P2 TBS2
T1_INDX P3 TBS3_INDX
T1 P3 TBS3
6 rows selected.
拷贝备份数据文件到数据库下,进行数据导入
[oracle@RH6 oradata]$ cp /home/oracle/data/tbs1*.dbf /u01/app/oracle/oradata/prod/
[oracle@RH6 data]$ impdp system/oracle directory=tbs_dir dumpfile=p1.dmp transport_datafiles='/u01/app/oracle/oradata/prod/tbs1.dbf','/u01/app/oracle/oradata/prod/tbs1_indx.dbf' logfile=imp.log
Import: Release 11.2.0.1.0 - Production on Tue Nov 18 18:06:22 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/******** directory=tbs_dir dumpfile=p1.dmp transport_datafiles=/u01/app/oracle/oradata/prod/tbs1.dbf,/u01/app/oracle/oradata/prod/tbs1_indx.dbf logfile=imp.log
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/POST_INSTANCE/PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 18:06:37
数据导入成功
18:01:03 SYS@ prod >select segment_name,partition_name,tablespace_name from dba_segments
18:07:37 2 where segment_name in ('T1_TMP','T1_TMP_INDX');
SEGMENT_NAME PARTITION_ TABLESPACE
-------------------- ---------- ----------
T1_TMP TBS1
T1_TMP_INDX TBS1_INDX
18:09:40 SCOTT@ prod >alter table t1 exchange partition p1 with table t1_tmp including indexes;
Table altered.
18:08:15 SYS@ prod >select segment_name,partition_name,tablespace_name from dba_segments
18:10:46 2 where segment_name in ('T1','T1_INDX') order by 2;
SEGMENT_NAME PARTITION_ TABLESPACE
-------------------- ---------- ----------
T1 P1 TBS1
T1_INDX P1 TBS1_INDX
T1_INDX P2 TBS2_INDX
T1 P2 TBS2
T1_INDX P3 TBS3_INDX
T1 P3 TBS3
6 rows selected.
访问正常(索引亦导入成功)
18:12:07 SCOTT@ prod >col name for a50
18:12:19 SCOTT@ prod >r
1* select * from t1 where id=4
ID NAME
---------- --------------------------------------------------
4 C_OBJ#
4 TAB$
Elapsed: 00:00:00.00
Execution Plan
----------------------------------------------------------
Plan hash value: 1229066337
--------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
--------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2 | 1030 | 1 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE SINGLE | | 2 | 1030 | 1 (0)| 00:00:01 | 1 | 1 |
| 2 | TABLE ACCESS BY LOCAL INDEX ROWID| T1 | 2 | 1030 | 1 (0)| 00:00:01 | 1 | 1 |
|* 3 | INDEX RANGE SCAN | T1_INDX | 1 | | 1 (0)| 00:00:01 | 1 | 1 |
--------------------------------------------------------------------------------------------------------------
Predicate Informa |