Friday, March 22, 2013

Test transportable tablespace (6) -- Observe REMAP_SCHEMA

Objective :  to observe REMAP_SCHMA used during transportation.

1. On top previous test(5), preparations for the import.

orarac2poc:RCAT:/home/oracle> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 22 11:16:41 2013

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SYS@RCAT> drop tablespace tts1 including contents and datafiles;

Tablespace dropped.

SYS@RCAT> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
orarac2poc:RCAT:/home/oracle> su - grid
Password:
[grid@orarac2poc ~]$ asmcmd
ASMCMD> cp /u02/oradata/TTS/tts1_01.dbf +DGRCAT/rcat/datafile/
copying /u02/oradata/TTS/tts1_01.dbf -> +DGRCAT/rcat/datafile/tts1_01.dbf
ASMCMD> exit
[grid@orarac2poc ~]$ exit
logout

2. Import it

orarac2poc:RCAT:/home/oracle/ops/exp> cat impdp_trans_df_remap.par
DIRECTORY=tranp_dir
DUMPFILE=tts.dmp
#TRANSPORT_TABLESPACES=tts1
TRANSPORT_DATAFILES='+DGRCAT/rcat/datafile/tts1_01.dbf'
REMAP_SCHEMA=TRANP:LIQY

orarac2poc:RCAT:/home/oracle/ops/exp> impdp system parfile=impdp_trans_df_remap.par

Import: Release 11.2.0.2.0 - Production on Fri Mar 22 11:20:07 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Password:

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, 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/******** parfile=impdp_trans_df_remap.par
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 11:20:18


3. Verification

orarac2poc:RCAT:/home/oracle/ops/exp> sqlplus  /  as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 22 11:20:28 2013

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SYS@RCAT> select status from dba_tablespaces where tablespace_name='TTS1';

STATUS
---------
READ ONLY

SYS@RCAT> select owner from dba_tables where table_name='T01';

OWNER
------------------------------
LIQY

SYS@RCAT> SELECT COUNT(*) FROM LIQY.T01;

  COUNT(*)
----------
     65949

SYS@RCAT> conn liqy/liqyliqy
Connected.
LIQY@RCAT> SELECT COUNT(*) FROM T01;

  COUNT(*)
----------
     65949


Conclusion: 

The schema owner is changed if remap_schema is used when transporting tablespace.