Source database:
oracle 10.2.0.4 for linux X-64
SID:orcl
datafile location: /u01/app/oracle/oradata/orcl
Destination database:
oracle 11.2.0.3 for linux x-64
SID:orcl
datafile location :+DATA
Testing scenario:
source:
--create tesing environment
sqlplus / as sysdba
create tablespace tts_1 datafile '/u01/app/oracle/oradata/orcl/tts_1.dbf' size 100m;
create user tts identified by tts default tablespace tts_1;
grant connect,resource,select any dictionary to tts;
conn tts/tts
create table all_obj as select * from dba_objects;
--set the tablespace to read only
conn / as sysdba
alter tablespace tts_1 read only;
--create a directory to store expdp metadata
conn / as sysdba
create directory PUMP_TEST as '/tmp/pump_test';
grant read,write on directory PUMP_TEST to tts;
--expdp
expdp system/oracle directory=PUMP_TEST dumpfile=tts.dmp logfile=tts.log TRANSPORT_TABLESPACES=tts_1
--copy dumpfile and datafile
scp /tmp/pump_test/tts.dmp 10.1.61.171:/tmp
scp /u01/app/oracle/oradata/orcl/tts_1.dbf 10.1.61.171:/tmp
Desination database:
--create tesing environment
sqlplus / as sysdba
create user tts identified by tts default tablespace users;
grant connect,resource,select any dictionary to tts;
--copy datafile to ASM
asmcmd
cp /tmp/tts_1.dbf +DATA/ORCL/DATAFILE
--create directory to put the dump file;
mkdir -p /tmp/pump_test
sqlplus / as sysdba
create directory pump_test as '/tmp/pump_test';
grant read,write on directory pump_test to tts;
--mv the dump file to /tmp/pump_test
cd /tmp
mv tts.dmp pump_test
--impdp
impdp system/oracle directory=pump_test dumpfile=tts.dmp TRANSPORT_DATAFILES=+DATA/ORCL/DATAFILE/tts_1.dbf
--make both tablespaces in source database and the destination database read write
alter tablespace tts_1 read write;