Friday, April 22, 2016

Oracle remap_tablespace

There are instances in DBA's life when we have to perform and export and import of some data. While doing the import we want to move the data or new tablespace this can be done by remap_tablespace parameter in impdp.

Example:

Suppose there is a database DB1 which has a table ITEM owned by USER1 but the tablespace for this table is MYUSERS . Which means that location where this table is stored physically is MYUSERS tablespace.

Database: DB1
TableName: ITEM
Owner of table: USER1
Tablespace of table: MYUSERS

Now you want to perform the export of that table and import into another database NEWDB under MYNEWUSERS tablespace.

This can be done as below:

  • Perform the export as usual.
  • While doing the import include this parameter EMAP_TABLESPACE=MYUSER:MYNEWUSERS


Outcome will be
Table Name: ITEM
Owner : USER1
Tablespace under NEWDB: MYNEWUSERS





No comments: