Pages

Sunday, July 10, 2011

Tablespace Name miss match for Export - Import

Oracle offers no parameter to specify a different tablespace to import data into. Objects will be re-created in the tablespace they were originally exported from. One can alter this behaviour by following one of these procedures:

Pre-create the table(s) in the correct tablespace:

  • Import the dump file using the INDEXFILE= option. imp /@ file= indexfile=index.sql full=y
  • Edit the indexfile. Remove remarks and specify the correct tablespaces.
  • Run this indexfile against your database, this will create the required tables in the appropriate tablespace. sqlplus /@ @index.sql
  • Import the table(s) with the IGNORE=Y option. imp /@ file= fromuser= touser= ignore=y

Change the default tablespace for the user:
  • Revoke the "UNLIMITED TABLESPACE" privilege from the user
  • Revoke the user's quota from the tablespace from where the object was exported. This forces the import utility to create tables in the user's default tablespace.
  • Make the tablespace to which you want to import the default tablespace for the user
  • Import the table