Data Pump Parameter-REMAP_Tablespace

Data Pump Parameter-REMAP_Tablespace

Syntax

REMAP_TABLESPACE=source_tablespace_name:target_tablespace_name


Step:1

SQL> select table_name, tablespace_name from dba_tables where owner=’TEST’;

TABLE_NAME                     TABLESPACE_NAME
—————————— ——————————
DEPT                                        USERS
EMP                                          USERS
BONUS                                     USERS
SALGRADE                             USERS
RAM                                         USERS
SALE_SALES_Q1                   USERS
SALE_SALES_Q2                   USERS
SALE                                        USERS
SITA                                         USERS

9 rows selected.

Step:2
[oracle@oracle11g ~]$ expdp system/oracle schemas=test directory=test_dir dumpfile=remap_test.dmp logfile=remap_schema.log compression=all
Export: Release 11.2.0.3.0 – Production on Sat Sep 5 16:36:38 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting “SYSTEM”.”SYS_EXPORT_SCHEMA_01″:  system/******** schemas=test directory=test_dir dumpfile=remap_test.dmp logfile=remap_schema.log compression=all
Estimate in progress using BLOCKS method…
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 320 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported “TEST”.”DEPT”                               4.968 KB       4 rows
. . exported “TEST”.”EMP”                                5.632 KB      14 rows
. . exported “TEST”.”RAM”                                4.679 KB       1 rows
. . exported “TEST”.”SALGRADE”                           4.890 KB       5 rows
. . exported “TEST”.”SITA”                               4.679 KB       1 rows
. . exported “TEST”.”BONUS”                                  0 KB       0 rows
. . exported “TEST”.”SALE”                                   0 KB       0 rows
. . exported “TEST”.”SALE_SALES_Q1″                          0 KB       0 rows
. . exported “TEST”.”SALE_SALES_Q2″                          0 KB       0 rows
Master table “SYSTEM”.”SYS_EXPORT_SCHEMA_01″ successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
  /u01/dump/remap_test.dmp
Job “SYSTEM”.”SYS_EXPORT_SCHEMA_01″ successfully completed at 16:37:18
Step:3
[oracle@oracle11g ~]$ sqlplus ‘/as sysdba’
SQL*Plus: Release 11.2.0.3.0 Production on Sat Sep 5 16:37:22 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> drop user test cascade;
User dropped.
Step:4
SQL> select name from v$datafile;
NAME
——————————————————————————–
/u01/app/oracle/product/11.2.0/oradata/orcl/system01.dbf
/u01/app/oracle/product/11.2.0/oradata/orcl/sysaux01.dbf
/u01/app/oracle/product/11.2.0/oradata/orcl/undotbs01.dbf
/u01/app/oracle/product/11.2.0/oradata/orcl/users01.dbf
/u01/app/oracle/product/11.2.0/oradata/orcl/example01.dbf
Step:5
SQL> create tablespace test  datafile ‘/u01/app/oracle/product/11.2.0/oradata/orcl/test.dbf’ size 10m;
Tablespace created.
Step:6
SQL> create user test identified by test default tablespace test;
User created.
SQL> grant connect,resource to test;
Grant succeeded.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@oracle11g ~]$ impdp directory=test_dir dumpfile=remap_test.dmp logfile=imp_remap.log remap_tablespace=users:test
Import: Release 11.2.0.3.0 – Production on Sat Sep 5 16:41:06 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Username: system
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table “SYSTEM”.”SYS_IMPORT_FULL_01″ successfully loaded/unloaded
Starting “SYSTEM”.”SYS_IMPORT_FULL_01″:  system/******** directory=test_dir dumpfile=remap_test.dmp logfile=imp_remap.log remap_tablespace=users:test
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:”TEST” already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported “TEST”.”DEPT”                               4.968 KB       4 rows
. . imported “TEST”.”EMP”                                5.632 KB      14 rows
. . imported “TEST”.”RAM”                                4.679 KB       1 rows
. . imported “TEST”.”SALGRADE”                           4.890 KB       5 rows
. . imported “TEST”.”SITA”                               4.679 KB       1 rows
. . imported “TEST”.”BONUS”                                  0 KB       0 rows
. . imported “TEST”.”SALE”                                   0 KB       0 rows
. . imported “TEST”.”SALE_SALES_Q1″                          0 KB       0 rows
. . imported “TEST”.”SALE_SALES_Q2″                          0 KB       0 rows
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job “SYSTEM”.”SYS_IMPORT_FULL_01″ completed with 1 error(s) at 16:41:18
[oracle@oracle11g ~]$ sqlplus ‘/as sysdba’
SQL*Plus: Release 11.2.0.3.0 Production on Sat Sep 5 16:41:22 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select table_name, tablespace_name from dba_tables where owner=’TEST’;
TABLE_NAME                     TABLESPACE_NAME
—————————— ——————————
DEPT                                         TEST
EMP                                           TEST
BONUS                                      TEST
SALGRADE                               TEST
RAM                                            TEST
SALE_SALES_Q1                      TEST
SALE_SALES_Q2                       TEST
SALE                                             TEST
SITA                                               TEST
  • September 5, 2015 | 14 views
  • Comments